From 3dd79b3d65cdac2598db95a287d85442bb3bc0f4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 16 Nov 2015 14:54:10 +0100 Subject: [PATCH] [FIX] account: improve performances for reconciliations The field `company_id` on `account.move.line` is a related to the `company_id` field of the `account_id` field on this move line. Therefore: - Forcing the company of the `account.move.line` to the company of the `account.bank.statement.line` is pointless, as this field is supposed to be a related from the `account_id` of the move line. It's the `account_id` that must be set correctly, to an `account.account` of the right company. This is the case, btw. - Forcing the company of the `account.move.line` triggers the write of the `company_id` on the related `account.account`, which triggers the write of the `company_id` on all `account.move.line` records having as `account_id` this `account.account`. Therefore, the more you had move lines on an `account.account`, the more the reconciliation was slow for move lines with this `account_id`. opw-656463 --- addons/account/models/account_bank_statement.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index e81b2f8af98..20878928588 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -821,7 +821,6 @@ class AccountBankStatementLine(models.Model): aml_dict['date'] = self.date aml_dict['partner_id'] = self.partner_id.id aml_dict['journal_id'] = self.journal_id.id - aml_dict['company_id'] = self.company_id.id aml_dict['statement_id'] = self.statement_id.id if st_line_currency.id != company_currency.id: aml_dict['amount_currency'] = aml_dict['debit'] - aml_dict['credit']