Skip to content
Snippets Groups Projects
Commit 9b3c19b4 authored by wan's avatar wan
Browse files

[FIX] account: fix standalone test with demo data creation


The test is running in sudo mode, so we need to specify the company in
the search.

Also do not load the demo data when installing as we would do the work
twice for most localization.

closes odoo/odoo#67235

Signed-off-by: default avatarLaurent Smet <smetl@users.noreply.github.com>
parent 567f192d
Branches
Tags
No related merge requests found
......@@ -106,7 +106,10 @@ class AccountChartTemplate(models.Model):
ref = self.env.ref
return ('account.bank.statement', {
f'{cid}_demo_bank_statement_1': {
'journal_id': self.env['account.journal'].search([('type', '=', 'bank')], limit=1).id,
'journal_id': self.env['account.journal'].search([
('type', '=', 'bank'),
('company_id', '=', cid),
], limit=1).id,
'date': time.strftime('%Y')+'-01-01',
'balance_end_real': 9944.87,
'balance_start': 5103.0,
......
......@@ -13,6 +13,8 @@ def test_all_l10n(env):
As the module install is not yet fully transactional, the modules will
remain installed after the test.
"""
# Do not install the demo data while installing the modules
env.ref('base.module_account').demo = False
l10n_mods = env['ir.module.module'].search([
('name', 'like', 'l10n%'),
('state', '=', 'uninstalled'),
......@@ -21,6 +23,8 @@ def test_all_l10n(env):
env.reset() # clear the set of environments
env = env() # get an environment that refers to the new registry
# Install the demo data when testing
env.ref('base.module_account').demo = True
coas = env['account.chart.template'].search([])
for coa in coas:
cname = 'company_%s' % str(coa.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment