[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) <jol@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
This commit is contained in:
aliya
2023-01-19 17:49:11 +01:00
parent 823abebe83
commit 6278eaeb32
+5 -2
View File
@@ -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