Skip to content

Commit

Permalink
[FIX] accessing self.record fails with multiple records
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulb committed Jul 27, 2018
1 parent c8728ce commit 2d9703a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions account_product_fiscal_classification/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ def write_taxes_setting(self, vals):
"""If Fiscal Classification is defined, set the according taxes
to the product(s); Otherwise, find the correct Fiscal classification,
depending of the taxes, or create a new one, if no one are found."""
if vals.get('fiscal_classification_id', False):
fc_id = vals.get('fiscal_classification_id', False)
if fc_id:
# update or replace 'taxes_id' and 'supplier_taxes_id'
classification = self.fiscal_classification_id
fc_obj = self.env['account.product.fiscal.classification']
fc = fc_obj.browse(classification_id)
tax_vals = {
'supplier_taxes_id': [[6, 0, [
x.id for x in classification.purchase_tax_ids]]],
x.id for x in fc.purchase_tax_ids]]],
'taxes_id': [[6, 0, [
x.id for x in classification.sale_tax_ids]]],
x.id for x in fc.sale_tax_ids]]],
}
super(ProductTemplate, self.sudo()).write(tax_vals)
elif 'supplier_taxes_id' in vals.keys() or 'taxes_id' in vals.keys():
Expand Down

0 comments on commit 2d9703a

Please sign in to comment.