From ad1f21b27dff6eca4eb90d2a4496cd9ff80701c4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Sat, 12 Jul 2025 10:40:06 +0700 Subject: purchasing job, requisition, reordering v2 --- fixco_custom/models/purchase_pricelist.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fixco_custom/models/purchase_pricelist.py') diff --git a/fixco_custom/models/purchase_pricelist.py b/fixco_custom/models/purchase_pricelist.py index 2d0a77c..6f5bd21 100644 --- a/fixco_custom/models/purchase_pricelist.py +++ b/fixco_custom/models/purchase_pricelist.py @@ -13,6 +13,10 @@ class PurchasePricelist(models.Model): vendor_id = fields.Many2one('res.partner', string="Vendor", required=True) price = fields.Float(string='Price', required=True) + _sql_constraints = [ + ('product_unique', 'unique (product_id)', 'This product already has a purchase pricelist!'), + ] + @api.depends('product_id', 'vendor_id') def _compute_name(self): self.name = self.vendor_id.name + ', ' + self.product_id.name \ No newline at end of file -- cgit v1.2.3