From d103a1cd29adea7bee05d44c5e4662e239067cab Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Fri, 11 Aug 2023 17:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AF=B9=E8=B1=A1=EF=BC=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=A4=9A=E5=AF=B9=E4=B8=80=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E5=B8=83=E5=B1=80=EF=BC=9B=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=BB=84=E5=B1=95=E7=A4=BA=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=9B=E5=AF=B9=E5=88=80=E5=85=B7=E7=89=A9?= =?UTF-8?q?=E6=96=99=E6=9F=A5=E8=AF=A2=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=A0=B9=E6=8D=AE=E6=89=80=E9=80=89=E7=9A=84=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=89=A9=E6=96=99=E4=B8=8D=E5=90=8C=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=9A=84=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 44 ++-- .../models/tool_material_search.py | 19 +- .../security/ir.model.access.csv | 1 + sf_tool_management/views/tool_base_views.xml | 109 ++++++---- .../views/tool_material_search.xml | 204 +++++++++++------- 5 files changed, 244 insertions(+), 133 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 2bf0df54..781580b7 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -15,8 +15,13 @@ class FunctionalCuttingToolEntity(models.Model): code = fields.Char('编码') name = fields.Char('名称') - mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型') mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='刀具型号') + mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',tracking=True, + group_expand='_read_group_mrs_cutting_tool_type_ids') + @api.model + def _read_group_mrs_cutting_tool_type_ids(self, categories, domain, order): + mrs_cutting_tool_type_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) + return categories.browse(mrs_cutting_tool_type_ids) # 整体式刀具型号 mrs_cutting_tool_integral_model_ids = fields.Many2many('sf.cutting.tool.model', @@ -403,25 +408,40 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model): image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image') # 功能刀具出入库记录 特有字段 + current_state = fields.Char(string='当前状态', readonly=False) + current_store_area = fields.Char(string='当前库区', readonly=False) + current_store_place = fields.Char(string='当前库位', readonly=False) + tool_install_staff = fields.Char(string='装刀人', readonly=False) + tool_install_time = fields.Datetime(string='装刀时间', readonly=False) thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False) max_life_span = fields.Char(string='最大寿命值', readonly=False) alarm_value = fields.Char(string='报警值', readonly=False) used_value = fields.Char(string='已使用值', readonly=False) - current_state = fields.Char(string='当前状态', readonly=False) - current_store_area = fields.Char(string='当前库区', readonly=False) - current_store_place = fields.Char(string='当前库位', readonly=False) - number = fields.Integer(string='数量', readonly=False) reason_application = fields.Char(string='申请原因', readonly=False) applicant = fields.Char(string='申请人', readonly=False) - return_staff = fields.Char(string='归还人', readonly=False) - return_time = fields.Date(string='归还入库时间', readonly=False) - tool_state = fields.Char(string="刀具状态", readonly=False) - tool_install_staff = fields.Char(string='装刀人', readonly=False) - tool_install_time = fields.Datetime(string='装刀时间', readonly=False) + + inbound_and_outbound_records_ids = fields.One2many('sf.inbound.and.outbound.records','inbound_and_outbound_tools_id', string='出入库记录') + + remark = fields.Char(string='备注/说明', readonly=False) + + +class InboundAndOutboundRecords(models.Model): + _name = 'sf.inbound.and.outbound.records' + _description = '出入库记录' + _order = 'id DESC' + + inbound_and_outbound_tools_id = fields.Many2one('sf.inbound.and.outbound.records.of.functional.tools',string='功能刀具出入库记录') + + name = fields.Char(string='出入库记录') + tool_state = fields.Selection([('0', '领用出库'), ('1', '归还入库')], string="出入库类别", readonly=False) receive_equipment = fields.Char(string='领用机台', readonly=False) receive_staff = fields.Char(string='领用人', readonly=False) - receive_time = fields.Char(string='领用出库时间', readonly=False) - remark = fields.Text(string='备注/说明', readonly=False) + receive_time = fields.Datetime(string='领用出库时间', readonly=False) + return_staff = fields.Char(string='归还人', readonly=False) + return_time = fields.Datetime(string='归还入库时间', readonly=False) + current_store_area = fields.Char(string='库区', readonly=False) + current_store_place = fields.Char(string='库位', readonly=False) + number = fields.Integer(string='数量', readonly=False) class MachineTableToolChangingApply(models.Model): diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index be14ca23..91ba894b 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from odoo import fields, models, api +from odoo import fields, models, api, SUPERUSER_ID # 刀具物料搜索 @@ -22,10 +22,23 @@ class SfToolMaterialSearch(models.Model): # mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号') # 关联刀具物料模型 - mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料') + mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',tracking=True, + group_expand='_read_group_mrs_cutting_tool_material_ids') + cutting_tool_material_name = fields.Char(string='物料名称',invisible=True) + + @api.onchange('mrs_cutting_tool_material_id') + def _onchange_mrs_cutting_tool_material_id(self): + for record in self: + if record: + record.cutting_tool_material_name = record.mrs_cutting_tool_material_id.name + + @api.model + def _read_group_mrs_cutting_tool_material_ids(self, categories, domain, order): + mrs_cutting_tool_material_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) + return categories.browse(mrs_cutting_tool_material_ids) # 刀片特有字段 - blade_code = fields.Char('刀片编码') + blade_code = fields.Char('刀片编码', readonly=True) blade_length = fields.Float('长度L(mm)') blade_width = fields.Float('宽度D(mm)') blade_height = fields.Float('高度T(mm)') diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index d95ad4c5..855733b9 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -4,6 +4,7 @@ access_sf_functional_cutting_tool_entity_cache,sf.functional.cutting.tool.entity access_sf.functional.tool.warning,sf.functional.tool.warning,model_sf_functional_tool_warning,base.group_user,1,1,1,1 access_sf.real.time.distribution.of.functional.tools,sf.real.time.distribution.of.functional.tools,model_sf_real_time_distribution_of_functional_tools,base.group_user,1,1,1,1 access_sf.inbound.and.outbound.records.of.functional.tools,sf.inbound.and.outbound.records.of.functional.tools,model_sf_inbound_and_outbound_records_of_functional_tools,base.group_user,1,1,1,1 +access_sf.inbound.and.outbound.records,sf.inbound.and.outbound.records,model_sf_inbound_and_outbound_records,base.group_user,1,1,1,1 access_sf_cam_work_order_program_knife_plan,sf.cam.work.order.program.knife.plan,model_sf_cam_work_order_program_knife_plan,base.group_user,1,1,1,1 access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply,model_sf_machine_table_tool_changing_apply,base.group_user,1,1,1,1 diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index ebf1bc95..2aa91feb 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -321,10 +321,6 @@ - - - - @@ -336,11 +332,6 @@ - - - - - @@ -421,7 +412,7 @@ - + @@ -457,30 +448,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + @@ -502,7 +470,22 @@ - + + + + + + + + + + + + + + + + @@ -528,7 +511,7 @@ - + @@ -544,6 +527,60 @@ + + + 出入库记录 + sf.inbound.and.outbound.records + + + + + + + + + + + + + + + + + 出入库记录 + sf.inbound.and.outbound.records + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ + + 出入库记录 + ir.actions.act_window + sf.inbound.and.outbound.records + tree,form + + + 机床换刀申请 diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 9a68388d..4b5e2ba1 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -155,90 +155,130 @@ - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -257,8 +297,8 @@ - @@ -270,7 +310,7 @@ tree,form