From a39466421a31d2ffd5f2252bf7aac903c4785d83 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Aug 2023 09:47:05 +0700 Subject: add field price vendor --- indoteknik_custom/models/purchase_order_line.py | 12 ++++++++++++ indoteknik_custom/views/purchase_order.xml | 3 +++ 2 files changed, 15 insertions(+) diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index f255095f..1b5bba3a 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -28,6 +28,18 @@ class PurchaseOrderLine(models.Model): qty_outgoing = fields.Float('Qty Outgoing', compute='compute_qty_stock') qty_available_store = fields.Float(string='Available') suggest = fields.Char(string='Suggest') + price_vendor = fields.Float(string='Price Vendor', compute='compute_price_vendor') + + + def compute_price_vendor(self): + for line in self: + purchase_pricelist = self.env['purchase.pricelist'].search([ + ('product_id', '=', line.product_id.id), + ('vendor_id', '=', line.partner_id.id) + ], limit=1) + + price_vendor = purchase_pricelist.product_price + line.price_vendor = price_vendor def compute_qty_stock(self): for line in self: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 2f8590f3..7d436c46 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -56,6 +56,9 @@ + + + -- cgit v1.2.3