refactor: replace SQL constraints with models.Constraint in StockInventoryBackdateLine model

This commit is contained in:
Suherdy Yacob 2026-06-19 09:43:32 +07:00
parent 92ac84d542
commit 7fa60a5732

View File

@ -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',