From 57fd7b15d8e135f9e58b87dbeed89373d27f53c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 30 Mar 2026 16:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/inherit_purchase_order.py | 23 +++++++++++++++++++ .../views/inherit_purchase_order_views.xml | 8 +++++++ 2 files changed, 31 insertions(+) diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 61eac7e4e..ec4cab94c 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -86,6 +86,29 @@ class InheritPurchaseOrder(models.Model): else: record.display_end_time = record.write_date + @api.depends('picking_ids', 'picking_ids.receipt_status', 'picking_ids.picking_type_code') + def _compute_picking_receipt_state(self): + """根据关联入库单的 receipt_status 计算入库状态。 + + 只考虑入库类型的调拨(picking_type_code == 'incoming'): + - 任一为 receipt → 已入库 + - 否则任一为 certification → 证明入库 + - 否则任一为 acceptance → 待验收 + - 否则为空 + """ + for order in self: + state = False + incoming_pickings = order.picking_ids.filtered(lambda p: p.picking_type_code == 'incoming') + if incoming_pickings: + statuses = set(incoming_pickings.mapped('receipt_status')) + if 'receipt' in statuses: + state = 'done' + elif 'certification' in statuses: + state = 'certification' + elif 'acceptance' in statuses: + state = 'waiting' + order.picking_receipt_state = state + @api.depends_context('uid', 'company') @api.depends('company_id') def _compute_is_company(self): diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml index b98b9872e..64ea56edc 100644 --- a/yuthon_purchase/views/inherit_purchase_order_views.xml +++ b/yuthon_purchase/views/inherit_purchase_order_views.xml @@ -40,6 +40,14 @@ + + + + +