summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order_sales_match.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-02-25 14:01:15 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-02-25 14:01:15 +0700
commit6a5a2a2666c33ffafd610df882491d86918468bb (patch)
treeb61d4672169aa78a0bee9aae319af68768a2b6ee /indoteknik_custom/models/purchase_order_sales_match.py
parent141bfb3a32e73d5b8557a70867d957d5ed3d485b (diff)
parenta24d7b2a21ff24e31eef77e2032a861b7eb13e31 (diff)
Merge branch 'odoo-production' into CR/renca-commision
# Conflicts: # indoteknik_custom/models/commision.py # indoteknik_custom/views/customer_commision.xml
Diffstat (limited to 'indoteknik_custom/models/purchase_order_sales_match.py')
-rw-r--r--indoteknik_custom/models/purchase_order_sales_match.py12
1 files changed, 12 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..ed013dd5 100644
--- a/indoteknik_custom/models/purchase_order_sales_match.py
+++ b/indoteknik_custom/models/purchase_order_sales_match.py
@@ -24,6 +24,18 @@ 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')
+ purchase_line_id = fields.Many2one('purchase.order.line', string='Purchase Line', compute='_compute_purchase_line_id')
+
+ def _compute_purchase_line_id(self):
+ for line in self:
+ line.purchase_line_id = self.env['purchase.order.line'].search([('order_id', '=', line.purchase_order_id.id), ('product_id', '=', line.product_id.id)])
+
+ 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.price_unit
def _compute_delivery_amt(self):
for line in self: