diff --git a/models/stock_inventory_backdate.py b/models/stock_inventory_backdate.py index b220277..2dabf76 100644 --- a/models/stock_inventory_backdate.py +++ b/models/stock_inventory_backdate.py @@ -293,10 +293,10 @@ class StockInventoryBackdate(models.Model): class StockInventoryBackdateLine(models.Model): _name = 'stock.inventory.backdate.line' _description = 'Backdated Inventory Adjustment Line' - _sql_constraints = [ - ('unique_product_per_inventory', 'unique(inventory_id, product_id, lot_id, package_id, owner_id)', - 'You cannot have duplicate products with the same lot/package/owner in the same adjustment!') - ] + _unique_product_per_inventory = models.Constraint( + 'unique(inventory_id, product_id, lot_id, package_id, owner_id)', + 'You cannot have duplicate products with the same lot/package/owner in the same adjustment!', + ) inventory_id = fields.Many2one( 'stock.inventory.backdate',