diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-11 09:39:33 +0000 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-11 09:39:33 +0000 |
| commit | 51354fadb0a1bf5fa797c2539e703cf97d768691 (patch) | |
| tree | 223535044b0df6473cd343079167c53c0f3673d0 /addons/account_tax_python | |
| parent | da6f24bb4cea8b14eacc3040a06c5e451511240f (diff) | |
| parent | 50e571acf7c9696954d604de9b4501716fa26646 (diff) | |
[MERGE] forward port branch saas-12.3 up to 50e571acf7c
closes odoo/odoo#36491
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/account_tax_python')
| -rw-r--r-- | addons/account_tax_python/models/account_tax.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/account_tax_python/models/account_tax.py b/addons/account_tax_python/models/account_tax.py index 0b559fb8360..1a57f797973 100644 --- a/addons/account_tax_python/models/account_tax.py +++ b/addons/account_tax_python/models/account_tax.py @@ -28,6 +28,8 @@ class AccountTaxPython(models.Model): def _compute_amount(self, base_amount, price_unit, quantity=1.0, product=None, partner=None): self.ensure_one() + if product and product._name == 'product.template': + product = product.product_variant_id if self.amount_type == 'code': company = self.env.company localdict = {'base_amount': base_amount, 'price_unit':price_unit, 'quantity': quantity, 'product':product, 'partner':partner, 'company': company} @@ -39,6 +41,8 @@ class AccountTaxPython(models.Model): def compute_all(self, price_unit, currency=None, quantity=1.0, product=None, partner=None, is_refund=False, handle_price_include=True): taxes = self.filtered(lambda r: r.amount_type != 'code') company = self.env.company + if product and product._name == 'product.template': + product = product.product_variant_id for tax in self.filtered(lambda r: r.amount_type == 'code'): localdict = self._context.get('tax_computation_context', {}) localdict.update({'price_unit': price_unit, 'quantity': quantity, 'product': product, 'partner': partner, 'company': company}) |
