While uploading CSV file into the Odoo getting this error:
"Unknown error during import: <class 'openerp.exceptions.ValidationError'>: ('ValidateError', u"Error while validating constraint\n\n'iprodstep.log' object has no attribute 'sales_record_number_id'") at row 2
Resolve other errors first"
Help me please, record "sales_record_number" needs to be checked.
If record number exist .... skip it.
Validation script:
@api.one
@api.constrains('sales_record_number')
def _check_sales_record_number(self):
search = self.search(sales_record_number)
#..... if there is "sales_record_number" in any of this states .... raise error.
# Or maybe someone will tell me how should look like a validation formula ? .....
# I'm a newbee so ...
sales_record_number = [sales_record_number.id for sales_record_number in search]
for order in self:
if order.sales_record_number in sales_record_number:
raise ValidationError(_('This order is already in Database'))
Guessing that there is an error in this code.
Any suggestion ?
Or just how to check if there is already "sales_record_number" in odoo.