From 519ce0d5bb7d32e91fab958322948ad8b7f9be61 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Fri, 25 Oct 2024 11:29:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 13 +++++---- sf_message/models/sf_message_workorder.py | 5 ++-- sf_message/views/mrp_workorder_views.xml | 31 +++++++++++++++++++++ sf_sale/models/quick_easy_order_old.py | 13 +++++---- 4 files changed, 48 insertions(+), 14 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 3b8ed0a6..0b512c36 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -16,6 +16,12 @@ from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): _inherit = 'product.template' + def _get_machining_precision(self): + machinings = self.env['sf.machining.accuracy'].sudo().search([]) + + list = [(m.sync_id, m.name) for m in machinings] + return list + model_file = fields.Binary('模型文件') categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True) model_name = fields.Char('模型名称') @@ -23,12 +29,7 @@ class ResProductMo(models.Model): model_width = fields.Float('模型宽(mm)', digits=(16, 3)) model_height = fields.Float('模型高(mm)', digits=(16, 3)) model_volume = fields.Float('模型体积(m³)') - model_machining_precision = fields.Selection([ - ('0.10', '±0.10mm'), - ('0.05', '±0.05mm'), - ('0.03', '±0.03mm'), - ('0.02', '±0.02mm'), - ('0.01', '±0.01mm')], string='加工精度') + model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度') model_processing_panel = fields.Char('模型加工面板') model_remark = fields.Char('模型备注说明') length = fields.Float('长(mm)', digits=(16, 3)) diff --git a/sf_message/models/sf_message_workorder.py b/sf_message/models/sf_message_workorder.py index 1786a796..4f607802 100644 --- a/sf_message/models/sf_message_workorder.py +++ b/sf_message/models/sf_message_workorder.py @@ -85,11 +85,12 @@ class SFMessageWork(models.Model): def request_url(self): url = self.env['ir.config_parameter'].get_param('web.base.url') - action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id + action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id + active_id = self.env['mrp.workcenter'].search([('name', '=', '工件装夹中心')]).id # 查询参数 params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder', - 'view_type': 'list', 'active_id': 1} + 'view_type': 'list', 'active_id': active_id} # 拼接查询参数 query_string = urlencode(params) # 拼接URL diff --git a/sf_message/views/mrp_workorder_views.xml b/sf_message/views/mrp_workorder_views.xml index 1e31fc6d..ab0a76a9 100644 --- a/sf_message/views/mrp_workorder_views.xml +++ b/sf_message/views/mrp_workorder_views.xml @@ -30,5 +30,36 @@

+ + + + 工单 + ir.actions.act_window + mrp.workorder + tree,form + + + + current + [('state', '!=', 'cancel'),('schedule_state', '=', '已排')] + {'search_default_product': 1, 'search_default_workcenter_id': + active_id,'search_default_ready': 1, 'search_default_progress': 1} + + +

+ 没有工单要做! +

+

+ 工作订单是作为制造订单的一部分执行的操作。 + 工序在物料清单中定义或直接添加到制造订单中。 +

+

+ 使用工作台工作中心控制面板直接登记车间中的操作. + 平板电脑为您的工人提供工作表,并允许他们报废产品,跟踪时间, + 发起维护请求,执行质量测试等. +

+
+
\ No newline at end of file diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 4756a2c5..5207ec15 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -20,6 +20,12 @@ class QuickEasyOrder(models.Model): _description = '简易下单' _order = 'id desc' + def _get_machining_precision(self): + machinings = self.env['sf.machining.accuracy'].sudo().search([]) + + list = [(m.sync_id, m.name) for m in machinings] + return list + name = fields.Char('订单编号', default=lambda self: self.env['ir.sequence'].next_by_code('quick.easy.order')) model_length = fields.Float('长(mm)', digits=(16, 3)) model_width = fields.Float('宽(mm)', digits=(16, 3)) @@ -27,12 +33,7 @@ class QuickEasyOrder(models.Model): model_volume = fields.Float('体积(mm³)', digits=(16, 3)) model_processing_side = fields.Char('加工面', default='A') model_feature = fields.Char('特征') - machining_precision = fields.Selection([ - ('0.10', '±0.10mm'), - ('0.05', '±0.05mm'), - ('0.03', '±0.03mm'), - ('0.02', '±0.02mm'), - ('0.01', '±0.01mm')], string='加工精度', default='0.10') + model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度') material_id = fields.Many2one('sf.production.materials', '材料', tracking=True) material_model_id = fields.Many2one('sf.materials.model', '型号', domain="[('materials_id', '=', material_id)]", tracking=True) From 86d97ef331efcbbba29f37494ea91ac4b857e80a Mon Sep 17 00:00:00 2001 From: guanhuan Date: Fri, 25 Oct 2024 11:55:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?2D=E5=8A=A0=E5=B7=A5=E5=9B=BE=E7=BA=B8?= =?UTF-8?q?=E5=92=8C=E8=B4=A8=E6=A3=80=E6=A0=87=E5=87=86=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/mrp_workorder_view.xml | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 708a9779..69dcac7a 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -467,6 +467,15 @@ + + + + + + + + + @@ -520,6 +529,13 @@ + + + + + + + @@ -590,18 +606,6 @@ mrp.group_mrp_manager,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user,sf_base.group_sf_order_user - - - - - - - - - -