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 01/15] =?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 02/15] =?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 @@ - + From 808f57adfb1d04166e1eeade38eb8146b96d9864 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Fri, 14 Jul 2023 15:01:56 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A8=A1=E5=9E=8B=E6=96=B0=E5=A2=9E=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=97=A5=E5=8E=86=E6=8C=89=E9=94=AE=EF=BC=8C=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan_management/models/base.py | 2 +- sf_plan_management/models/calendar_base.py | 7 +++++++ sf_plan_management/views/menu_view.xml | 12 ++++++------ sf_plan_management/views/plan_base_view.xml | 6 +++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sf_plan_management/models/base.py b/sf_plan_management/models/base.py index 57df9566..ca6e4693 100644 --- a/sf_plan_management/models/base.py +++ b/sf_plan_management/models/base.py @@ -36,7 +36,7 @@ class ProcedureEquipmentResourceSetting(models.Model): @api.depends('work_center_name_id') def _onchange_work_center_name_id(self): for record in self: - record.equipment_name_id = record.work_center_name_id.equipment_ids + record.equipment_name_id = record.work_center_name_id.equipment_id @api.onchange('equipment_name_id') def _onchange_equipment_name_id(self): diff --git a/sf_plan_management/models/calendar_base.py b/sf_plan_management/models/calendar_base.py index 6304d2e1..99e5f070 100644 --- a/sf_plan_management/models/calendar_base.py +++ b/sf_plan_management/models/calendar_base.py @@ -184,6 +184,7 @@ class WorkLogSetting(models.Model): 'name_id': self.id, 'calendar_code': self.code, 'date_time': single_date}) + @staticmethod def daterange(start_date, end_date): """ @@ -193,6 +194,12 @@ class WorkLogSetting(models.Model): for n in range(int((end_date - start_date).days)): yield start_date + timedelta(n) + def open_work_schedule_calendar(self): + action = self.env.ref('sf_plan_management.sf_work_schedule_calendar_act') + result = action.read()[0] + result['domain'] = [('name_id', '=', self.id)] + return result + class WorkingShift(models.Model): _name = 'sf.working.shift' diff --git a/sf_plan_management/views/menu_view.xml b/sf_plan_management/views/menu_view.xml index 793f381d..e50f6fa9 100644 --- a/sf_plan_management/views/menu_view.xml +++ b/sf_plan_management/views/menu_view.xml @@ -40,10 +40,10 @@ sequence="15" /> - + + + + + + \ No newline at end of file diff --git a/sf_plan_management/views/plan_base_view.xml b/sf_plan_management/views/plan_base_view.xml index 16e25874..a10ccf89 100644 --- a/sf_plan_management/views/plan_base_view.xml +++ b/sf_plan_management/views/plan_base_view.xml @@ -16,7 +16,11 @@ - +