From 64581abeb1490683eb37e202e1f8b6520f13b221 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 20 Feb 2024 20:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=BC=82=E5=B8=B8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 8 ++++++++ sf_warehouse/views/shelf_location.xml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 14db4f8d..1d1afef2 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -254,6 +254,14 @@ class SfShelf(models.Model): shelf_layer = fields.Integer(string='货架层数') layer_capacity = fields.Integer(string='层数容量') + # 是否有货位 + is_there_area = fields.Boolean(string='是否有货位', compute='_compute_is_there_area', default=False, store=True) + + @api.depends('location_ids') + def _compute_is_there_area(self): + for record in self: + record.is_there_area = bool(record.location_ids) + @api.onchange('shelf_location_id') def _onchange_shelf_location_id(self): """ diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml index 36292205..b22ebd6e 100644 --- a/sf_warehouse/views/shelf_location.xml +++ b/sf_warehouse/views/shelf_location.xml @@ -8,7 +8,8 @@
-