summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-01-16 10:36:23 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-01-16 10:36:23 +0700
commitdc573e5c5f3922f0d0d031d616b779fa157fd679 (patch)
tree5e6f9a551dacb73bbd54b0499fbcdec24929d17f
parent27f333cc14b8673b3c46e1969736d2fb60d9924f (diff)
cr margin po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 777e8ed2..d487ada3 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -965,7 +965,14 @@ class PurchaseOrder(models.Model):
sales_price -= (sale_order_line.fee_third_party_line / sale_order_line.product_uom_qty) * line.qty_po
sum_sales_price += sales_price
- purchase_price = po_line.price_subtotal / po_line.product_qty * line.qty_po
+
+ purchase_price = po_line.price_subtotal
+ if po_line.ending_price > 0:
+ if po_line.taxes_id.id == 22:
+ ending_price = po_line.ending_price / 1.11
+ purchase_price = ending_price
+ else:
+ purchase_price = po_line.ending_price
if line.purchase_order_id.delivery_amount > 0:
purchase_price += (po_line.delivery_amt_line / po_line.product_qty) * line.qty_po
if line.purchase_order_id.delivery_amt > 0: