[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
This commit is contained in:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user