diff --git a/beesdoo_base/__openerp__.py b/beesdoo_base/__openerp__.py index c070008..6a7cd04 100644 --- a/beesdoo_base/__openerp__.py +++ b/beesdoo_base/__openerp__.py @@ -15,7 +15,7 @@ 'category': 'Project Management', 'version': '0.1', - 'depends': ['point_of_sale'], + 'depends': ['point_of_sale', 'purchase'], 'data': [ 'security/groups.xml', diff --git a/beesdoo_coda/wizard/import_coda.py b/beesdoo_coda/wizard/import_coda.py index bc9c88a..3f378c4 100644 --- a/beesdoo_coda/wizard/import_coda.py +++ b/beesdoo_coda/wizard/import_coda.py @@ -33,7 +33,7 @@ class CodaBankStatementImport(models.TransientModel): 'partner_name': move.counterparty_name, #ok 'ref': move.ref, 'sequence': sequence, #ok - 'unique_import_id' : statement.coda_seq_number + '-' + statement.creation_date + '-' + move.ref + 'unique_import_id' : statement.coda_seq_number + '-' + statement.old_balance_date + '-' + statement.new_balance_date + '-' + move.ref } return move_data @@ -47,6 +47,14 @@ class CodaBankStatementImport(models.TransientModel): 'transactions' : [] } return statement_data + + def _get_acc_number(self, acc_number): + #Check if we match the exact acc_number or the end of an acc number + journal = self.env['account.journal'].search([('bank_acc_number', '=like', '%' + acc_number)]) + if not journal or len(journal) > 1: #if not found or ambiguious + return acc_number + + return journal.bank_acc_number def _parse_file(self, data_file): parser = Parser() @@ -66,4 +74,4 @@ class CodaBankStatementImport(models.TransientModel): for move in statement.movements: statement_data['transactions'].append(self._get_move_value(move, statement, len(statement_data['transactions']) + 1)) - return currency_code, account_number, stmts_vals + return currency_code, self._get_acc_number(account_number), stmts_vals diff --git a/beesdoo_pos/__openerp__.py b/beesdoo_pos/__openerp__.py index 384275e..2d9a200 100644 --- a/beesdoo_pos/__openerp__.py +++ b/beesdoo_pos/__openerp__.py @@ -20,7 +20,7 @@ 'version': '0.1', # any module necessary for this one to work correctly - 'depends': ['point_of_sale', 'beesdoo_base'], + 'depends': ['beesdoo_base', 'beesdoo_product'], # always loaded 'data': [ diff --git a/beesdoo_product/models/beesdoo_product.py b/beesdoo_product/models/beesdoo_product.py index ff67d7b..1e72180 100644 --- a/beesdoo_product/models/beesdoo_product.py +++ b/beesdoo_product/models/beesdoo_product.py @@ -35,7 +35,8 @@ class BeesdooProduct(models.Model): @api.one @api.depends('taxes_id', 'list_price', 'taxes_id.amount', 'taxes_id.tax_group_id', 'total_with_vat', 'display_weight', 'weight') def _get_total(self): - consignes_group = self.env.ref('beesdoo_product.consignes_group_tax') + consignes_group = self.env.ref('beesdoo_product.consignes_group_tax', raise_if_not_found=False) + tax_amount_sum = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id != consignes_group]) self.total_deposit = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id == consignes_group]) self.total_with_vat = self.list_price + tax_amount_sum