From 45d338afe9c0f33e35d518fd20404375dabfc910 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 15 Feb 2017 17:14:41 +0100 Subject: [PATCH] [FIX] l10n_jp: fix installation crash (at the second install) * The module was not loading the fiscal position templates before executing the template generation. * Also, as reported in #15384, at the second installation it was crashing because of a missing xml id (which is not supported currently). This last bug was fixed by giving specific xml_ids instead of skipping the data. This reverts commit 929d98357562a5262395804d219ca616496d5a2d. --- addons/account/models/chart_template.py | 5 ++--- addons/l10n_jp/__manifest__.py | 2 +- addons/l10n_jp/data/account.fiscal.position.template.csv | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 1f4c64ca20e..1b566d319cb 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -347,9 +347,8 @@ class AccountChartTemplate(models.Model): # xmlid is the concatenation of company_id and template_xml_id ir_model_data = self.env['ir.model.data'] template_xmlid = ir_model_data.search([('model', '=', template._name), ('res_id', '=', template.id)]) - if template_xmlid: - new_xml_id = str(company.id)+'_'+template_xmlid.name - return ir_model_data._update(model, template_xmlid.module, vals, xml_id=new_xml_id, store=True, noupdate=True, mode='init', res_id=False) + new_xml_id = str(company.id)+'_'+template_xmlid.name + return ir_model_data._update(model, template_xmlid.module, vals, xml_id=new_xml_id, store=True, noupdate=True, mode='init', res_id=False) def _get_account_vals(self, company, account_template, code_acc, tax_template_ref): """ This method generates a dictionnary of all the values for the account that will be created. diff --git a/addons/l10n_jp/__manifest__.py b/addons/l10n_jp/__manifest__.py index b380a97435f..384ad0e79dd 100644 --- a/addons/l10n_jp/__manifest__.py +++ b/addons/l10n_jp/__manifest__.py @@ -34,7 +34,7 @@ need to use these at all under normal circumstances. 'data/account.account.template.csv', 'data/account.tax.template.csv', 'data/account_chart_template_data.xml', - 'data/account_chart_template_data.yml', 'data/account.fiscal.position.template.csv', + 'data/account_chart_template_data.yml', ], } diff --git a/addons/l10n_jp/data/account.fiscal.position.template.csv b/addons/l10n_jp/data/account.fiscal.position.template.csv index 07e7b11531d..c3cf80b4274 100644 --- a/addons/l10n_jp/data/account.fiscal.position.template.csv +++ b/addons/l10n_jp/data/account.fiscal.position.template.csv @@ -1,7 +1,7 @@ id,chart_template_id/id,name,note,tax_ids/tax_src_id/id,tax_ids/tax_dest_id/id fiscal_position_tax_inclusive_template,l10n_jp1,内税,,tax_in_e,tax_in_i -,,,,tax_out_e,tax_out_i +fiscal_position_tax_inclusive_template_out,l10n_jp1,内税,,tax_out_e,tax_out_i fiscal_position_tax_exclusive_template,l10n_jp1,外税,,tax_in_i,tax_in_e -,,,,tax_out_i,tax_out_e +fiscal_position_tax_exclusive_template_out,l10n_jp1,内税,,tax_out_i,tax_out_e fiscal_position_tax_exempt_template,l10n_jp1,海外取引先,,tax_in_e,tax_in_x -,,,,tax_out_e,tax_out_im +fiscal_position_tax_exepmt_template_out,l10n_jp1,内税,,tax_out_e,tax_out_im