From 6278eaeb3240ad6b3fbb39e6e63f3e7497e0a9ef Mon Sep 17 00:00:00 2001 From: aliya Date: Mon, 16 Jan 2023 11:00:35 +0000 Subject: [PATCH] [FIX] l10n_fr_fec: fix unaffected earnings account check Before account types refactoring, fec wizard would check whether company has accounts for unaffected earnings and only call `_do_query_unaffected_earnings` in that case. Now it would always call it. This commit adds a check for `equity_unaffected` accounts back closes odoo/odoo#110408 X-original-commit: f9bdc589450514c3e240efb2297ded1f1a4c5879 Signed-off-by: John Laterre (jol) Signed-off-by: Aliya Tastemirova (alta) --- addons/l10n_fr_fec/wizard/account_fr_fec.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index c057d5ee2dd..ea33091a4cd 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -146,9 +146,12 @@ class AccountFrFec(models.TransientModel): rows_to_write = [header] # INITIAL BALANCE - unaffected_earnings_xml_ref = 'equity_unaffected' + unaffected_earnings_account = self.env['account.account'].search([ + ('account_type', '=', 'equity_unaffected'), + ('company_id', '=', company.id) + ], limit=1) unaffected_earnings_line = True # used to make sure that we add the unaffected earning initial balance only once - if unaffected_earnings_xml_ref: + if unaffected_earnings_account: #compute the benefit/loss of last year to add in the initial balance of the current year earnings account unaffected_earnings_results = self._do_query_unaffected_earnings() unaffected_earnings_line = False