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
Odoo Training Center
|Asked: 12/1/14, 11:42 AM|
|Seen: 2930 times|
|Last updated: 3/16/15, 8:10 AM|