[IMP] account, l10n_xx: change CoA loading methods
Before, we only had a public method that installed the CoA for the current active company. With the multi-company changes, it was not possible anymore to install a module with a demo company and then have the CoA installed in that demo company correctly. We changed that public method to be able to put an extra optional parameter and shortened its name to try_loading instead of try_loading_for_current_company. The method that it calls when there is no chart installed is made private and renamed to _load. closes odoo/odoo#35703 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
@@ -164,21 +164,24 @@ class AccountChartTemplate(models.Model):
|
|||||||
'chart_template_id': self.id,
|
'chart_template_id': self.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
def try_loading_for_current_company(self):
|
def try_loading(self, company=False):
|
||||||
""" Installs this chart of accounts for the current company if not chart
|
""" Installs this chart of accounts for the current company if not chart
|
||||||
of accounts had been created for it yet.
|
of accounts had been created for it yet.
|
||||||
"""
|
"""
|
||||||
# do not use `request.env` here, it can cause deadlocks
|
# do not use `request.env` here, it can cause deadlocks
|
||||||
if request and hasattr(request, 'allowed_company_ids'):
|
if not company:
|
||||||
company = self.env['res.company'].browse(request.allowed_company_ids[0])
|
if request and hasattr(request, 'allowed_company_ids'):
|
||||||
else:
|
company = self.env['res.company'].browse(request.allowed_company_ids[0])
|
||||||
company = self.env.company
|
else:
|
||||||
|
company = self.env.company
|
||||||
# If we don't have any chart of account on this company, install this chart of account
|
# If we don't have any chart of account on this company, install this chart of account
|
||||||
if not company.chart_template_id and not self.existing_accounting(company):
|
if not company.chart_template_id and not self.existing_accounting(company):
|
||||||
for template in self:
|
for template in self:
|
||||||
template.load_for_current_company(15.0, 15.0)
|
template.with_context(default_company_id=company.id)._load(15.0, 15.0, company)
|
||||||
|
|
||||||
def load_for_current_company(self, sale_tax_rate, purchase_tax_rate):
|
try_loading_for_current_company = try_loading
|
||||||
|
|
||||||
|
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||||
""" Installs this chart of accounts on the current company, replacing
|
""" Installs this chart of accounts on the current company, replacing
|
||||||
the existing one if it had already one defined. If some accounting entries
|
the existing one if it had already one defined. If some accounting entries
|
||||||
had already been made, this function fails instead, triggering a UserError.
|
had already been made, this function fails instead, triggering a UserError.
|
||||||
@@ -188,12 +191,8 @@ class AccountChartTemplate(models.Model):
|
|||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
# do not use `request.env` here, it can cause deadlocks
|
# do not use `request.env` here, it can cause deadlocks
|
||||||
if request and hasattr(request, 'allowed_company_ids'):
|
|
||||||
company = self.env['res.company'].browse(request.allowed_company_ids[0])
|
|
||||||
else:
|
|
||||||
company = self.env.company
|
|
||||||
# Ensure everything is translated to the company's language, not the user's one.
|
# Ensure everything is translated to the company's language, not the user's one.
|
||||||
self = self.with_context(lang=company.partner_id.lang)
|
self = self.with_context(lang=company.partner_id.lang, company=company)
|
||||||
if not self.env.is_admin():
|
if not self.env.is_admin():
|
||||||
raise AccessError(_("Only administrators can load a charf of accounts"))
|
raise AccessError(_("Only administrators can load a charf of accounts"))
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
self.env.ref('base.group_user').write({'implied_ids': [(4, self.env.ref('product.group_sale_pricelist').id)]})
|
self.env.ref('base.group_user').write({'implied_ids': [(4, self.env.ref('product.group_sale_pricelist').id)]})
|
||||||
""" install a chart of accounts for the given company (if required) """
|
""" install a chart of accounts for the given company (if required) """
|
||||||
if self.chart_template_id and self.chart_template_id != self.company_id.chart_template_id:
|
if self.chart_template_id and self.chart_template_id != self.company_id.chart_template_id:
|
||||||
self.chart_template_id.load_for_current_company(15.0, 15.0)
|
self.chart_template_id._load(15.0, 15.0, self.env.company)
|
||||||
|
|
||||||
@api.depends('company_id')
|
@api.depends('company_id')
|
||||||
def _compute_has_chart_of_accounts(self):
|
def _compute_has_chart_of_accounts(self):
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class AccountingSavepointCase(SavepointCase):
|
|||||||
cls.env.user.company_id = company
|
cls.env.user.company_id = company
|
||||||
|
|
||||||
chart_template = cls.env['account.chart.template'].browse(chart_template.id)
|
chart_template = cls.env['account.chart.template'].browse(chart_template.id)
|
||||||
chart_template.load_for_current_company(15.0, 15.0)
|
chart_template.try_loading()
|
||||||
|
|
||||||
# The currency could be different after the installation of the chart template.
|
# The currency could be different after the installation of the chart template.
|
||||||
company.write({'currency_id': kwargs.get('currency_id', cls.env.user.company_id.currency_id.id)})
|
company.write({'currency_id': kwargs.get('currency_id', cls.env.user.company_id.currency_id.id)})
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ class TestAllL10n(SingleTransactionCase):
|
|||||||
_logger.info(msg)
|
_logger.info(msg)
|
||||||
with self.subTest(msg=msg):
|
with self.subTest(msg=msg):
|
||||||
with self.cr.savepoint():
|
with self.cr.savepoint():
|
||||||
coa.try_loading_for_current_company()
|
coa.try_loading()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ae.uae_chart_template_standard')]"/>
|
<value eval="[ref('l10n_ae.uae_chart_template_standard')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ar.ar_chart_template')]"/>
|
<value eval="[ref('l10n_ar.ar_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_at.austria_chart_template')]"/>
|
<value eval="[ref('l10n_at.austria_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_au.l10n_au_chart_template')]"/>
|
<value eval="[ref('l10n_au.l10n_au_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_be.l10nbe_chart_template')]"/>
|
<value eval="[ref('l10n_be.l10nbe_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class TestUBL(common.TransactionCase):
|
|||||||
# Force user Belgium country.
|
# Force user Belgium country.
|
||||||
self.env.user.company_id = self.env['res.company'].create({'name': 'MyCompany'})
|
self.env.user.company_id = self.env['res.company'].create({'name': 'MyCompany'})
|
||||||
self.env.user.company_id.country = self.env.ref('base.be')
|
self.env.user.company_id.country = self.env.ref('base.be')
|
||||||
self.env.ref('l10n_be.l10nbe_chart_template').load_for_current_company(False, False)
|
self.env.ref('l10n_be.l10nbe_chart_template').try_loading()
|
||||||
self.partner_id = self.env['res.partner'].create({'name': 'TestUser', 'vat': 'BE0123456789'})
|
self.partner_id = self.env['res.partner'].create({'name': 'TestUser', 'vat': 'BE0123456789'})
|
||||||
|
|
||||||
def test_ubl_invoice_import(self):
|
def test_ubl_invoice_import(self):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_bo.bo_chart_template')]"/>
|
<value eval="[ref('l10n_bo.bo_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -3182,7 +3182,7 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_br.l10n_br_account_chart_template')]"/>
|
<value eval="[ref('l10n_br.l10n_br_account_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ca.ca_en_chart_template_en')]"/>
|
<value eval="[ref('l10n_ca.ca_en_chart_template_en')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ch.l10nch_chart_template')]"/>
|
<value eval="[ref('l10n_ch.l10nch_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_cl.cl_chart_template')]"/>
|
<value eval="[ref('l10n_cl.cl_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_cn_small_business.l10n_chart_china_small_business')]"/>
|
<value eval="[ref('l10n_cn_small_business.l10n_chart_china_small_business')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<field name="default_pos_receivable_account_id" ref="account_1124" />
|
<field name="default_pos_receivable_account_id" ref="account_1124" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_cn_standard.l10n_chart_china_standard_business')]"/>
|
<value eval="[ref('l10n_cn_standard.l10n_chart_china_standard_business')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_co.l10n_co_chart_template_generic')]"/>
|
<value eval="[ref('l10n_co.l10n_co_chart_template_generic')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_cr.account_chart_template_0')]"/>
|
<value eval="[ref('l10n_cr.account_chart_template_0')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ class AccountChartTemplate(models.Model):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
# Write paperformat and report template used on company
|
# Write paperformat and report template used on company
|
||||||
def load_for_current_company(self, sale_tax_rate, purchase_tax_rate):
|
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||||
res = super(AccountChartTemplate, self).load_for_current_company(sale_tax_rate, purchase_tax_rate)
|
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||||
company = self.env.company
|
|
||||||
if company.country_id.code == 'DE':
|
if company.country_id.code == 'DE':
|
||||||
company.write({'external_report_layout_id': self.env.ref('l10n_de.external_layout_din5008').id,
|
company.write({'external_report_layout_id': self.env.ref('l10n_de.external_layout_din5008').id,
|
||||||
'paperformat_id': self.env.ref('l10n_de.paperformat_euro_din').id})
|
'paperformat_id': self.env.ref('l10n_de.paperformat_euro_din').id})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_de_skr03.l10n_de_chart_template')]"/>
|
<value eval="[ref('l10n_de_skr03.l10n_de_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_de_skr04.l10n_chart_de_skr04')]"/>
|
<value eval="[ref('l10n_de_skr04.l10n_chart_de_skr04')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_do.do_chart_template')]"/>
|
<value eval="[ref('l10n_do.do_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ec.ec_chart_template')]"/>
|
<value eval="[ref('l10n_ec.ec_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_es.account_chart_template_pymes')]"/>
|
<value eval="[ref('l10n_es.account_chart_template_pymes')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_et.l10n_et')]"/>
|
<value eval="[ref('l10n_et.l10n_et')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_fr.l10n_fr_pcg_chart_template')]"/>
|
<value eval="[ref('l10n_fr.l10n_fr_pcg_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_generic_coa.configurable_chart_template')]"/>
|
<value eval="[ref('l10n_generic_coa.configurable_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_gr.l10n_gr_chart_template')]"/>
|
<value eval="[ref('l10n_gr.l10n_gr_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
]"/>
|
]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_gt.cuentas_plantilla')]"/>
|
<value eval="[ref('l10n_gt.cuentas_plantilla')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo noupdate="1">
|
<odoo noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_hk.l10n_hk_chart_template')]"/>
|
<value eval="[ref('l10n_hk.l10n_hk_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
]"/>
|
]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_hn.cuentas_plantilla')]"/>
|
<value eval="[ref('l10n_hn.cuentas_plantilla')]"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_hr.l10n_hr_chart_template_rrif')]"/>
|
<value eval="[ref('l10n_hr.l10n_hr_chart_template_rrif')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_hu.hungarian_chart_template')]"/>
|
<value eval="[ref('l10n_hu.hungarian_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo noupdate="1">
|
<odoo noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ie.l10n_ie')]"/>
|
<value eval="[ref('l10n_ie.l10n_ie')]"/>
|
||||||
</function>
|
</function>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_in.indian_chart_template_standard')]"/>
|
<value eval="[ref('l10n_in.indian_chart_template_standard')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_it.l10n_it_chart_template_generic')]"/>
|
<value eval="[ref('l10n_it.l10n_it_chart_template_generic')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_jp.l10n_jp1')]"/>
|
<value eval="[ref('l10n_jp.l10n_jp1')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_lu.lu_2011_chart_1')]"/>
|
<value eval="[ref('l10n_lu.lu_2011_chart_1')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ma.l10n_kzc_temp_chart')]"/>
|
<value eval="[ref('l10n_ma.l10n_kzc_temp_chart')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo noupdate="1">
|
<odoo noupdate="1">
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_mn.mn_chart_1')]"/>
|
<value eval="[ref('l10n_mn.mn_chart_1')]"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_mx.mx_coa')]"/>
|
<value eval="[ref('l10n_mx.mx_coa')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_nl.l10nnl_chart_template')]"/>
|
<value eval="[ref('l10n_nl.l10nnl_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ from odoo import api, fields, models, _
|
|||||||
class AccountChartTemplate(models.Model):
|
class AccountChartTemplate(models.Model):
|
||||||
_inherit = 'account.chart.template'
|
_inherit = 'account.chart.template'
|
||||||
|
|
||||||
def load_for_current_company(self, sale_tax_rate, purchase_tax_rate):
|
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||||
# Add tag to 999999 account
|
# Add tag to 999999 account
|
||||||
res = super(AccountChartTemplate, self).load_for_current_company(sale_tax_rate, purchase_tax_rate)
|
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||||
if self.env.company.country_id.code == 'NL':
|
if company.country_id.code == 'NL':
|
||||||
account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.company.id)])
|
account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.company.id)])
|
||||||
if account:
|
if account:
|
||||||
account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)]
|
account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_no.no_chart_template')]"/>
|
<value eval="[ref('l10n_no.no_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_nz.l10n_nz_chart_template')]"/>
|
<value eval="[ref('l10n_nz.l10n_nz_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_pa.l10npa_chart_template')]"/>
|
<value eval="[ref('l10n_pa.l10npa_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_pe.pe_chart_template')]"/>
|
<value eval="[ref('l10n_pe.pe_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_pl.pl_chart_template')]"/>
|
<value eval="[ref('l10n_pl.pl_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_pt.pt_chart_template')]"/>
|
<value eval="[ref('l10n_pt.pt_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ro.ro_chart_template')]"/>
|
<value eval="[ref('l10n_ro.ro_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_sa.account_arabic_coa_general')]"/>
|
<value eval="[ref('l10n_sa.account_arabic_coa_general')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_sg.sg_chart_template')]"/>
|
<value eval="[ref('l10n_sg.sg_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_si.gd_chart')]"/>
|
<value eval="[ref('l10n_si.gd_chart')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_syscohada.syscohada_chart_template')]"/>
|
<value eval="[ref('l10n_syscohada.syscohada_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_th.chart')]"/>
|
<value eval="[ref('l10n_th.chart')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_tr.l10ntr_tek_duzen_hesap')]"/>
|
<value eval="[ref('l10n_tr.l10ntr_tek_duzen_hesap')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<field name="default_pos_receivable_account_id" ref="ua_ias_1122" />
|
<field name="default_pos_receivable_account_id" ref="ua_ias_1122" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ua.l10n_ua_psbo_chart_template')]"/>
|
<value eval="[ref('l10n_ua.l10n_ua_psbo_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_uk.l10n_uk')]"/>
|
<value eval="[ref('l10n_uk.l10n_uk')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_uy.uy_chart_template')]"/>
|
<value eval="[ref('l10n_uy.uy_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_ve.ve_chart_template_amd')]"/>
|
<value eval="[ref('l10n_ve.ve_chart_template_amd')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_vn.vn_template')]"/>
|
<value eval="[ref('l10n_vn.vn_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo noupdate="1">
|
<odoo noupdate="1">
|
||||||
|
|
||||||
<function model="account.chart.template" name="try_loading_for_current_company">
|
<function model="account.chart.template" name="try_loading">
|
||||||
<value eval="[ref('l10n_za.default_chart_template')]"/>
|
<value eval="[ref('l10n_za.default_chart_template')]"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class TestPurchaseOrderReport(common.TransactionCase):
|
|||||||
# Create a new company and set CoA
|
# Create a new company and set CoA
|
||||||
self.company_id = self.env['res.company'].create({'name': 'new_company'})
|
self.company_id = self.env['res.company'].create({'name': 'new_company'})
|
||||||
self.env.user.company_id = self.company_id
|
self.env.user.company_id = self.company_id
|
||||||
self.env.ref('l10n_generic_coa.configurable_chart_template').load_for_current_company(False, False)
|
self.env.ref('l10n_generic_coa.configurable_chart_template').try_loading()
|
||||||
|
|
||||||
def test_00_purchase_order_report(self):
|
def test_00_purchase_order_report(self):
|
||||||
uom_dozen = self.env.ref('uom.product_uom_dozen')
|
uom_dozen = self.env.ref('uom.product_uom_dozen')
|
||||||
|
|||||||
Reference in New Issue
Block a user