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):