From 7e734333e198e8405ce49ef96f5cb347b0a892d4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 23 Oct 2023 11:23:27 +0700 Subject: fix re calculate po --- indoteknik_custom/models/purchase_order.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e8cd86fa..d62d7b1e 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -338,12 +338,11 @@ class PurchaseOrder(models.Model): def re_calculate(self): for line in self.order_line: sale_order_line = self.env['sale.order.line'].search([ - ('id', '=', line.so_line_id.id), + ('product_id', 'in', [line.product_id.id]), ('order_id', '=', line.order_id.sale_order_id.id) - ], limit=1, order='price_reduce_taxexcl') + ]) for so_line in sale_order_line: - unit_price = line.price_unit - so_line.purchase_price = unit_price + so_line.purchase_price = line.price_unit def button_cancel(self): res = super(PurchaseOrder, self).button_cancel() -- cgit v1.2.3