Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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.
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.
You can not simply check sales_record_number value using constraint, because while creating a every new record, this constraint will run.
So, if, while importing data from file(csv), it gets voilated, then an exception will be thrown at the very first voilation only and as a result of which your import will get stopped.
Thats why inspite of using constraint, you can create your own new object and create a new functionality in that for importing the files using your required validation.
Hope it seems valid for you ..
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/28/15, 10:19 AM|
|Seen: 1533 times|
|Last updated: 8/31/15, 1:25 AM|