diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-10 11:32:18 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-10 11:32:18 +0700 |
| commit | 4fd0d7f15ee2d7958c6d9c60faf03d1e9915eaef (patch) | |
| tree | b6ab45c654dfc9b4aa08b878b823b0010331d63f /indoteknik_custom/models/purchase_order_line.py | |
| parent | 7b4f47e43d6485bb7822f1eb21497e68ab782ab1 (diff) | |
| parent | 81c87b71d6cb7caad7230b9cca8545155d917214 (diff) | |
Merge branch 'production' of https://bitbucket.org/altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/purchase_order_line.py')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index f255095f..39aeba0f 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -28,6 +28,21 @@ 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.order_id.partner_id.id) + ], limit=1) + + if purchase_pricelist: + price_vendor = format(purchase_pricelist.product_price, ".2f") + price_vendor = float(price_vendor) + line.price_vendor = price_vendor + else: + line.price_vendor = 0 def compute_qty_stock(self): for line in self: |
