From 7a6538bcc116adb40c692a3d3ae6443fc1ff1446 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 12 Feb 2025 11:29:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E3=80=90=E9=9C=80=E6=B1=82=E6=95=B0=E9=87=8F=E3=80=91?= =?UTF-8?q?=20=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 11 +++++++++++ sf_warehouse/views/change_stock_move_views.xml | 3 +++ 2 files changed, 14 insertions(+) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index fb80618a..582d7a59 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -935,6 +935,17 @@ class SfStockPicking(models.Model): _inherit = 'stock.picking' check_in = fields.Char(string='查询是否为入库单', compute='_check_is_in') + product_uom_qty_sp = fields.Float('需求数量', compute='_compute_product_uom_qty_sp', store=True) + + @api.depends('move_ids_without_package', 'move_ids_without_package.product_uom_qty') + def _compute_product_uom_qty_sp(self): + for sp in self: + if sp.move_ids_without_package: + sp.product_uom_qty_sp = 0 + for move_id in sp.move_ids_without_package: + sp.product_uom_qty_sp += move_id.product_uom_qty + else: + sp.product_uom_qty_sp = 0 def batch_stock_move(self): """ diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml index 9e1073c9..8cde3ca3 100644 --- a/sf_warehouse/views/change_stock_move_views.xml +++ b/sf_warehouse/views/change_stock_move_views.xml @@ -156,6 +156,9 @@