summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-11 14:11:42 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-11 14:11:42 +0700
commitfd6b9b5395b04135d9f0afdc0859fb4f07d280b4 (patch)
treebe6e7a4f201b949a3b06e0c020c668ba2b0730fa /indoteknik_custom/models/purchase_order.py
parentf787f06a341f1775151d98be4490fe6126c511cd (diff)
parent9a0fd25e54491bd14a5b29b62b31a440dfa1bebc (diff)
Merge branch 'production' into feature/max_plafon_order_qty
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 231acb4c..f5b5979b 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -605,7 +605,7 @@ class PurchaseOrder(models.Model):
if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader:
raise UserError("Beda Margin dengan Sales, harus approval Merchandise")
if not self.from_apo:
- if not self.sale_order_id and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader:
+ if not self.matches_so and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader:
raise UserError("Tidak ada link dengan SO, harus approval Merchandise")
send_email = False
@@ -738,7 +738,7 @@ class PurchaseOrder(models.Model):
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.sale_order_id:
+ elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so:
raise UserError("Bisa langsung Confirm")
else:
reason = ''
@@ -747,12 +747,14 @@ class PurchaseOrder(models.Model):
reason = 'above 50jt, '
if self.total_percent_margin < self.total_so_percent_margin:
reason += 'diff margin, '
- if not self.from_apo and not self.sale_order_id:
- reason += 'not link with sales, '
+ if not self.from_apo and not self.matches_so:
+ reason += 'not link with pj and reorder, '
+ if not self.matches_so:
+ reason += 'not link with so, '
# Post a highlighted message to lognote
self.message_post(
body=f"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>"
- f"<b>Note Return (Pinned):</b><br>{reason}</div>",
+ f"<b>Note (Pinned):</b><br>{reason}</div>",
subtype_id=self.env.ref("mail.mt_note").id
)