From 718b1f9edff0d25cd92f04177e6d15275c4aa79c Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 20 Nov 2023 13:23:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/base.py | 9 ++-- sf_bf_connect/models/process_status.py | 13 +++-- sf_manufacturing/models/mrp_workorder.py | 23 +++++---- sf_quality/models/custom_quality.py | 7 ++- sf_tool_management/models/__init__.py | 1 - .../models/tool_material_search.py | 12 +++-- sf_warehouse/__manifest__.py | 2 +- sf_warehouse/models/__init__.py | 1 - sf_warehouse/models/model.py | 15 ++++-- sf_wxwork_approval/models/model.py | 8 ---- sf_wxwork_approval/models/wxwork_settings.py | 48 +++++++------------ 11 files changed, 63 insertions(+), 76 deletions(-) diff --git a/sf_base/models/base.py b/sf_base/models/base.py index 966ccdc5..edc814bb 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -39,7 +39,7 @@ class MachineBrand(models.Model): remark = fields.Text('备注') active = fields.Boolean('有效', default=True) - + # 机床 class MachineTool(models.Model): _name = 'sf.machine_tool' @@ -86,7 +86,7 @@ class MachineTool(models.Model): state = fields.Selection( [("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")], default='正常', string="机床状态") - #0606新增字段 + # 0606新增字段 machine_tool_picture = fields.Binary('图片') heightened_way = fields.Selection([ ('sifudianji', '伺服电机驱动'), @@ -260,7 +260,7 @@ class MachineToolType(models.Model): default="", string="刀把类型") number_of_knife_library = fields.Integer('刀库数量') rotate_speed = fields.Integer('转速') - #0606新增字段 + # 0606新增字段 created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) machine_tool_picture = fields.Binary('图片') heightened_way = fields.Selection([ @@ -326,5 +326,4 @@ class MachineToolCategory(models.Model): remark = fields.Text('备注') active = fields.Boolean('有效', default=True) category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别', - default='shukong') - + default='shukong') diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py index 42284ace..069ef2d4 100644 --- a/sf_bf_connect/models/process_status.py +++ b/sf_bf_connect/models/process_status.py @@ -105,7 +105,6 @@ class StatusChange(models.Model): # # return True - # def action_cancel(self): # """ Cancel SO after showing the cancel wizard when needed. (cfr `_show_cancel_wizard`) # @@ -205,12 +204,12 @@ class FinishStatusChange(models.Model): [('id', 'child_of', self.picking_type_id.warehouse_id.view_location_id.id), ('usage', '!=', 'supplier')]) if self.env['stock.move'].search([ - ('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']), - ('product_qty', '>', 0), - ('location_id', 'in', wh_location_ids), - ('move_orig_ids', '=', False), - ('picking_id', 'not in', self.ids), - ('product_id', 'in', lines.product_id.ids)], limit=1): + ('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']), + ('product_qty', '>', 0), + ('location_id', 'in', wh_location_ids), + ('move_orig_ids', '=', False), + ('picking_id', 'not in', self.ids), + ('product_id', 'in', lines.product_id.ids)], limit=1): action = self.action_view_reception_report() action['context'] = {'default_picking_ids': self.ids} return action diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 1f304950..a2d81e68 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -165,7 +165,7 @@ class ResMrpWorkOrder(models.Model): y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / ( (y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4)) x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / ( - (x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8)); + (x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8)) y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / ( (y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8)) x = (x0 + x1) / 2 @@ -189,19 +189,26 @@ class ResMrpWorkOrder(models.Model): def json_workorder_str(self, k, production, route): # 计算预计时长duration_expected if route.routing_type == '切割': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '切割')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '切割')]).time_cycle elif route.routing_type == '获取CNC加工程序': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '获取CNC加工程序')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '获取CNC加工程序')]).time_cycle elif route.routing_type == '工件装夹': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '工件装夹')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '工件装夹')]).time_cycle elif route.routing_type == '前置三元定位检测': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '前置三元定位检测')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '前置三元定位检测')]).time_cycle elif route.routing_type == 'CNC加工': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', 'CNC加工')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', 'CNC加工')]).time_cycle elif route.routing_type == '后置三元质量检测': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '后置三元质量检测')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '后置三元质量检测')]).time_cycle elif route.routing_type == '解除装夹': - duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '解除装夹')]).time_cycle + duration_expected = self.env['mrp.routing.workcenter'].sudo().search( + [('name', '=', '解除装夹')]).time_cycle else: duration_expected = 60 workorders_values_str = [0, '', { diff --git a/sf_quality/models/custom_quality.py b/sf_quality/models/custom_quality.py index 4e323d73..1887da7a 100644 --- a/sf_quality/models/custom_quality.py +++ b/sf_quality/models/custom_quality.py @@ -7,9 +7,8 @@ class SfQualityPoint(models.Model): product_ids = fields.Many2many( 'product.product', string='适用产品', - domain="[('type', 'in', ('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", - help="Quality Point will apply to every selected Products.") + domain="[('type', 'in', " + "('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help= + "Quality Point will apply to every selected Products.") # picking_type_ids = fields.Many2many( # 'stock.picking.type', string='执行节点', required=True, check_company=True) - - diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py index 67b36bda..3ab6007e 100644 --- a/sf_tool_management/models/__init__.py +++ b/sf_tool_management/models/__init__.py @@ -1,3 +1,2 @@ from . import base from . import tool_material_search - diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index aad862b6..b89b76cd 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -19,13 +19,15 @@ class SfToolMaterialSearch(models.Model): mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称', store=True) cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True) - mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True, domain="[('tag_ids.name', 'ilike', '刀具')]") + mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True, + domain="[('tag_ids.name', 'ilike', '刀具')]") # 关联刀具型号 # mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号') # 关联刀具物料模型 mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料', - group_expand='_read_group_mrs_cutting_tool_material_ids', required=True) + group_expand='_read_group_mrs_cutting_tool_material_ids', + required=True) cutting_tool_material_name = fields.Char(string='物料名称', invisible=True) @api.onchange('mrs_cutting_tool_material_id') @@ -91,15 +93,15 @@ class SfToolMaterialSearch(models.Model): # integral_blade_material = fields.Selection([('碳素钢', '碳素钢'), ('硬质合金', '硬质合金')], '整体式刀具刀具材质') integral_hardness = fields.Integer('整体式刀具硬度(HRC)') integral_coating_material = fields.Char('整体式刀具涂层材质') - integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1)) + integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6, 1)) integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1)) suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image', 'rel_machining_product_template_material_search', '适合加工方式', domain=[('type', '=', '加工能力')]) blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image', - 'rel_blade_tip_product_template_material_search', '刀尖特征', - domain=[('type', '=', '刀尖特征')]) + 'rel_blade_tip_product_template_material_search', '刀尖特征', + domain=[('type', '=', '刀尖特征')]) handle_type_ids = fields.Many2many('maintenance.equipment.image', 'rel_handle_product_template_material_search', '柄部类型', domain=[('type', '=', '柄部类型')]) diff --git a/sf_warehouse/__manifest__.py b/sf_warehouse/__manifest__.py index 2bf2de4f..c3cdf682 100644 --- a/sf_warehouse/__manifest__.py +++ b/sf_warehouse/__manifest__.py @@ -23,7 +23,7 @@ 'web.assets_qweb': [ ], - 'web.assets_backend':[ + 'web.assets_backend': [ # 'sf_warehouse/static/src/js/vanilla-masker.min.js', 'sf_warehouse/static/src/css/kanban_color_change.scss', 'sf_warehouse/static/src/js/custom_kanban_controller.js', diff --git a/sf_warehouse/models/__init__.py b/sf_warehouse/models/__init__.py index 833a0ba1..9186ee3a 100644 --- a/sf_warehouse/models/__init__.py +++ b/sf_warehouse/models/__init__.py @@ -1,2 +1 @@ from . import model - diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 10acb1fa..cfa097ce 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -203,7 +203,8 @@ class SfLocation(models.Model): # def generate_barcode(self, i, j): # # 这里是你生成barcode的代码 # area_type_barcode = self.location_id.barcode - # return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-' + str(j + 1) + # return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-' + # + str(j + 1) class SfProcurementGroup(models.Model): @@ -223,7 +224,8 @@ class SfProcurementGroup(models.Model): res_list = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), order='route_sequence, sequence') for res1 in res_list: - if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \ + res1.location_src_id.product_type: res = res1 if not res: res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), @@ -235,7 +237,8 @@ class SfProcurementGroup(models.Model): res_list = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]), order='route_sequence, sequence') for res1 in res_list: - if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \ + res1.location_src_id.product_type: res = res1 if not res: res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]), @@ -246,7 +249,8 @@ class SfProcurementGroup(models.Model): res_list = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), order='route_sequence, sequence') for res1 in res_list: - if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \ + res1.location_src_id.product_type: res = res1 if not res: res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), @@ -257,7 +261,8 @@ class SfProcurementGroup(models.Model): res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), order='route_sequence, sequence') for res1 in res_list: - if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type: + if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \ + res1.location_src_id.product_type: res = res1 if not res: res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), diff --git a/sf_wxwork_approval/models/model.py b/sf_wxwork_approval/models/model.py index ba1cf15a..9a7e5911 100644 --- a/sf_wxwork_approval/models/model.py +++ b/sf_wxwork_approval/models/model.py @@ -13,8 +13,6 @@ from odoo.http import request from odoo.exceptions import ValidationError from odoo.exceptions import UserError - - _logger = logging.getLogger(__name__) @@ -44,9 +42,3 @@ class WxWorkApproval(models.Model): # ], string='请假类型') # leave_days = fields.Float(string='Leave Days') # overtime_hours = fields.Float(string='Overtime Hours') - - - - - - diff --git a/sf_wxwork_approval/models/wxwork_settings.py b/sf_wxwork_approval/models/wxwork_settings.py index 1be0f354..23592f15 100644 --- a/sf_wxwork_approval/models/wxwork_settings.py +++ b/sf_wxwork_approval/models/wxwork_settings.py @@ -80,7 +80,8 @@ class WxSettings(models.Model): # 'control_type': child_data.get('property', {}).get('control', None), # 'unique_control_id': child_data.get('property', {}).get('id', None), # 'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None), - # 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].get('text', None), + # 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0]. + # get('text', None), # 'require': child_data.get('property', {}).get('require', None), # 'un_print': child_data.get('property', {}).get('un_print', None), # 'un_replace': child_data.get('property', {}).get('un_replace', None), @@ -99,7 +100,8 @@ class WxSettings(models.Model): # 例如: config_id_data = { 'date_type': [(0, 0, {'date_type': child_data.get('config', {}).get('date', {}).get('type', - None)})] if 'date' in child_data.get( + None)})] + if 'date' in child_data.get( 'config', {}) else [], 'selector_type': [(0, 0, { 'selector_type': 'single', @@ -108,26 +110,14 @@ class WxSettings(models.Model): 'contact_type': [ (0, 0, {'contact_type': config_data.get('contact', {}).get('type', None), 'contact_mode': config_data.get('contact', {}).get('mode', - None)})] if 'contact' in child_data.get( + None)})] if 'contact' in + child_data.get( 'config', {}).get('contact', {}) else [], 'file_type': [ (0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo', - None)})] if 'file' in child_data.get( + None)})] if 'file' in + child_data.get( 'config', {}).get('file', {}) else [], - # 'table_type': [(0, 0, { - # 'table_children': [ - # (0, 0, {'control_type': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('control', None), - # 'unique_control_id': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('id', None), - # 'title': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('title', None)[0].get('text', None), - # 'placeholder': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('placeholder', None)[0].get('text', None), - # 'require': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('require', None), - # 'un_print': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_print', None), - # 'un_replace': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_replace', None), - # 'display': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('display', None), - # })], - # })] if 'table' in config_data else [], - # 'attendance_type': [(0, 0, {'attendance_type': '1', - # 'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [], } # 将config_id_data添加到property_data中(如果有的话) @@ -152,16 +142,9 @@ class WxSettings(models.Model): 'display': property_data.get('display', None), })], 'config_id': [(0, 0, { - 'date_type': [(0, 0, {'date_type': config_data.get('date', {}).get('type', - None)})] if 'date' in config_data else [], - # 'selector_type': [(0, 0, { - # 'selector_type': config_data['table']['children'][0].get('config', {}).get( - # 'selector', {}).get('type', None), - # 'options': [ - # (0, 0, {'key': option['key'], 'text': option['value'][0]['text']}) - # for option in config_data['table']['children'][0].get('config', {}).get('selector', {}).get('options', []) - # ], - # })] if 'selector' in config_data else [], + 'date_type': [(0, 0, {'date_type': + config_data.get('date', {}).get( + 'type', None)})] if 'date' in config_data else [], 'selector_type': [ (0, 0, { 'selector_type': child.get('config', {}).get('selector', {}).get('type', None), @@ -177,10 +160,12 @@ class WxSettings(models.Model): 'contact_type': [ (0, 0, {'contact_type': config_data.get('contact', {}).get('type', None), 'contact_mode': config_data.get('contact', {}).get('mode', - None)})] if 'contact' in config_data else [], + None)})] + if 'contact' in config_data else [], 'file_type': [ (0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo', - None)})] if 'file' in config_data else [], + None)})] + if 'file' in config_data else [], 'table_type': [(0, 0, { 'table_children': table_children_records, })] if 'table' in config_data else [], @@ -200,7 +185,8 @@ class WxSettings(models.Model): # # 'title': '文本框2'})] 'attendance_type': [(0, 0, {'attendance_type': '1', - 'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [], + 'attendance_date_range_type': 'hour'})] + if 'attendance' in config_data else [], })], }), # 在这里添加更多的控件数据