|
@@ -18,7 +18,7 @@ DATE_FORMAT = '%Y-%m-%d'
|
|
DATETIME_FORMAT = '%Y-%m-%d %H:%m:%S'
|
|
DATETIME_FORMAT = '%Y-%m-%d %H:%m:%S'
|
|
GZIP_COMPRESSION_LEVEL = 9
|
|
GZIP_COMPRESSION_LEVEL = 9
|
|
|
|
|
|
-class Purchases(http.Controller):
|
|
|
|
|
|
+class Statement(http.Controller):
|
|
|
|
|
|
''' Get timezone '''
|
|
''' Get timezone '''
|
|
def get_timezone(self):
|
|
def get_timezone(self):
|
|
@@ -52,7 +52,7 @@ class Purchases(http.Controller):
|
|
def get_currencies_from_journal(self):
|
|
def get_currencies_from_journal(self):
|
|
domain = [
|
|
domain = [
|
|
('type', 'in', ['bank', 'cash']),
|
|
('type', 'in', ['bank', 'cash']),
|
|
- ('default_debit_account_id.currency_id', '=', False),
|
|
|
|
|
|
+ # ('default_debit_account_id.currency_id', '=', False),
|
|
('active', '=', True)
|
|
('active', '=', True)
|
|
]
|
|
]
|
|
|
|
|
|
@@ -88,7 +88,8 @@ class Purchases(http.Controller):
|
|
if (journalID.type in ['bank', 'cash']):
|
|
if (journalID.type in ['bank', 'cash']):
|
|
journal.append(journalID.id)
|
|
journal.append(journalID.id)
|
|
|
|
|
|
- domain = [('type', 'in', type), ('default_debit_account_id.currency_id', '=', False), ('active', '=', True)]
|
|
|
|
|
|
+ # domain = [('type', 'in', type), ('default_debit_account_id.currency_id', '=', False), ('active', '=', True)]
|
|
|
|
+ domain = [('type', 'in', type),('active', '=', True)]
|
|
|
|
|
|
if (journal):
|
|
if (journal):
|
|
domain.append(('id', 'in', journal ))
|
|
domain.append(('id', 'in', journal ))
|
|
@@ -100,6 +101,7 @@ class Purchases(http.Controller):
|
|
'code': journal.code,
|
|
'code': journal.code,
|
|
'cashControl': journal.cash_control,
|
|
'cashControl': journal.cash_control,
|
|
'type': journal.type,
|
|
'type': journal.type,
|
|
|
|
+ 'storeIds': map(lambda x: x.id, journal.store_ids),
|
|
'currency': {
|
|
'currency': {
|
|
'id': journal.currency.id,
|
|
'id': journal.currency.id,
|
|
'name': journal.currency.name,
|
|
'name': journal.currency.name,
|
|
@@ -140,12 +142,14 @@ class Purchases(http.Controller):
|
|
'id': statement.id,
|
|
'id': statement.id,
|
|
'name': statement.name,
|
|
'name': statement.name,
|
|
'date': statement.date,
|
|
'date': statement.date,
|
|
|
|
+ 'state': statement.state,
|
|
'balanceEnd': statement.balance_end,
|
|
'balanceEnd': statement.balance_end,
|
|
'user': {
|
|
'user': {
|
|
'id': statement.user_id.id,
|
|
'id': statement.user_id.id,
|
|
'name': statement.user_id.name,
|
|
'name': statement.user_id.name,
|
|
'displayName': statement.user_id.display_name
|
|
'displayName': statement.user_id.display_name
|
|
},
|
|
},
|
|
|
|
+ 'userSession': request.env.user.id,
|
|
'journal': {
|
|
'journal': {
|
|
'id': statement.journal_id.id,
|
|
'id': statement.journal_id.id,
|
|
'name': statement.journal_id.name,
|
|
'name': statement.journal_id.name,
|
|
@@ -175,6 +179,17 @@ class Purchases(http.Controller):
|
|
'id': statement.type_statement.id,
|
|
'id': statement.type_statement.id,
|
|
'name': statement.type_statement.name,
|
|
'name': statement.type_statement.name,
|
|
'code': statement.type_statement.code
|
|
'code': statement.type_statement.code
|
|
|
|
+ },
|
|
|
|
+ 'currency':{
|
|
|
|
+ 'id': statement.currency.id,
|
|
|
|
+ 'name': statement.currency.display_name,
|
|
|
|
+ 'base': statement.currency.base,
|
|
|
|
+ 'symbol': statement.currency.symbol,
|
|
|
|
+ 'position': statement.currency.position,
|
|
|
|
+ 'rateSilent': statement.currency.rate_silent,
|
|
|
|
+ 'decimalSeparator': statement.currency.decimal_separator,
|
|
|
|
+ 'decimalPlaces': statement.currency.decimal_places,
|
|
|
|
+ 'thousandsSeparator': statement.currency.thousands_separator
|
|
}
|
|
}
|
|
} for statement in request.env['account.bank.statement'].search(domain)]
|
|
} for statement in request.env['account.bank.statement'].search(domain)]
|
|
|
|
|
|
@@ -236,25 +251,84 @@ class Purchases(http.Controller):
|
|
def make_info_log(self, log):
|
|
def make_info_log(self, log):
|
|
LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))
|
|
LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))
|
|
|
|
|
|
- ''' Bank statement Init '''
|
|
|
|
|
|
+ '''
|
|
|
|
+ ██ ███ ██ ██ ████████
|
|
|
|
+ ██ ████ ██ ██ ██
|
|
|
|
+ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██ ██ ████ ██ ██
|
|
|
|
+ '''
|
|
@http.route('/eiru_bank_statement/init', auth='user', methods=['GET'], cors='*')
|
|
@http.route('/eiru_bank_statement/init', auth='user', methods=['GET'], cors='*')
|
|
def init_bank_statement(self,**kw):
|
|
def init_bank_statement(self,**kw):
|
|
-
|
|
|
|
|
|
+ from account_bank_statement_type import get_account_bank_statement_type
|
|
|
|
+ from res_store import get_res_store
|
|
|
|
+ from res_users import get_res_users
|
|
self.make_info_log('Preparing data to {}'.format(kw.get('mode')))
|
|
self.make_info_log('Preparing data to {}'.format(kw.get('mode')))
|
|
- journals = self.get_journals([kw.get('mode')]),
|
|
|
|
|
|
+ store = get_res_store(kw.get('mode'))
|
|
|
|
|
|
return self.make_gzip_response({
|
|
return self.make_gzip_response({
|
|
'date': self.get_server_date(),
|
|
'date': self.get_server_date(),
|
|
'user': self.get_user(),
|
|
'user': self.get_user(),
|
|
'currencies': self.get_currencies_from_journal(),
|
|
'currencies': self.get_currencies_from_journal(),
|
|
- 'journals': journals,
|
|
|
|
- 'statement': self.get_account_bank_statement(map(lambda x: x['id'], journals[0])),
|
|
|
|
|
|
+ 'journals': self.get_journals([kw.get('mode')]),
|
|
|
|
+ # 'statement': self.get_account_bank_statement(map(lambda x: x['id'], journals[0])),
|
|
|
|
+ 'statement': self.get_account_bank_statement(store['journalIds']),
|
|
'statementConfig' : self.get_account_bank_statement_config(),
|
|
'statementConfig' : self.get_account_bank_statement_config(),
|
|
- # 'suppliers': self.get_suppliers(),
|
|
|
|
- # 'products': self.get_products(kw.get('mode')),
|
|
|
|
- # 'pickingTypes': self.get_picking_types(),
|
|
|
|
- # 'paymentTerms': self.get_payment_terms(),
|
|
|
|
- # 'banks': self.get_banks(),
|
|
|
|
- # 'bankPaymentTypes': self.get_bank_payment_types(),
|
|
|
|
- # 'chequeTypes': self.get_cheque_types()
|
|
|
|
|
|
+ 'statementType': get_account_bank_statement_type(),
|
|
|
|
+ 'resUsers': get_res_users(store['userIds'])
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ '''
|
|
|
|
+ ██████ █████ ███████ ██ ██ ██████ ██████ ██ ██ ███ ███ ██████ ██ ██ ███████
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██
|
|
|
|
+ ██ ███████ ███████ ███████ ██████ ██ ██ ███ ██ ████ ██ ██ ██ ██ ██ █████
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██████ ██ ██ ███████ ██ ██ ██████ ██████ ██ ██ ██ ██ ██████ ████ ███████
|
|
|
|
+ * Transfer.
|
|
|
|
+ * Input.
|
|
|
|
+ * Output.
|
|
|
|
+ '''
|
|
|
|
+ @http.route('/eiru_bank_statement/create_cashbox_move', type='json', auth='user', methods=['POST'],cors='*')
|
|
|
|
+ def _create_cashbox_move(self, **kw):
|
|
|
|
+ from account_bank_statement_line import create_statement_line
|
|
|
|
+ from cashbox_transfer import create_cashbox_transfer
|
|
|
|
+ from cashbox_input import create_cashbox_input
|
|
|
|
+ from cashbox_output import create_cashbox_output
|
|
|
|
+ data = kw.get('data')
|
|
|
|
+
|
|
|
|
+ ''' Transferencia '''
|
|
|
|
+ if (data['transfer']):
|
|
|
|
+ return create_cashbox_transfer(data)
|
|
|
|
+
|
|
|
|
+ ''' Entrada de Dinero '''
|
|
|
|
+ if (data['input']):
|
|
|
|
+ return create_cashbox_input(data)
|
|
|
|
+
|
|
|
|
+ ''' Salida de Dinero '''
|
|
|
|
+ if (data['output']):
|
|
|
|
+ return create_cashbox_output(data)
|
|
|
|
+
|
|
|
|
+ '''
|
|
|
|
+ ██████ ██████ ███████ █████ ████████ ███████
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██ ██████ █████ ███████ ██ █████
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██████ ██ ██ ███████ ██ ██ ██ ███████ Statement
|
|
|
|
+ '''
|
|
|
|
+ @http.route('/eiru_bank_statement/create_account_bank_statement', type='json', auth='user', methods=['POST'],cors='*')
|
|
|
|
+ def _create_account_bank_statement(self, **kw):
|
|
|
|
+ from account_bank_statement import create_account_bank_statement
|
|
|
|
+
|
|
|
|
+ return create_account_bank_statement(kw.get('data'))
|
|
|
|
+ '''
|
|
|
|
+ ██████ ██ ██████ ███████ ██ ███ ██ ██████
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ████ ██ ██
|
|
|
|
+ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ███
|
|
|
|
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
+ ██████ ███████ ██████ ███████ ██ ██ ████ ██████ STATEMENT
|
|
|
|
+ '''
|
|
|
|
+ @http.route('/eiru_bank_statement/process_closing_statement', type='json', auth='user', methods=['POST'],cors='*')
|
|
|
|
+ def _process_closing_statement(self, **kw):
|
|
|
|
+ from account_bank_statement import closing_statement
|
|
|
|
+
|
|
|
|
+ return closing_statement(kw.get('data'))
|