diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-09-11 15:56:54 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-09-12 12:01:57 +0200 |
| commit | 7eb7e9fd6e72764f28df19ab8803e1cceff38b4d (patch) | |
| tree | 11f7c31d73cb70a7e8a902d71de6098acc35e3bf /addons/account_tax_python | |
| parent | 46e3e739c529df826bd8855faeaaa6d7e4bf276a (diff) | |
[FIX] account_tax_python: empty code
If the user somewhat removes the 'Applicable Code' text, the call to
`safe_eval` will crash.
opw-769267
Diffstat (limited to 'addons/account_tax_python')
| -rw-r--r-- | addons/account_tax_python/account_tax_python.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/account_tax_python/account_tax_python.py b/addons/account_tax_python/account_tax_python.py index 57527de81f8..e670ce88c0e 100644 --- a/addons/account_tax_python/account_tax_python.py +++ b/addons/account_tax_python/account_tax_python.py @@ -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): |
