From e781bce27e1d4dc43195f9e6e5813eb8f4ac1ea6 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Tue, 22 Aug 2023 11:40:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E4=BA=86?= =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E8=AE=BE=E5=A4=87=E8=B5=84=E6=BA=90=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=92=8C=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=B8=83=E5=B1=80=EF=BC=9B=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E3=80=81=E7=8F=AD?= =?UTF-8?q?=E6=AC=A1=E3=80=81=E4=BC=91=E6=81=AF=E6=97=A5=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=9A=84form=E8=A7=86=E5=9B=BE=EF=BC=8C=E6=96=B0=E5=A2=9Etree?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD=EF=BC=9B?= =?UTF-8?q?2=E3=80=81=E4=BF=AE=E5=A4=8D=E4=BA=A7=E7=BA=BF=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E8=B5=84=E6=BA=90=E8=AE=BE=E7=BD=AE=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86=E6=9C=BA=E5=8F=B0=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0=EF=BC=9B3=E3=80=81?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=8F=AD=E6=AC=A1=E5=AD=97=E6=AE=B5=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=EF=BC=9B4=E3=80=81=E8=B0=83=E6=95=B4=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E8=B5=84=E6=BA=90=E8=AE=BE=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E8=AE=BE=E7=BD=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan_management/models/base.py | 8 +- sf_plan_management/models/calendar_base.py | 4 +- sf_plan_management/views/menu_view.xml | 14 +- sf_plan_management/views/plan_base_view.xml | 216 ++++++++++---------- 4 files changed, 121 insertions(+), 121 deletions(-) diff --git a/sf_plan_management/models/base.py b/sf_plan_management/models/base.py index 801c5eb4..097401ad 100644 --- a/sf_plan_management/models/base.py +++ b/sf_plan_management/models/base.py @@ -8,7 +8,7 @@ class ProcedureEquipmentResourceSetting(models.Model): name = fields.Many2one('sf.production.line', string='生产线', required=True) work_center_name_id = fields.Many2one('mrp.workcenter', string='工作中心名称') - equipment_code = fields.Char(string='机台号(原设备编码)', readonly=True, compute='_onchange_equipment_name_id') + equipment_code = fields.Char(string='机台号', readonly=True, compute='_onchange_equipment_name_id') equipment_name_id = fields.Many2one('maintenance.equipment', string='设备名称', readonly=True, @@ -41,9 +41,9 @@ class ProcedureEquipmentResourceSetting(models.Model): @api.onchange('equipment_name_id') def _onchange_equipment_name_id(self): for record in self: - record.equipment_code = record.equipment_name_id.code, - record.brand = record.equipment_name_id.brand_id.name, - record.model = record.equipment_name_id.type_id.name, + record.equipment_code = record.equipment_name_id.code + record.brand = record.equipment_name_id.brand_id.name + record.model = record.equipment_name_id.type_id.name record.status = record.equipment_name_id.state @api.depends('working_calendar_id') diff --git a/sf_plan_management/models/calendar_base.py b/sf_plan_management/models/calendar_base.py index 5b86e6dd..b783f8b7 100644 --- a/sf_plan_management/models/calendar_base.py +++ b/sf_plan_management/models/calendar_base.py @@ -26,14 +26,14 @@ class WorkLogSetting(models.Model): code = fields.Char(string='序号', default=_get_code) name = fields.Char(string='工作日历名称', required=True, size=15, length=30) - working_shift_ids = fields.Many2many('sf.working.shift', string='班次') + working_shift_ids = fields.Many2many('sf.working.shift', string='班次', required=True) start_time = fields.Datetime(string='日开始时间', readonly=True, compute='_compute_working_shift_ids') end_time = fields.Datetime(string='日结束时间', readonly=True, compute='_compute_working_shift_ids') duration = fields.Char(string='时长', readonly=True, compute='_compute_working_shift_ids') day_off_ids = fields.Many2many('sf.day.off', string='休息日', required=True) - status = fields.Boolean(string='状态', default=True) + status = fields.Selection([('正常', '正常'), ('禁用', '禁用')], string='状态', default='正常') update_person = fields.Char(string='更新人', default=lambda self: self.env.user.name) update_time = fields.Datetime(string='更新时间', default=lambda self: fields.Datetime.now()) diff --git a/sf_plan_management/views/menu_view.xml b/sf_plan_management/views/menu_view.xml index d0c7dc87..6817e30c 100644 --- a/sf_plan_management/views/menu_view.xml +++ b/sf_plan_management/views/menu_view.xml @@ -7,20 +7,20 @@ sequence="599" /> - - + + 工作日历设置 sf.work.log.setting - + - - - + + + @@ -30,38 +30,39 @@ sf.work.log.setting
+
+
- - +
+

- - - - - - - - - - - - - - - - +

+
- - + + + + + + + - - - - + + + + + +
@@ -79,7 +80,7 @@ 休息日 sf.day.off - + @@ -88,7 +89,7 @@ 休息日 sf.day.off - tree,form + tree @@ -97,7 +98,7 @@ 班次 sf.working.shift - + @@ -107,32 +108,32 @@ - - 班次 - sf.working.shift - -
- - - - - - - - - - - - - -
-
-
+ + + + + + + + + + + + + + + + + + + + + 班次 sf.working.shift - tree,form + tree @@ -141,34 +142,35 @@ 工作日历 sf.work.schedule.calendar - - + + + - - 工作日历 - sf.work.schedule.calendar - -
- - - - - - - - - - - - -
-
-
+ + + + + + + + + + + + + + + + + + + + 工作日历 @@ -196,7 +198,7 @@ 工作日历 sf.work.schedule.calendar - calendar,search,tree,form + calendar,search,tree @@ -207,15 +209,15 @@ - - - + + + - - - - + + + + @@ -229,41 +231,39 @@
- - +
+

- - - +

+
+ - - - - - - - ` - - - - - - - - - - - - + + + + + ` + + + + + + + + + + + +
From cd33fb9fb9862281108513e9fc8883c2304b3246 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 23 Aug 2023 10:09:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=B9=E5=85=B7=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/base.py | 7 +++++++ sf_base/models/fixture.py | 5 +++++ sf_mrs_connect/models/sync_common.py | 19 +++++++++++-------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/sf_base/models/base.py b/sf_base/models/base.py index bb225b9b..02c569ba 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -308,6 +308,13 @@ class MachineToolType(models.Model): active = fields.Boolean('有效', default=True) code = fields.Char('编码') + def _get_ids(self, machine_tool_type_code): + machine_tool_type_ids = [] + for item in machine_tool_type_code: + machine_tool_type = self.search([('code', '=', item)]) + machine_tool_type_ids.append(machine_tool_type.id) + return [(6, 0, machine_tool_type_ids)] + class MachineToolCategory(models.Model): _name = 'sf.machine_tool.category' diff --git a/sf_base/models/fixture.py b/sf_base/models/fixture.py index db22b8d6..727f58bc 100644 --- a/sf_base/models/fixture.py +++ b/sf_base/models/fixture.py @@ -53,5 +53,10 @@ class FixtureModel(models.Model): screw_size = fields.Integer(string="螺牙大小[mm]", size=6) active = fields.Boolean('有效', default=True) + # @api.model + # def create(self, vals): + # obj = super(FixtureModel, self).create(vals) + # return obj + diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 6c2003ff..892a2eed 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1519,10 +1519,11 @@ class SyncFixtureModel(models.Model): "materials_model_id": self.env['sf.materials.model'].search( [('materials_no', '=', item['materials_model_code'])]).id, "driving_way": item['driving_way'], - "apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( - [('code', '=', item['apply_machine_tool_type_code'])]).id, + "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids( + item['apply_machine_tool_type_code']).id, "through_hole_size": item['through_hole_size'], "screw_size": item['screw_size'], + "active": item['active'], }) else: fixture_model.write({ @@ -1548,10 +1549,11 @@ class SyncFixtureModel(models.Model): "materials_model_id": self.env['sf.materials.model'].search( [('materials_no', '=', item['materials_model_code'])]).id, "driving_way": item['driving_way'], - "apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( - [('code', '=', item['apply_machine_tool_type_code'])]).id, + "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids( + item['apply_machine_tool_type_code']).id, "through_hole_size": item['through_hole_size'], "screw_size": item['screw_size'], + "active": item['active'], }) else: raise ValidationError("认证未通过") @@ -1599,10 +1601,11 @@ class SyncFixtureModel(models.Model): "materials_model_id": self.env['sf.materials.model'].search( [('materials_no', '=', item['materials_model_code'])]).id, "driving_way": item['driving_way'], - "apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( - [('code', '=', item['apply_machine_tool_type_code'])]).id, + "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids( + item['apply_machine_tool_type_code']).id, "through_hole_size": item['through_hole_size'], "screw_size": item['screw_size'], + "active": item['active'], }) else: fixture_model.write({ @@ -1628,8 +1631,8 @@ class SyncFixtureModel(models.Model): "materials_model_id": self.env['sf.materials.model'].search( [('materials_no', '=', item['materials_model_code'])]).id, "driving_way": item['driving_way'], - "apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( - [('code', '=', item['apply_machine_tool_type_code'])]).id, + "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids( + item['apply_machine_tool_type_code']).id, "through_hole_size": item['through_hole_size'], "screw_size": item['screw_size'], "active": item['active'], From 2ae7b2c8ecd7c7bbad84c4e9aaae092ec431df29 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 23 Aug 2023 10:28:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8A=A0=E5=A4=A7=E9=86=92=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/views/base_view.xml | 22 +++++++++++----------- sf_base/views/common_view.xml | 16 ++++++++-------- sf_base/views/fixture_view.xml | 8 ++++---- sf_base/views/functional_fixture_view.xml | 4 ++-- sf_base/views/tool_views.xml | 4 ++-- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml index 88a2dd86..4e7e5290 100644 --- a/sf_base/views/base_view.xml +++ b/sf_base/views/base_view.xml @@ -41,16 +41,16 @@
-

- +

+
- +

- +

-