summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-07-10 14:51:39 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-07-10 14:51:39 +0700
commitf60d2e5a3011a06d5b72c4aac80e11da642368e2 (patch)
tree6176074c324d87448fcf1d26af1933595307cdfc /indoteknik_custom/models
parent2c0bb838b406503aa6a10cc0c21d474429246e18 (diff)
Re-Calculate SO di PO
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 1eb76370..efc98e2f 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -215,6 +215,18 @@ class PurchaseOrder(models.Model):
else:
self.approval_status = 'pengajuan1'
+ def re_calculate(self):
+ for line in self.order_line:
+ sale_order_line = self.env['sale.order.line'].search(
+ [('product_id', '=', line.product_id.id),
+ ('order_id', '=', line.order_id.sale_order_id.id)], limit=1, order='price_reduce_taxexcl')
+
+ unit_price = line.price_unit
+ sale_order_line.purchase_price = unit_price
+
+ total_percent_margin = self.total_percent_margin
+ self.sale_order_id.total_percent_margin = total_percent_margin
+
def button_cancel(self):
res = super(PurchaseOrder, self).button_cancel()
self.approval_status = False