summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-08-08 15:29:29 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-08-08 15:29:29 +0700
commit30eb623bace6b5ba9a1e275c7bdf70fc5920a583 (patch)
tree658f4f69814ee716f77b9ead739664c2b14c36b6 /indoteknik_custom/models/purchase_order.py
parenta39466421a31d2ffd5f2252bf7aac903c4785d83 (diff)
sync price unit po & price purchase pricelist
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 7091bb72..38e617e7 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -206,8 +206,17 @@ class PurchaseOrder(models.Model):
self.date_planned = delta_time
return res
+
+ def _send_mail(self):
+ template_id = self.env.ref('indoteknik_custom.mail_template_po_sync_price').id
+ template = self.env['mail.template'].browse(template_id)
+ template.send_mail(self.id, force_send=True)
def po_approve(self):
+ for line in self.order_line:
+ if line.price_unit != line.price_vendor:
+ self._send_mail()
+
if self.env.user.is_leader or self.env.user.is_purchasing_manager:
raise UserError("Bisa langsung Confirm")
elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id: