From 7fa60a573266b0be8f7e1b4186745ccf14b79bb6 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Fri, 19 Jun 2026 09:43:32 +0700 Subject: [PATCH] refactor: replace SQL constraints with models.Constraint in StockInventoryBackdateLine model --- models/stock_inventory_backdate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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',