From 590decb22298c53e13265c49be568731f8275f9f Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 12 Jun 2024 09:18:20 +0700 Subject: add matches so in purchase order view --- indoteknik_custom/models/purchase_order.py | 9 +++++++++ indoteknik_custom/views/purchase_order.xml | 2 ++ 2 files changed, 11 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 3a959391..810d6b2f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -57,6 +57,15 @@ class PurchaseOrder(models.Model): from_apo = fields.Boolean(string='From APO', tracking=3) approval_edit_line = fields.Boolean(string='Approval Edit Line', tracking=3) sale_order = fields.Char(string='Sale Order') + matches_so = fields.Many2many('sale.order', string='Matches SO', compute='_compute_matches_so') + + def _compute_matches_so(self): + for po in self: + matches = [] + for match in po.order_sales_match_line: + matches.append(match.sale_id.id) + matches = list(set(matches)) + po.matches_so = matches def _prepare_picking(self): if not self.group_id: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index bb38715e..6871b398 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -132,6 +132,7 @@ + @@ -148,6 +149,7 @@ + -- cgit v1.2.3