summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-02-25 10:47:35 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-02-25 10:47:35 +0700
commit6352ba63a39293b3e260bd7bd933c9de2c023172 (patch)
treef94d502a6684a4a35c0276e8b66138d772af73ce /indoteknik_custom/models
parenta5ab398f902915ea44394b4b8fd6a8bb14ccbb89 (diff)
add purchase price po and so on po sales matches
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/purchase_order_sales_match.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py
index d1d929d3..d6c2a631 100644
--- a/indoteknik_custom/models/purchase_order_sales_match.py
+++ b/indoteknik_custom/models/purchase_order_sales_match.py
@@ -24,6 +24,13 @@ class PurchaseOrderSalesMatch(models.Model):
margin_item = fields.Float(string='Margin')
delivery_amt = fields.Float(string='Delivery Amount', compute='_compute_delivery_amt')
margin_deduct = fields.Float(string='After Deduct', compute='_compute_delivery_amt')
+ purchase_price_so = fields.Float(string='Purchase Price Sale Order', related='sale_line_id.purchase_price')
+ purchase_price_po = fields.Float('Purchase Price PO', compute='_compute_purchase_price_po')
+
+ def _compute_purchase_price_po(self):
+ for line in self:
+ purchase_price = self.env['purchase.order.line'].search([('order_id', '=', line.purchase_order_id.id), ('product_id', '=', line.product_id.id)])
+ line.purchase_price_po = purchase_price.purchase_price
def _compute_delivery_amt(self):
for line in self: