vusca los impuestos en las cats padre si la opción general está habilitada

This commit is contained in:
santiky 2021-08-12 16:39:19 +02:00
parent ac6cb6ab95
commit 932fe0fd45
Signed by: snt
GPG key ID: A9FD34930EADBE71

View file

@ -22,8 +22,14 @@ class ProductProduct(models.Model):
vals['supplier_taxes_id'] = category.buy_tax_id
elif template_id:
template = self.env["product.template"].browse(template_id)
category = template.categ_id
template.taxes_id = category.sell_tax_id
template.supplier_taxes_id = category.buy_tax_id
cat = template.categ_id
if not cat and self.env.user.company_id.use_parent_categories_to_determine_taxes:
while not cat.pos_categ_id and cat.parent_id:
cat = cat.parent_id
if cat:
template.taxes_id = cat.sell_tax_id
template.supplier_taxes_id = cat.buy_tax_id
return super(ProductProduct, self).create(vals)