summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-18 11:36:39 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-18 11:36:39 +0700
commit71a3d1e9c253c995a6f7cca564fd171254e9a0e6 (patch)
treec4093a52ea79541ab368c4837e9d6cad60cc2cb8 /indoteknik_custom/models/purchase_order.py
parentfa1f56ebf9a00221477ec782e68db5009ba60f82 (diff)
margin po
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index a1c9f134..caad90d3 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -498,7 +498,7 @@ class PurchaseOrder(models.Model):
('order_id', '=', line.sale_id.id)
], limit=1, order='price_reduce_taxexcl')
- sum_so_margin += sale_order_line.item_margin
+ sum_so_margin += line.qty_po / line.qty_so * 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 * po_line.product_qty
if sale_order_line.order_id.shipping_cost_covered == 'indoteknik':
@@ -508,7 +508,7 @@ class PurchaseOrder(models.Model):
sum_sales_price += sales_price
purchase_price = po_line.price_subtotal
if line.purchase_order_id.delivery_amount > 0:
- purchase_price += line.delivery_amt_line
+ purchase_price += po_line.delivery_amt_line
real_item_margin = sales_price - purchase_price
sum_margin += real_item_margin