From e1d6726d8b613efe994995b2ea154e966d3e8998 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Fri, 23 Feb 2024 16:41:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=8C=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index fc3c7d09..58b3a078 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -72,7 +72,8 @@ class SfLocation(models.Model): ('禁用', '禁用') ], string='货位状态', default='空闲') # product_id = fields.Many2one('product.template', string='产品') - product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True) + # product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True) + product_id = fields.Many2one('product.product', string='产品', readonly=True) product_sn_id = fields.Many2one('stock.lot', string='产品序列号') # time_test = fields.Char(string='time') # 添加SQL约束 @@ -374,22 +375,22 @@ class ShelfLocation(models.Model): def action_location_status_enable(self): self.location_status = '空闲' - @api.depends('product_sn_id') - def _compute_product_id(self): - """ - 根据产品序列号,获取产品 - """ - for record in self: - if record.product_sn_id: - record.sudo().product_id = record.product_sn_id.product_id - record.sudo().location_status = '占用' - - else: - if record.production_id: - record.location_status = '占用' - else: - record.product_id = False - record.location_status = '空闲' + # @api.depends('product_sn_id') + # def _compute_product_id(self): + # """ + # 根据产品序列号,获取产品 + # """ + # for record in self: + # if record.product_sn_id: + # record.sudo().product_id = record.product_sn_id.product_id + # record.sudo().location_status = '占用' + # + # else: + # if record.production_id: + # record.location_status = '占用' + # else: + # record.product_id = False + # record.location_status = '空闲' # 调取获取货位信息接口 def get_sf_shelf_location_info(self):