summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-17 10:09:09 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-17 10:09:09 +0700
commitcd404ee8cf882967bd49232892c1dc41edc6f187 (patch)
treef3194f93fd21a06c407fbb3a19ce68cd6eafe622
parent5eee94e7c5fbf71143fd8bad78baae3853e71f2d (diff)
fix margin po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index d7d83af0..d2393f16 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -488,10 +488,10 @@ class PurchaseOrder(models.Model):
purchase_price_dict = {}
for lines in self.order_line:
- # product_id = lines.product_id.id
+ product_id = lines.product_id.id
- # if product_id not in purchase_price_dict:
- # purchase_price_dict[product_id] = lines.price_subtotal
+ if product_id not in purchase_price_dict:
+ purchase_price_dict[product_id] = lines.price_subtotal
sum_so_margin = sum_sales_price = sum_margin = 0
for line in self.order_sales_match_line:
@@ -505,8 +505,8 @@ class PurchaseOrder(models.Model):
sum_so_margin += sale_order_line.item_margin
- # sales_price = sale_order_line.price_reduce_taxexcl * sale_order_line.product_uom_qty
- sales_price = sale_order_line.price_reduce_taxexcl * lines.product_qty
+ sales_price = sale_order_line.price_reduce_taxexcl * sale_order_line.product_uom_qty
+ # sales_price = sale_order_line.price_reduce_taxexcl * lines.product_qty
if sale_order_line.order_id.shipping_cost_covered == 'indoteknik':
sales_price -= sale_order_line.delivery_amt_line
@@ -518,8 +518,8 @@ class PurchaseOrder(models.Model):
product_id = sale_order_line.product_id.id
- # purchase_price = purchase_price_dict.get(product_id, 0)
- purchase_price = lines.price_subtotal
+ purchase_price = purchase_price_dict.get(product_id, 0)
+ # purchase_price = lines.price_subtotal
if lines.order_id.delivery_amount > 0:
purchase_price += lines.delivery_amt_line