[FIX] account_tax_python: empty code

If the user somewhat removes the 'Applicable Code' text, the call to
`safe_eval` will crash.

opw-769267
This commit is contained in:
Nicolas Martinelli
2017-09-12 12:01:57 +02:00
parent 46e3e739c5
commit 7eb7e9fd6e
@@ -36,9 +36,9 @@ class AccountTaxPython(models.Model):
@api.v8
def compute_all(self, price_unit, currency=None, quantity=1.0, product=None, partner=None):
taxes = self.env['account.tax']
taxes = self.filtered(lambda r: r.amount_type != 'code')
company = self.env.user.company_id
for tax in self:
for tax in self.filtered(lambda r: r.amount_type == 'code'):
localdict = {'price_unit':price_unit, 'quantity': quantity, 'product':product, 'partner':partner, 'company': company}
safe_eval(tax.python_applicable, localdict, mode="exec", nocopy=True)
if localdict.get('result', False):