summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-05 11:09:46 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-05 11:09:46 +0700
commit7afd1ef51e18f9dcb1c0e71ea1e512b52284d3d1 (patch)
tree67fc2a2cf472a1c43a3ed4fab9d75f242983546e
parent100fa7ec1d9ccfc02712096dceca3decc2311abb (diff)
add sticky note while ask approval
-rwxr-xr-xindoteknik_custom/models/purchase_order.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 393fc562..6fc0c497 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -730,7 +730,20 @@ class PurchaseOrder(models.Model):
elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id:
raise UserError("Bisa langsung Confirm")
else:
+ reason = ''
self.approval_status = 'pengajuan1'
+ if self.amount_untaxed >= 50000000:
+ 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, '
+ # 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>",
+ subtype_id=self.env.ref("mail.mt_note").id
+ )
def re_calculate(self):
if self.from_apo: