summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-17 11:13:24 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-17 11:13:24 +0700
commit5c69c098c0922c3a35203b826b4498fb19e96084 (patch)
treef3194f93fd21a06c407fbb3a19ce68cd6eafe622
parentfa17e8f10b4a96a07ddebe0931ef7a88eeafc723 (diff)
margin po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 750ed678..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
@@ -516,10 +516,10 @@ class PurchaseOrder(models.Model):
sum_sales_price += sales_price
- # product_id = sale_order_line.product_id.id
+ 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