[REF] - Use method _get_quantity_to_invoice.

This commit is contained in:
sbejaoui
2019-03-11 23:39:40 +01:00
parent bd49940c68
commit c4a76debe3
5 changed files with 90 additions and 66 deletions

View File

@@ -23,12 +23,18 @@ class ContractLineFormula(models.Model):
'line': self.env['account.analytic.invoice.line'],
'contract': self.env['account.analytic.account'],
'invoice': self.env['account.invoice'],
'quantity': 0,
'period_first_date': False,
'period_last_date': False,
'invoice_date': False,
}
try:
safe_eval(
self.code.strip(), eval_context, mode="exec", nocopy=True)
self.code.strip(), eval_context, mode="exec", nocopy=True
)
except Exception as e:
raise exceptions.ValidationError(
_('Error evaluating code.\nDetails: %s') % e)
_('Error evaluating code.\nDetails: %s') % e
)
if 'result' not in eval_context:
raise exceptions.ValidationError(_('No valid result returned.'))