summaryrefslogtreecommitdiff
path: root/fixco_custom/models/purchase_pricelist.py
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_custom/models/purchase_pricelist.py')
-rw-r--r--fixco_custom/models/purchase_pricelist.py4
1 files changed, 4 insertions, 0 deletions
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