Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] accessing self.record fails with multiple records #77

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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(fc_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