diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-02-25 10:47:35 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-02-25 10:47:35 +0700 |
| commit | 6352ba63a39293b3e260bd7bd933c9de2c023172 (patch) | |
| tree | f94d502a6684a4a35c0276e8b66138d772af73ce | |
| parent | a5ab398f902915ea44394b4b8fd6a8bb14ccbb89 (diff) | |
add purchase price po and so on po sales matches
| -rw-r--r-- | indoteknik_custom/models/purchase_order_sales_match.py | 7 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 2 |
2 files changed, 9 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: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 3e4dd89c..0d3d5cc2 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -296,6 +296,8 @@ <field name="partner_invoice_id"/> <field name="salesperson_id"/> <field name="product_id"/> + <field name="purchase_price_so"/> + <field name="purchase_price_po"/> <field name="qty_so"/> <field name="qty_po"/> <field name="margin_item" optional="hide"/> |
