from odoo import api, fields, modelsWhen the required field (analytic account) field filled out, it still raises the validation error. anyone know why? what are the alternatives?
from odoo.exceptions import ValidationError
class InvoiceInh(models.Model):
_inherit = 'account.move.line'
@api.constrains('analytic_account_id')
def check_account(self):
for line in self:
if not line.analytic_account_id:
raise ValidationError('Analytic Account field in the products tab is missing.'
' Please enter it to be able to continue.')
Note: does not give proper message if made from front end with required>1<
Regards,
Adel