Odoo 11 how to remove _sql_constraint in stock.production.lot
We are using lots to track our products. After purchasing a product we receive it and put the lot number that the vendor stated into the lot number field that has to be filled in when validating the receipt. As an example we have product xy with lot number 1234 on stock. If we have another delivery of that product with an identical lot number Odoo refuses to validate the receipt. Error: 'The combination of serial number and product must be
This seems to be done via a sql_constraint in stock_production_lot.py in the modul "stock" class Class ProductionLot :
_sql_constraints = [('name_ref_inique', 'unique(name, product_id)', 'The combination of serial number and product must be unique!'),]
I tried to comment the lines out but this does not help. There is another error
IntegrityError : dublicate key value violates unique constraint "stock_production_lot_name_ref_uniq"
DETAIL: Key(name, product_id)=(1234, 18) already exist.
Is there a way to remove that constraint and keep the rest of the functionality? We do not want to disable lots and serial number tracking.
Background: In our business it is quite normal that a vendor sells parts with a certain lot not only in one delivery but in several after another. The lot is often stamped into the part and changing the lot number in Odoo (adding another identification number like the receipt number) would confuse our processes.