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.
The objects stock.picking.out (Delivery orders) and stock.picking.in (Incomings Shipments), inherits from stock.picking by prototype inheritance, So as to customize the stock.picking.out form view, I added a field on stock.picking, and made it visible juste for stock.picking.out, but now I want to add a sql_constraints unique, to that field, I wrote on stock.picking where the field is decalred :
_sql_constraints = [('bl_uniq','unique(num_bl)','Physical Delivery order number is unique !')].
But this sql constraint doesn't work, is it due to the prototype inheritance ? if yes what is the solution to overcome this issue ?
If unique constraint is to be applied to a table with data, you need to ensure that the table indeed have that column unique (NULL values are not considered). Try to check the following SQL: SELECT num_bl, COUNT(*) FROM stock.picking HAVING COUNT(*) > 1 and see if there are records aside from NULL value.
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: 12/1/14, 11:42 AM|
|Seen: 3054 times|
|Last updated: 3/16/15, 8:10 AM|