diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 03a3678b..a3a9e172 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- -import json -import requests +from datetime import date from odoo import fields, models, api -from odoo.exceptions import ValidationError -from odoo.addons.sf_base.commons.common import Common class CuttingToolMaterial(models.Model): @@ -113,6 +110,24 @@ class CuttingToolModel(models.Model): feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(整体式刀具)') feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(刀片)') material_model_id = fields.Many2one('sf.materials.model', '材料型号') + + @api.onchange('cutting_tool_material_id') + def _get_code(self): + if self.is_cloud is False: + today = date.today().strftime("%Y%m%d") + today_code = 'T-DJWL-%s-%s' % (self.cutting_tool_material_id.code, today) + cutting_tool_model = self.search( + [('code', 'ilike', today_code), ('is_cloud', '=', False), + ('active', 'in', [True, False])], + limit=1, + order="id desc") + if not cutting_tool_model: + num = "%03d" % 1 + else: + m = int(today_code[-3:]) + 1 + num = "%03d" % m + self.code = "%s%s" % (today_code, num) + # 适用夹头型号可以多选 # chuck_ids = fields.Many2many( # 'sf.cutting_tool.standard.library', diff --git a/sf_base/models/tool_other_features.py b/sf_base/models/tool_other_features.py index 7ad32bc2..f67e69fd 100644 --- a/sf_base/models/tool_other_features.py +++ b/sf_base/models/tool_other_features.py @@ -10,6 +10,7 @@ class ToolMaterialsBasicParameters(models.Model): standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库') cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型', store=True) + is_cloud = fields.Boolean(related='standard_library_id.is_cloud', string='云端数据') # 整体式刀具参数 total_length = fields.Float('总长度(mm)') @@ -21,7 +22,7 @@ class ToolMaterialsBasicParameters(models.Model): handle_diameter = fields.Float('柄部直径(mm)') handle_length = fields.Float('柄部长度(mm)') blade_tip_diameter = fields.Integer('刀尖直径(mm)') - blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20) + blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角度)', size=20) blade_tip_taper = fields.Integer('刀尖锥度(°)') blade_diameter = fields.Float('刃部直径(mm)') blade_length = fields.Float('刃部长度(mm)') @@ -37,7 +38,7 @@ class ToolMaterialsBasicParameters(models.Model): cutting_blade_length = fields.Float('切削刃长(mm)') relief_angle = fields.Integer('后角(°)') blade_tip_circular_arc_radius = fields.Char('刀尖圆弧半径(mm)', size=20) - inscribed_circle_diameter = fields.Float('内接圆直径(mm)') + inscribed_circle_diameter = fields.Float('内接圆直径IC/D(mm)') install_aperture_diameter = fields.Float('安装孔直径(mm)') chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')], string='有无断屑槽') @@ -170,8 +171,6 @@ class FeedPerTooth(models.Model): feed_per_tooth = fields.Char('每齿走刀量 (mm/z)', size=20) active = fields.Boolean(string='有效', default=True) - - # @api.depends('product_template_id') # def _compute_product_template_id(self): # if self.product_template_id is not None: diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 9c3bbeb3..92bebe5b 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -72,11 +72,15 @@ access_sf_cutting_speed_group_purchase_director,sf_cutting_speed_group_purchase_ access_sf_cutting_speed_group_sale_director,sf_cutting_speed_group_sale_director,model_sf_cutting_speed,sf_base.group_sale_director,1,1,1,0 access_sf_cutting_speed_group_plan_dispatch,sf_cutting_speed_group_plan_dispatch,model_sf_cutting_speed,sf_base.group_plan_dispatch,1,0,0,0 access_sf_cutting_speed_group_plan_director,sf_cutting_speed_group_plan_director,model_sf_cutting_speed,sf_base.group_plan_director,1,1,1,0 +access_sf_cutting_speed_group_quality_director,sf_cutting_speed_group_quality_director,model_sf_cutting_speed,sf_base.group_quality_director,1,1,1,0 +access_sf_cutting_speed_group_quality,sf_cutting_speed_group_quality,model_sf_cutting_speed,sf_base.group_quality,1,1,1,0 access_sf_feed_per_tooth_group_purchase_director,sf_feed_per_tooth_group_purchase_director,model_sf_feed_per_tooth,sf_base.group_purchase_director,1,1,0,0 access_sf_feed_per_tooth_group_sale_director,sf_feed_per_tooth_group_sale_director,model_sf_feed_per_tooth,sf_base.group_sale_director,1,1,0,0 access_sf_feed_per_tooth_group_plan_dispatch,sf_feed_per_tooth_group_plan_dispatch,model_sf_feed_per_tooth,sf_base.group_plan_dispatch,1,0,0,0 access_sf_feed_per_tooth_group_plan_director,sf_feed_per_tooth_group_plan_director,model_sf_feed_per_tooth,sf_base.group_plan_director,1,1,0,0 access_sf_feed_per_tooth_group_sale_salemanager,sf_feed_per_tooth_group_sale_salemanager,model_sf_feed_per_tooth,sf_base.group_sale_salemanager,1,0,0,0 +access_sf_feed_per_tooth_group_quality,sf_feed_per_tooth_group_quality,model_sf_feed_per_tooth,sf_base.group_quality,1,1,1,0 +access_sf_feed_per_tooth_group_quality_director,sf_feed_per_tooth_group_quality_director,model_sf_feed_per_tooth,sf_base.group_quality_director,1,1,1,0 access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,0 access_sf_feed_per_tooth_admin,sf_feed_per_tooth_admin,model_sf_feed_per_tooth,base.group_system,1,1,1,0 access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,base.group_user,1,1,1,1 @@ -138,9 +142,7 @@ access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_dept access_sf_cutting_width_depth_group_purchase,sf_cutting_width_depth_group_purchase,model_sf_cutting_width_depth,sf_base.group_purchase,1,0,0,0 access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1 access_purchase_order_group_purchase,access_purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0 -access_purchase_order_group_purchase_director,access_purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0 access_purchase_order_line_group_purchase,access_purchase_order_line_group_purchase,purchase.model_purchase_order_line,sf_base.group_purchase,1,1,1,0 -access_purchase_order_line_group_purchase_director,access_purchase_order_line_group_purchase_director,purchase.model_purchase_order_line,sf_base.group_purchase_director,1,1,1,0 access_spindle_taper_type,spindle_taper_type,model_spindle_taper_type,base.group_user,1,1,1,1 access_sf_tool_groups_group_plan_dispatch,sf_tool_groups,model_sf_tool_groups,sf_base.group_plan_dispatch,1,0,0,0 access_sf_tool_groups_group_sf_tool_user,sf_tool_groups,model_sf_tool_groups,sf_base.group_sf_tool_user,1,1,1,1 diff --git a/sf_base/views/tool_basic_param.xml b/sf_base/views/tool_basic_param.xml index 616905ca..57a4a9a4 100644 --- a/sf_base/views/tool_basic_param.xml +++ b/sf_base/views/tool_basic_param.xml @@ -1,132 +1,302 @@ - - - sf.tool.materials.basic.parameters.tree - sf.tool.materials.basic.parameters - - - - - - - - - - - - - - - - - - - - - + + + sf.tool.materials.basic.parameters.tree + sf.tool.materials.basic.parameters + + + + + + + + + + + + + + + + + + + + + - - sf.tool.materials.basic.parameters.tree - sf.tool.materials.basic.parameters - - - - - - - - - - - - - - - - - - - - - - - - + + sf.tool.materials.basic.parameters.tree + sf.tool.materials.basic.parameters + + + + + + + + + + + + + + + + + + + + + + + + - sf.tool.materials.basic.parameters.tree - sf.tool.materials.basic.parameters - - - - - - - - - - - - - - - - - - - - - - + sf.tool.materials.basic.parameters.tree + sf.tool.materials.basic.parameters + + + + + + + + + + + + + + + + + + + + + + - sf.tool.materials.basic.parameters.tree - sf.tool.materials.basic.parameters - - - - - - - - - - - - - - - - - - - - - + sf.tool.materials.basic.parameters.tree + sf.tool.materials.basic.parameters + + + + + + + + + + + + + + + + + + + + + - - sf.tool.materials.basic.parameters.search - sf.tool.materials.basic.parameters - - - - - - + + sf.tool.materials.basic.parameters.search + sf.tool.materials.basic.parameters + + + + + + - - 基础参数 - sf.tool.materials.basic.parameters - tree + + sf.tool.materials.basic.parameters.form + sf.tool.materials.basic.parameters + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - [] - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + 基础参数 + sf.tool.materials.basic.parameters + form + {'default_cutting_tool_type': cutting_tool_type} + [] + +
diff --git a/sf_base/views/tool_menu.xml b/sf_base/views/tool_menu.xml index 82ecca18..506a73df 100644 --- a/sf_base/views/tool_menu.xml +++ b/sf_base/views/tool_menu.xml @@ -21,6 +21,7 @@ 刀具标准库 ir.actions.act_window sf.cutting_tool.standard.library + tree,form diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index d1c0c510..aa0e01da 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -123,19 +123,19 @@
+ options="{'zoom': true, 'preview_image':'image_128'}" required="1"/>

- +

- - - - + + + +