Skip to content

Commit

Permalink
[FIX] account: journal deletion prevent the creation of sub-companies
Browse files Browse the repository at this point in the history
Go to Accounting > Configuration > Journals
Delete the EXCH journal
Go to Settings > Companies, open the main company
Try to create a new branch

Traceback comes up:
"ValueError: External ID not found in the system: account.2_exch"

This occurs because when setting up the new company we are looking for
the ref 'exch'. The system will look for the xmlid
`account.<company_id>_exch` but the journal has been deleted so it will
not be found.

A solution is to avoid blocking the company creation, the user will need
to create the missing journal afterward

opw-3932849

closes odoo#167407

Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <[email protected]>
  • Loading branch information
agr-odoo committed May 31, 2024
1 parent dc96e8e commit 64e4c29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/account/models/chart_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,9 @@ def _post_load_data(self, template_code, company, template_data):

# Set newly created journals as defaults for the company
if not company.tax_cash_basis_journal_id:
company.tax_cash_basis_journal_id = self.ref('caba')
company.tax_cash_basis_journal_id = self.ref('caba', raise_if_not_found=False)
if not company.currency_exchange_journal_id:
company.currency_exchange_journal_id = self.ref('exch')
company.currency_exchange_journal_id = self.ref('exch', raise_if_not_found=False)

# Setup default Income/Expense Accounts on Sale/Purchase journals
sale_journal = self.ref("sale", raise_if_not_found=False)
Expand Down

0 comments on commit 64e4c29

Please sign in to comment.