[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 929d983575.
This commit is contained in:
qdp-odoo
2017-02-15 17:20:56 +01:00
parent 65f986c018
commit 45d338afe9
3 changed files with 6 additions and 7 deletions
+2 -3
View File
@@ -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.
+1 -1
View File
@@ -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',
],
}
@@ -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
1 id chart_template_id/id name note tax_ids/tax_src_id/id tax_ids/tax_dest_id/id
2 fiscal_position_tax_inclusive_template l10n_jp1 内税 tax_in_e tax_in_i
3 fiscal_position_tax_inclusive_template_out l10n_jp1 内税 tax_out_e tax_out_i
4 fiscal_position_tax_exclusive_template l10n_jp1 外税 tax_in_i tax_in_e
5 fiscal_position_tax_exclusive_template_out l10n_jp1 内税 tax_out_i tax_out_e
6 fiscal_position_tax_exempt_template l10n_jp1 海外取引先 tax_in_e tax_in_x
7 fiscal_position_tax_exepmt_template_out l10n_jp1 内税 tax_out_e tax_out_im