summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-12 10:53:04 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-12 10:53:04 +0700
commit45811de91c682cea9ade1e975f241a651c68b1df (patch)
tree00ca1e54229399278091c03ef53f6351e7efc947
parent8d087106a29341d7ffe8725fff92c43dd3a2dbf2 (diff)
after UAT plafon
-rwxr-xr-xindoteknik_custom/models/purchase_order.py10
-rw-r--r--indoteknik_custom/models/requisition.py5
2 files changed, 9 insertions, 6 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index a8fd68e9..9faa6464 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -589,7 +589,7 @@ class PurchaseOrder(models.Model):
for line in self.order_line:
if not line.product_id:
continue
- if line.product_uom_qty > line.product_id.plafon_qty:
+ if line.product_uom_qty > line.product_id.plafon_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'):
raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD')
def button_confirm(self):
@@ -733,8 +733,8 @@ class PurchaseOrder(models.Model):
template.send_mail(self.id, force_send=True)
def po_approve(self):
- if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'):
- raise UserError("Hanya Merchandiser yang bisa approve")
+ # if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'):
+ # raise UserError("Hanya Merchandiser yang bisa approve")
if self.env.user.is_leader or self.env.user.has_group('indoteknik_custom.group_role_merchandiser'):
raise UserError("Bisa langsung Confirm")
elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so:
@@ -768,8 +768,8 @@ class PurchaseOrder(models.Model):
if not line.product_id:
continue
if line.product_uom_qty > line.product_id.plafon_qty:
- message = (message + line.product_id.default_code + 'melebihi plafon '
- + str(line.product_uom_qty) + ' vs ' + str(line.product_id.plafon_qty)
+ message = (message + '\n'+line.product_id.default_code + ' melebihi plafon ('
+ + str(line.product_id.plafon_qty) + ') vs Qty PO ('+str(line.product_uom_qty)+')'
+ ', ')
greater_than_plafon = True
print(1)
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py
index fcc111d5..dbf236e2 100644
--- a/indoteknik_custom/models/requisition.py
+++ b/indoteknik_custom/models/requisition.py
@@ -58,6 +58,9 @@ class Requisition(models.Model):
return result
def button_approve(self):
+ state = ['done', 'sale']
+ if self.sale_order_id.state in state:
+ raise UserError('SO sudah Confirm, akan berakibat double Purchase melalui PJ')
if self.env.user.id not in [377, 19]:
raise UserError('Hanya Vita dan Darren Yang Bisa Approve')
if self.env.user.id == 377:
@@ -76,7 +79,7 @@ class Requisition(models.Model):
raise UserError('Tidak ada Lines, belum bisa create PO')
if self.is_po:
raise UserError('Sudah pernah di create PO')
- if self.sale_order_id:
+ if not self.sale_order_id:
raise UserError('Tidak ada link dengan Sales Order, tidak bisa dihitung sebagai Plafon Qty di PO')
vendor_ids = self.env['requisition.line'].read_group([