Skip to content

Commit

Permalink
[FIX] account: show default taxes in settings
Browse files Browse the repository at this point in the history
Upon generation of a CoA from templates, taxes are created by default (lowest sequence) but that wasn't reflected in the settings. Was PR#19802
  • Loading branch information
pro-odoo authored and qdp-odoo committed Sep 29, 2017
1 parent a16c442 commit 87560ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/account/models/chart_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,15 @@ def execute(self):
# Install all the templates objects and generate the real objects
acc_template_ref, taxes_ref = self.chart_template_id._install_template(company, code_digits=self.code_digits, transfer_account_id=self.transfer_account_id)

# write values of default taxes for product as super user
# write values of default taxes for product as super user and write in the config
IrDefault = self.env['ir.default']
IrConfig = self.env['ir.config_parameter']
if self.sale_tax_id and taxes_ref:
IrDefault.sudo().set('product.template', "taxes_id", [taxes_ref[self.sale_tax_id.id]], company_id=company.id)
IrConfig.sudo().set_param("account.default_sale_tax_id", taxes_ref[self.sale_tax_id.id])
if self.purchase_tax_id and taxes_ref:
IrDefault.sudo().set('product.template', "supplier_taxes_id", [taxes_ref[self.purchase_tax_id.id]], company_id=company.id)
IrConfig.sudo().set_param("account.default_purchase_tax_id", taxes_ref[self.purchase_tax_id.id])

# Create Bank journals
self._create_bank_journals_from_o2m(company, acc_template_ref)
Expand Down

0 comments on commit 87560ec

Please sign in to comment.