summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-06 17:00:48 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-06 17:00:48 +0700
commit8b54606ef925ff2e6feb2794aabaafa4864e6961 (patch)
tree9515824181438653d34d9fc346d060f5c3d6beb0 /indoteknik_custom/models/purchase_order.py
parent295088070b43c409c2114a0a98d898ff3ff4ae7b (diff)
initial commit max plafon qty order
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 6fc0c497..510695a6 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -583,6 +583,14 @@ class PurchaseOrder(models.Model):
picking.scheduled_date = self.date_planned
picking.date_deadline = self.date_planned
+ def _check_qty_plafon_product(self):
+ for line in self.order_line:
+ if not line.product_id:
+ continue
+ test = line.product_id.plafon_qty
+ if line.product_uom_qty > line.product_id.plafon_qty:
+ raise UserError('Product '+line.product_id.name+' melebihi plafon')
+
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
current_time = datetime.now()
@@ -635,7 +643,8 @@ class PurchaseOrder(models.Model):
self.date_planned = delta_time
self.date_deadline_ref_date_planned()
self.unlink_purchasing_job_state()
-
+
+ self._check_qty_plafon_product()
return res