[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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user