[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: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user