From af4ee6eef06a440207c6d16809d06e08057f66f0 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 20 Jun 2025 09:57:29 +0700 Subject: bu pick in purchase order sales match --- indoteknik_custom/models/purchase_order_sales_match.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indoteknik_custom/models/purchase_order_sales_match.py') diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py index 0bd0092b..2ea89dab 100644 --- a/indoteknik_custom/models/purchase_order_sales_match.py +++ b/indoteknik_custom/models/purchase_order_sales_match.py @@ -28,6 +28,20 @@ class PurchaseOrderSalesMatch(models.Model): 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') hold_outgoing_so = fields.Boolean(string='Hold Outgoing SO', related='sale_id.hold_outgoing') + bu_pick = fields.Many2one('stock.picking', string='BU Pick', compute='compute_bu_pick') + + def compute_bu_pick(self): + for rec in self: + stock_move = self.env['stock.move'].search([ + ('reference', 'ilike', 'BU/PICK'), + ('state', 'in', ['confirmed','waiting','partially_available']), + ('product_id', '=', rec.product_id.id), + ('sale_line_id', '=', rec.sale_line_id.id), + ]) + if stock_move: + rec.bu_pick = stock_move.picking_id.id + else: + rec.bu_pick = '' def _compute_purchase_line_id(self): for line in self: -- cgit v1.2.3 From 74b49469064387219474ddf8e8f38e5d676079c2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 25 Jun 2025 10:03:06 +0700 Subject: push --- indoteknik_custom/models/purchase_order_sales_match.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchase_order_sales_match.py') diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py index 2ea89dab..b18864f3 100644 --- a/indoteknik_custom/models/purchase_order_sales_match.py +++ b/indoteknik_custom/models/purchase_order_sales_match.py @@ -41,7 +41,7 @@ class PurchaseOrderSalesMatch(models.Model): if stock_move: rec.bu_pick = stock_move.picking_id.id else: - rec.bu_pick = '' + rec.bu_pick = None def _compute_purchase_line_id(self): for line in self: -- cgit v1.2.3