From 5d5fbb8d93fea834dc51b29a6190b2739ef739e4 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 00:05:28 +0200 Subject: [PATCH 1/5] [FIX] wrong unique ID + find the iban when give the bban account number --- beesdoo_coda/wizard/import_coda.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/beesdoo_coda/wizard/import_coda.py b/beesdoo_coda/wizard/import_coda.py index bc9c88a..256dc68 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.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 From dfdd29d26427fbbe4996290ca62b0376ef202ef2 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 00:12:55 +0200 Subject: [PATCH 2/5] [CHANGE] use old and new balance date as unique ID, be sure to have no conflict with old unique id in coda --- beesdoo_coda/wizard/import_coda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beesdoo_coda/wizard/import_coda.py b/beesdoo_coda/wizard/import_coda.py index 256dc68..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.new_balance_date + '-' + move.ref + 'unique_import_id' : statement.coda_seq_number + '-' + statement.old_balance_date + '-' + statement.new_balance_date + '-' + move.ref } return move_data From 69854e6f0e86c4bb18e9b9d2fc33fc25ee50e8a8 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 13:17:16 +0200 Subject: [PATCH 3/5] Update __openerp__.py Add Purchase dependency to beesdoo_base --- beesdoo_base/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beesdoo_base/__openerp__.py b/beesdoo_base/__openerp__.py index 6101c91..ed2e67f 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', From 3300d09807a030ae1765d66896fad64ed9535ef8 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 13:48:44 +0200 Subject: [PATCH 4/5] Update __openerp__.py Add missing dependency on beesdoo_pos --- beesdoo_pos/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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': [ From 8e6d8c0d94d468048bafb7b536d5197ccb4af4c7 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 17:04:09 +0200 Subject: [PATCH 5/5] [FIX] do not fail if consignes tax group does not exist --- beesdoo_product/models/beesdoo_product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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