summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-09-05 15:05:06 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-09-05 15:05:06 +0700
commitc4bf293cd29fab412d38e7590acdc99f2456c0d8 (patch)
tree0cbb2581f671d643dddd1dc7ca9d1e76df1b08e0
parent513bce9e13dee0453ce24b41a54d3b408e58c7f0 (diff)
fix purchase pricelist
-rwxr-xr-xindoteknik_custom/models/purchase_pricelist.py25
-rwxr-xr-xindoteknik_custom/views/purchase_pricelist.xml2
2 files changed, 12 insertions, 15 deletions
diff --git a/indoteknik_custom/models/purchase_pricelist.py b/indoteknik_custom/models/purchase_pricelist.py
index 86a5544d..6a8a4650 100755
--- a/indoteknik_custom/models/purchase_pricelist.py
+++ b/indoteknik_custom/models/purchase_pricelist.py
@@ -31,17 +31,14 @@ class PurchasePricelist(models.Model):
@api.constrains('vendor_id', 'product_id','human_last_update','write_date')
def _check_duplicate_purchase_pricelist(self):
for price in self:
- if price.write_date == price.create_date:
- domain = [
- ('product_id', '=', price.product_id.id),
- ('vendor_id', '=', price.vendor_id.id)
- ]
-
- domain.append(('id', '!=', price.id))
- massage="Product dan vendor yang anda gunakan sudah ada di purchase pricelist"
- existing_purchase = self.search(domain, limit=1)
- if existing_purchase:
- raise UserError(massage)
- existing_purchase = self.search(domain, limit=1)
- if existing_purchase:
- raise UserError(massage) \ No newline at end of file
+ domain = [
+ ('product_id', '=', price.product_id.id),
+ ('vendor_id', '=', price.vendor_id.id)
+ ]
+
+ domain.append(('id', '!=', price.id))
+ massage="Product dan vendor yang anda gunakan sudah ada di purchase pricelist"
+ existing_purchase = self.search(domain, limit=1)
+ if existing_purchase:
+ raise UserError(massage)
+ \ No newline at end of file
diff --git a/indoteknik_custom/views/purchase_pricelist.xml b/indoteknik_custom/views/purchase_pricelist.xml
index 5c63676d..f9fd52ba 100755
--- a/indoteknik_custom/views/purchase_pricelist.xml
+++ b/indoteknik_custom/views/purchase_pricelist.xml
@@ -19,7 +19,7 @@
<field name="name">purchase.pricelist.form</field>
<field name="model">purchase.pricelist</field>
<field name="arch" type="xml">
- <form edit="0">
+ <form>
<sheet>
<group>
<group>