Skip to content
Snippets Groups Projects
Commit 7eb7e9fd authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] account_tax_python: empty code

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

opw-769267
parent 46e3e739
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment