From 3de5a95a98ba3331c3546d815d18bc7e5544a814 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 14 Jul 2023 14:35:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E6=97=A0=E6=B3=95=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan_management/models/calendar_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_plan_management/models/calendar_base.py b/sf_plan_management/models/calendar_base.py index 6304d2e1..e95876d8 100644 --- a/sf_plan_management/models/calendar_base.py +++ b/sf_plan_management/models/calendar_base.py @@ -179,7 +179,7 @@ class WorkLogSetting(models.Model): is_workday = single_date.strftime("%A") if is_workday in rest_days: print('is_workday in rest_days', is_workday) - self.env['sf.work.schedule.calendar'].create({ + self.env['sf.work.schedule.calendar'].sudo().create({ 'name': '休息日', 'name_id': self.id, 'calendar_code': self.code, From 5b6a563a878d95a793e6b533f99d42ea665ea363 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 14 Jul 2023 14:43:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=BA=93=E5=8C=BA=E7=9B=B8=E5=85=B3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 50 ++++++++++++++++++------------------ sf_warehouse/views/view.xml | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 8954a84e..bb0323e6 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -15,7 +15,7 @@ class SfLocation(models.Model): ('库区', '库区'), ('货架', '货架'), ('货位', '货位') - ], string='仓库类别') + ], string='存储类型') # 库区类型(selection:拣货区、存货区、收货区、退货区、次品区) area_type = fields.Selection([ ('拣货区', '拣货区'), @@ -25,10 +25,10 @@ class SfLocation(models.Model): ('次品区', '次品区') ], string='库区类型') # 存储类型(selection:库区、货架) - storage_type = fields.Selection([ - ('库区', '库区'), - ('货架', '货架') - ], string='存储类型') + # storage_type = fields.Selection([ + # ('库区', '库区'), + # ('货架', '货架') + # ], string='存储类型') # 产品类别 (关联:product.category) product_type = fields.Many2many('product.category', string='产品类别') # 货架独有字段:通道、方向、货架高度(m)、货架层数、层数容量 @@ -61,26 +61,26 @@ class SfLocation(models.Model): hide_shelf = fields.Boolean(compute='_compute_hide_what', string='隐藏货架') hide_location = fields.Boolean(compute='_compute_hide_what', string='隐藏货位') - @api.model - def create(self, vals): - """ - 重写create方法,添加自定义的约束 - """ - print('create', vals) - if vals.get('location_id'): - location = self.env['stock.location'].browse(vals.get('location_id')) - if location.storage_type == '库区': - raise UserError('库区不能作为父级仓库') - return super().create(vals) - - @api.onchange('location_id') - def _onchange_location_id(self): - """ - 重写onchange方法,添加自定义的约束 - """ - if self.location_id: - if self.location_id.storage_type == '库区': - raise UserError('库区不能作为父级仓库') + # @api.model + # def create(self, vals): + # """ + # 重写create方法,添加自定义的约束 + # """ + # print('create', vals) + # if vals.get('location_id'): + # location = self.env['stock.location'].browse(vals.get('location_id')) + # if location.storage_type == '库区': + # raise UserError('库区不能作为父级仓库') + # return super().create(vals) + # + # @api.onchange('location_id') + # def _onchange_location_id(self): + # """ + # 重写onchange方法,添加自定义的约束 + # """ + # if self.location_id: + # if self.location_id.storage_type == '库区': + # raise UserError('库区不能作为父级仓库') # @api.constrains('shelf_height') # def _check_shelf_height(self): diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml index ad353f0e..bcb782f5 100644 --- a/sf_warehouse/views/view.xml +++ b/sf_warehouse/views/view.xml @@ -35,7 +35,7 @@ - +