diff options
| author | Josse Colpaert <jco@odoo.com> | 2019-08-13 19:13:11 +0000 |
|---|---|---|
| committer | Josse Colpaert <jco@odoo.com> | 2019-08-14 08:42:27 +0000 |
| commit | f8d4bf4499e1e21cbce853c3a5f78fe5574abe6c (patch) | |
| tree | bf129e1c6dbaf965aeedd3409b702903c1db4a5c /addons/l10n_nl | |
| parent | 275dcfa41285e03b8ce6611277867101bebc6af3 (diff) | |
[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>
Diffstat (limited to 'addons/l10n_nl')
| -rw-r--r-- | addons/l10n_nl/data/account_chart_template_data.xml | 2 | ||||
| -rw-r--r-- | addons/l10n_nl/models/account_chart_template.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/l10n_nl/data/account_chart_template_data.xml b/addons/l10n_nl/data/account_chart_template_data.xml index 4b6e5e54d1c..2c70d1f26df 100644 --- a/addons/l10n_nl/data/account_chart_template_data.xml +++ b/addons/l10n_nl/data/account_chart_template_data.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> <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')]"/> </function> </data> diff --git a/addons/l10n_nl/models/account_chart_template.py b/addons/l10n_nl/models/account_chart_template.py index 17c494c0481..bd196fdbc0d 100644 --- a/addons/l10n_nl/models/account_chart_template.py +++ b/addons/l10n_nl/models/account_chart_template.py @@ -6,10 +6,10 @@ from odoo import api, fields, models, _ class AccountChartTemplate(models.Model): _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 - res = super(AccountChartTemplate, self).load_for_current_company(sale_tax_rate, purchase_tax_rate) - if self.env.company.country_id.code == 'NL': + res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company) + if company.country_id.code == 'NL': account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.company.id)]) if account: account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)] |
