新增sf的刀具模板的相关刀具物料字段
This commit is contained in:
@@ -304,33 +304,6 @@ class MachineToolType(models.Model):
|
||||
code = fields.Char('编码')
|
||||
|
||||
|
||||
# 刀具
|
||||
class CuttingTool(models.Model):
|
||||
_name = 'sf.cutting_tool.category'
|
||||
_description = '刀具类别'
|
||||
code = fields.Char('编码')
|
||||
name = fields.Char('名称')
|
||||
remark = fields.Text('备注')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
|
||||
class CuttingToolType(models.Model):
|
||||
_name = 'sf.cutting_tool.type'
|
||||
_description = '刀具型号'
|
||||
code = fields.Char('编码')
|
||||
name = fields.Char('名称')
|
||||
diameter = fields.Integer('直径')
|
||||
long_blade = fields.Integer('避空长/刃长')
|
||||
cone_angle_pitch = fields.Integer('锥角/节距')
|
||||
shank_diameter = fields.Integer('柄径')
|
||||
taper_shank_length = fields.Integer('锥柄长')
|
||||
tool_length = fields.Integer('刀具总长')
|
||||
blade_number = fields.Integer('刃数')
|
||||
category_id = fields.Many2one('sf.cutting_tool.category', string='刀具类别')
|
||||
brand_id = fields.Many2one('sf.machine.brand', string='品牌')
|
||||
remark = fields.Text('备注')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
class MachineToolCategory(models.Model):
|
||||
_name = 'sf.machine_tool.category'
|
||||
_description = '机床类型'
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sf_machine_tool,sf_machine_tool,model_sf_machine_tool,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_category,sf_cutting_tool_category,model_sf_cutting_tool_category,base.group_user,1,1,1,1
|
||||
access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,base.group_user,1,1,1,1
|
||||
access_sf_machine_brand,sf_machine_brand,model_sf_machine_brand,base.group_user,1,1,1,1
|
||||
access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,base.group_user,1,1,1,1
|
||||
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -255,156 +255,6 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
#------------------刀具型号------------------
|
||||
|
||||
<record model="ir.ui.view" id="search_sf_cutting_tool_type_view">
|
||||
<field name="name">search.sf.cutting_tool.type</field>
|
||||
<field name="model">sf.cutting_tool.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="刀具型号">
|
||||
<field name="name" string="模糊搜索"
|
||||
filter_domain="['|',('name', 'ilike', self),('code', 'ilike', self)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_cutting_tool_type_view">
|
||||
<field name="name">tree.sf.cutting_tool.type</field>
|
||||
<field name="model">sf.cutting_tool.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="刀具型号">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="form_sf_cutting_tool_type">
|
||||
<field name="name">form.sf.cutting_tool.type</field>
|
||||
<field name="model">sf.cutting_tool.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="刀具型号">
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
<field name="code" force_save="1" readonly="1"/>
|
||||
<field name="category_id" string="类别" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="brand_id" required="1"
|
||||
domain="[('tag_ids', '=', '机床')]"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="刀具参数">
|
||||
<group>
|
||||
<field name="taper_shank_length" required="1" options="{'format': false}"/>
|
||||
<field name="long_blade" required="1" options="{'format': false}"/>
|
||||
<field name="tool_length" required="1" options="{'format': false}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="diameter" required="1" options="{'format': false}"/>
|
||||
<field name="shank_diameter" required="1" options="{'format': false}"/>
|
||||
<field name="cone_angle_pitch" required="1" options="{'format': false}"/>
|
||||
<field name="blade_number" required="1" options="{'format': false}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="其它">
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_cutting_tool_type" model="ir.actions.act_window">
|
||||
<field name="name">刀具型号</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting_tool.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
[刀具型号] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#------------------刀具类别------------------
|
||||
|
||||
<record model="ir.ui.view" id="search_sf_cutting_tool_category_view">
|
||||
<field name="name">search.sf.cutting_tool.category</field>
|
||||
<field name="model">sf.cutting_tool.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="刀具类别">
|
||||
<field name="name" string="模糊搜索"
|
||||
filter_domain="['|',('name', 'ilike', self),('remark', 'ilike', self)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_sf_cutting_tool_category_view">
|
||||
<field name="name">tree.sf.cutting_tool.category</field>
|
||||
<field name="model">sf.cutting_tool.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="刀具类别">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_cutting_tool_category_form">
|
||||
<field name="name">form.sf.cutting_tool.category</field>
|
||||
<field name="model">sf.cutting_tool.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="刀具类别">
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
<field name="code" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<!-- <group string="参数">-->
|
||||
<!-- <field name="type_ids" string="刀具型号">-->
|
||||
<!-- <tree editable="bottom">-->
|
||||
<!-- <field name="category_id" invisible="True"/>-->
|
||||
<!-- <field name="code" string="编码" required="True"/>-->
|
||||
<!-- <field name="name" string="名称" required="True"/>-->
|
||||
<!-- <field name="diameter" string="直径" required="True"/>-->
|
||||
<!-- <field name="long_blade" string="避空长/刃长" required="True"/>-->
|
||||
<!-- <field name="cone_angle_pitch" string="锥角/节距" required="True"/>-->
|
||||
<!-- <field name="shank_diameter" string="柄径" required="True"/>-->
|
||||
<!-- <field name="taper_shank_length" string="锥柄" required="True"/>-->
|
||||
<!-- <field name="tool_length" string="刀具总长" required="True"/>-->
|
||||
<!-- <field name="blade_number" string="刃数" required="True"/>-->
|
||||
<!-- <field name="remark" string="备注"/>-->
|
||||
<!-- <field name="active" string="有效"/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </group>-->
|
||||
<group string="其它">
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_cutting_tool_category" model="ir.actions.act_window">
|
||||
<field name="name">刀具类别</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting_tool.category</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
[刀具类别] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#------------------机床注册------------------
|
||||
|
||||
|
||||
@@ -127,26 +127,6 @@
|
||||
sequence="1"
|
||||
action="action_sf_machine_tool_category"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_cutting_tool"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
name="刀具"
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_cutting_tool_category"
|
||||
parent="menu_sf_cutting_tool"
|
||||
name="刀具类别"
|
||||
sequence="1"
|
||||
action="action_sf_cutting_tool_category"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_cutting_tool_type"
|
||||
parent="menu_sf_cutting_tool"
|
||||
name="刀具型号"
|
||||
sequence="1"
|
||||
action="action_sf_cutting_tool_type"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_machine_control_system"
|
||||
parent="menu_sf_base"
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['mrp', 'base', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock',
|
||||
'depends': ['mrp', 'base', 'sale', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock',
|
||||
'uom'],
|
||||
'data': [
|
||||
'data/product_data.xml',
|
||||
'data/uom_data.xml',
|
||||
# 'views/product_template_view.xml',
|
||||
# 'views/product_workorder.xml'
|
||||
'data/cutting_tool_data.xml',
|
||||
'views/product_template_view.xml',
|
||||
'views/product_workorder.xml'
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
|
||||
30
sf_dlm/data/cutting_tool_data.xml
Normal file
30
sf_dlm/data/cutting_tool_data.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="product_category_cutting_tool_sf" model="product.category">
|
||||
<field name="name">刀具</field>
|
||||
<field name="type">刀具</field>
|
||||
</record>
|
||||
|
||||
<record id="product_category_clamp_sf" model="product.category">
|
||||
<field name="name">夹具</field>
|
||||
<field name="type">夹具</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_cutting_tool_sf" model="product.product">
|
||||
<field name="name">刀具标准模板</field>
|
||||
<field name="active" eval="False"/>
|
||||
<field name="categ_id" ref="product_category_cutting_tool_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ ref('purchase_stock.route_warehouse0_buy')]"/>
|
||||
<!-- <field name="invoice_policy">delivery</field>-->
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">true</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="tracking">serial</field>
|
||||
<!-- <field name="is_bfm">false</field>-->
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -20,21 +20,32 @@
|
||||
<field name="type">表面工艺</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- <record id="product_category_cutting_tool_sf" model="product.category">-->
|
||||
<!-- <field name="name">刀具</field>-->
|
||||
<!-- <field name="type">刀具</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record id="product_category_clamp_sf" model="product.category">-->
|
||||
<!-- <field name="name">夹具</field>-->
|
||||
<!-- <field name="type">夹具</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="product_template_sf" model="product.product">
|
||||
<field name="name">CNC加工产品模板</field>
|
||||
<field name="active" eval="False"/>
|
||||
<field name="categ_id" ref="product_category_finished_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ref('stock.route_warehouse0_mto'), ref('mrp.route_warehouse0_manufacture')]"/>
|
||||
<field name="invoice_policy">delivery</field>
|
||||
<!-- <field name="invoice_policy">delivery</field>-->
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">false</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="single_manufacturing">true</field>
|
||||
<!-- <field name="single_manufacturing">true</field>-->
|
||||
<field name="tracking">serial</field>
|
||||
<field name="is_bfm">false</field>
|
||||
<!-- <field name="is_bfm">false</field>-->
|
||||
</record>
|
||||
<record id="product_embryo_sf_self_machining" model="product.product">
|
||||
<field name="name">坯料自加工模板</field>
|
||||
@@ -42,15 +53,15 @@
|
||||
<field name="categ_id" ref="product_category_embryo_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ref('stock.route_warehouse0_mto'), ref('mrp.route_warehouse0_manufacture')]"/>
|
||||
<field name="invoice_policy">delivery</field>
|
||||
<!-- <field name="invoice_policy">delivery</field>-->
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">false</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="single_manufacturing">true</field>
|
||||
<!-- <field name="single_manufacturing">true</field>-->
|
||||
<field name="tracking">serial</field>
|
||||
<field name="is_bfm">false</field>
|
||||
<!-- <field name="is_bfm">false</field>-->
|
||||
</record>
|
||||
|
||||
<record id="product_embryo_sf_outsource" model="product.product">
|
||||
@@ -59,14 +70,14 @@
|
||||
<field name="categ_id" ref="product_category_embryo_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ref('stock.route_warehouse0_mto'), ref('purchase_stock.route_warehouse0_buy'),ref('mrp_subcontracting.route_resupply_subcontractor_mto')]"/>
|
||||
<field name="invoice_policy">delivery</field>
|
||||
<!-- <field name="invoice_policy">delivery</field>-->
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">true</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="tracking">serial</field>
|
||||
<field name="is_bfm">false</field>
|
||||
<!-- <field name="is_bfm">false</field>-->
|
||||
</record>
|
||||
<record id="product_embryo_sf_purchase" model="product.product">
|
||||
<field name="name">坯料采购模板</field>
|
||||
@@ -74,14 +85,14 @@
|
||||
<field name="categ_id" ref="product_category_embryo_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ref('stock.route_warehouse0_mto'), ref('purchase_stock.route_warehouse0_buy')]"/>
|
||||
<field name="invoice_policy">delivery</field>
|
||||
<!-- <field name="invoice_policy">delivery</field>-->
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">true</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="tracking">serial</field>
|
||||
<field name="is_bfm">false</field>
|
||||
<!-- <field name="is_bfm">false</field>-->
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,6 +1,5 @@
|
||||
from. import product_template
|
||||
from. import product_supplierinfo
|
||||
from. import product_workorder
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
|
||||
<field name="name">product.template.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- <field name="image_1920" position="replace">-->
|
||||
<!-- <field name='categ_type' invisible="1"/>-->
|
||||
<!-- <field name="upload_model_file" required="True"-->
|
||||
<!-- widget='many2many_binary'/>-->
|
||||
<!-- </field>-->
|
||||
<field name="detailed_type" position="before">
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name="upload_model_file"
|
||||
@@ -20,6 +15,7 @@
|
||||
attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/>
|
||||
</field>
|
||||
<field name="invoice_policy" position="after">
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name="embryo_model_type_id" string="模型类型"
|
||||
attrs="{'invisible': ['|',('categ_type', '!=', '坯料'),('categ_type', '=', False)]}"/>
|
||||
<field name="materials_id" string="材料" attrs="{'invisible': [('categ_type', '=', '表面工艺')]}"/>
|
||||
@@ -77,6 +73,56 @@
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[last()-1]" position="after">
|
||||
<page string="刀具物料参数">
|
||||
<group>
|
||||
<group>
|
||||
<div>
|
||||
<field name="cutting_tool_parameter_brand"/>
|
||||
<field name="cutting_tool_parameter_total_length"/>
|
||||
<field name="cutting_tool_parameter_shank_length"/>
|
||||
<field name="cutting_tool_parameter_blade_length"/>
|
||||
<field name="cutting_tool_parameter_diameter"/>
|
||||
<field name="cutting_tool_parameter_blade_number"/>
|
||||
<field name="cutting_tool_parameter_front_angle"/>
|
||||
<field name="cutting_tool_parameter_rear_angle"/>
|
||||
<field name="cutting_tool_parameter_main_included_angle"/>
|
||||
<field name="cutting_tool_parameter_material_model"/>
|
||||
<field name="cutting_tool_parameter_nut"/>
|
||||
<field name="cutting_tool_parameter_chuck_model"/>
|
||||
<field name="cutting_tool_parameter_scope"/>
|
||||
<field name="cutting_tool_parameter_image"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="cutting_tool_parameter_length"/>
|
||||
<field name="cutting_tool_parameter_width"/>
|
||||
<field name="cutting_tool_parameter_height"/>
|
||||
<field name="cutting_tool_parameter_top_angle"/>
|
||||
<field name="cutting_tool_parameter_hardness"/>
|
||||
<field name="cutting_tool_parameter_cutter_bar"/>
|
||||
<field name="cutting_tool_parameter_cutter_pad"/>
|
||||
<field name="cutting_tool_parameter_radius"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="cutting_tool_parameter_c_diameter"/>
|
||||
<field name="cutting_tool_parameter_total_length"/>
|
||||
<field name="cutting_tool_parameter_d_diameter"/>
|
||||
<field name="cutting_tool_parameter_blade"/>
|
||||
<field name="cutting_tool_parameter_wrench"/>
|
||||
<field name="cutting_tool_parameter_screw"/>
|
||||
<field name="cutting_tool_parameter_hardness"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="cutting_tool_parameter_accuracy"/>
|
||||
<field name="cutting_tool_parameter_diameter"/>
|
||||
<field name="cutting_tool_parameter_inner_diameter"/>
|
||||
<field name="cutting_tool_parameter_handle_model"/>
|
||||
<field name="cutting_tool_parameter_feature"/>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ from . import mrp_maintenance
|
||||
from . import mrp_routing_workcenter
|
||||
from . import mrp_workorder
|
||||
from . import model_type
|
||||
from . import product_template
|
||||
from . import product_workorder
|
||||
from . import stock
|
||||
from . import res_user
|
||||
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
|
||||
type = fields.Selection(
|
||||
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
|
||||
("夹具", "夹具")],
|
||||
default="", string="类型")
|
||||
|
||||
#
|
||||
# class ResProductTemplateCateg(models.Model):
|
||||
# _inherit = 'product.template'
|
||||
#
|
||||
# categ_type = fields.Selection(
|
||||
# [("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
|
||||
# ("夹具", "夹具")],
|
||||
# string='产品的类别', related='categ_id.type',
|
||||
# store=True)
|
||||
|
||||
|
||||
class ModelType(models.Model):
|
||||
_name = 'sf.model.type'
|
||||
_description = '模型类型'
|
||||
@@ -82,5 +101,6 @@ class SurfaceTechnicsModelTypeRoutingSort(models.Model):
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
'route_model_type_uniq', 'unique (route_workcenter_id,surface_technics_model_type_id)', '表面工艺工序不能重复!')
|
||||
'route_model_type_uniq', 'unique (route_workcenter_id,surface_technics_model_type_id)',
|
||||
'表面工艺工序不能重复!')
|
||||
]
|
||||
|
||||
@@ -15,7 +15,8 @@ class ResProductTemplate(models.Model):
|
||||
# 模型的长,宽,高,体积,精度,材料
|
||||
model_name = fields.Char('模型名称')
|
||||
categ_type = fields.Selection(
|
||||
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺")],
|
||||
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
|
||||
("夹具", "夹具")],
|
||||
string='产品的类别', related='categ_id.type',
|
||||
store=True)
|
||||
model_long = fields.Float('模型长[mm]', digits=(16, 3))
|
||||
@@ -49,6 +50,58 @@ class ResProductTemplate(models.Model):
|
||||
model_code = fields.Char('模型编码')
|
||||
is_bfm = fields.Boolean('业务平台是否自动创建', default=False)
|
||||
|
||||
cutting_tool_parameter_brand = fields.Many2one('sf.machine.brand', '品牌')
|
||||
# 整体式刀具参数
|
||||
cutting_tool_parameter_total_length = fields.Float('总长度(mm)')
|
||||
cutting_tool_parameter_shank_length = fields.Float('柄部长度(mm)')
|
||||
cutting_tool_parameter_blade_length = fields.Float('刃部长度(mm)')
|
||||
cutting_tool_parameter_diameter = fields.Float('直径(mm)')
|
||||
cutting_tool_parameter_blade_number = fields.Integer('刃数')
|
||||
cutting_tool_parameter_front_angle = fields.Float('前角(°)')
|
||||
cutting_tool_parameter_rear_angle = fields.Float('后角(°)')
|
||||
cutting_tool_parameter_main_included_angle = fields.Float('主偏角(°)')
|
||||
cutting_tool_parameter_material_model = fields.Many2one('sf.materials.model', '材料型号')
|
||||
cutting_tool_parameter_nut = fields.Float('配对螺母(mm)')
|
||||
# 适用夹头型号可以多选
|
||||
cutting_tool_parameter_chuck_model = fields.Many2many('sf.chuck', string='适用夹头型号')
|
||||
cutting_tool_parameter_scope = fields.Char('适用范围')
|
||||
cutting_tool_parameter_image = fields.Binary('图片')
|
||||
# 刀片参数
|
||||
cutting_tool_parameter_length = fields.Float('长度L(mm)')
|
||||
cutting_tool_parameter_width = fields.Float('宽度D(mm)')
|
||||
cutting_tool_parameter_height = fields.Float('高度T(mm)')
|
||||
cutting_tool_parameter_top_angle = fields.Float('顶角(°)')
|
||||
cutting_tool_parameter_top_angle = fields.Float('R角(°)')
|
||||
cutting_tool_parameter_hardness = fields.Char('加工硬度')
|
||||
cutting_tool_parameter_cutter_bar = fields.Many2many('sf.cutter.bar', string='适用刀杆型号')
|
||||
cutting_tool_parameter_cutter_pad = fields.Many2many('sf.cutter.pad', string='适用刀盘型号')
|
||||
cutting_tool_parameter_radius = fields.Float('刀尖半径(mm)')
|
||||
# 刀杆/刀盘参数
|
||||
cutting_tool_parameter_c_diameter = fields.Float('C柄径(mm)')
|
||||
cutting_tool_parameter_total_length = fields.Float('L总长(mm)')
|
||||
cutting_tool_parameter_d_diameter = fields.Float('D刃径(mm)')
|
||||
cutting_tool_parameter_blade = fields.Many2many('sf.blade', string='适用刀片型号')
|
||||
cutting_tool_parameter_wrench = fields.Float('配对扳手(mm)')
|
||||
cutting_tool_parameter_screw = fields.Float('配备螺丝(mm)')
|
||||
cutting_tool_parameter_accuracy = fields.Char('精度等级')
|
||||
cutting_tool_parameter_hardness = fields.Char('硬度(°)')
|
||||
# 刀柄参数
|
||||
cutting_tool_parameter_handle_length = fields.Float('L(mm)')
|
||||
cutting_tool_parameter_length1 = fields.Float('L1(mm)')
|
||||
cutting_tool_parameter_diameter1 = fields.Float('D1(mm)')
|
||||
cutting_tool_parameter_weight = fields.Float('重量(kg)')
|
||||
cutting_tool_parameter_body_accuracy = fields.Float('本体精度(mm)')
|
||||
cutting_tool_parameter_clamping_range = fields.Float('夹持范围(mm)')
|
||||
cutting_tool_parameter_detection_accuracy = fields.Float('检测精度')
|
||||
cutting_tool_parameter_detection_hardness = fields.Char('检测硬度')
|
||||
cutting_tool_parameter_standard_speed = fields.Float('标准转速')
|
||||
# 夹头参数
|
||||
cutting_tool_parameter_accuracy = fields.Float('精度(mm)')
|
||||
cutting_tool_parameter_diameter = fields.Float('外径(mm)')
|
||||
cutting_tool_parameter_inner_diameter = fields.Float('内径(mm)')
|
||||
cutting_tool_parameter_handle_model = fields.Many2many('sf.handle.model', string='适用刀柄型号')
|
||||
cutting_tool_parameter_feature = fields.Char('特性')
|
||||
|
||||
def _get_volume_uom_id_from_ir_config_parameter(self):
|
||||
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
|
||||
if product_length_in_feet_param == '1':
|
||||
@@ -341,12 +394,7 @@ class ResMrpBom(models.Model):
|
||||
return raw_bom
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
|
||||
type = fields.Selection(
|
||||
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺")],
|
||||
default="", string="类型")
|
||||
|
||||
# @api.constrains('type')
|
||||
# def _check_type(self):
|
||||
12
sf_manufacturing/models/product_workorder.py
Normal file
12
sf_manufacturing/models/product_workorder.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResMrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
_order = 'sequence'
|
||||
|
||||
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True, check_company=True, string="坯料长度(mm)")
|
||||
product_tmpl_id_width = fields.Float(related='production_id.product_tmpl_id.width', readonly=True, store=True, check_company=True, string="坯料宽度(mm)")
|
||||
product_tmpl_id_height = fields.Float(related='production_id.product_tmpl_id.height', readonly=True, store=True, check_company=True, string="坯料高度(mm)")
|
||||
product_tmpl_id_materials_id = fields.Many2one(related='production_id.product_tmpl_id.materials_id', readonly=True, store=True, check_company=True, string="材料")
|
||||
product_tmpl_id_materials_type_id = fields.Many2one(related='production_id.product_tmpl_id.materials_type_id', readonly=True, store=True, check_company=True, string="型号")
|
||||
@@ -99,28 +99,6 @@
|
||||
<field name="doall" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="sf_cron10">
|
||||
<field name="name">同步资源库刀具类别</field>
|
||||
<field name="model_id" ref="model_sf_cutting_tool_category"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.sync_cutting_tool_category()</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="sf_cron11">
|
||||
<field name="name">同步资源库刀具型号</field>
|
||||
<field name="model_id" ref="model_sf_cutting_tool_type"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.sync_cutting_tool_type()</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="sf_cron12">
|
||||
<field name="name">同步资源库工序</field>
|
||||
<field name="model_id" ref="model_sf_processing_order"/>
|
||||
|
||||
@@ -40,10 +40,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
_logger.info("同步资源库机床型号")
|
||||
self.env['sf.machine_tool.category'].sync_all_machine_tool_category()
|
||||
_logger.info("同步资源库机床类型")
|
||||
self.env['sf.cutting_tool.category'].sync_all_cutting_tool_category()
|
||||
_logger.info("同步资源库刀具类别")
|
||||
self.env['sf.cutting_tool.type'].sync_all_cutting_tool_type()
|
||||
_logger.info("同步资源库刀具")
|
||||
# self.env['sf.production.process.parameter'].sync_all_production_process_parameter()
|
||||
# _logger.info("同步表面工艺参数")
|
||||
_logger.info("定时同步每日功能刀具类型列表...")
|
||||
|
||||
@@ -883,168 +883,6 @@ class MachineToolType(models.Model):
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
|
||||
class CuttingTool(models.Model):
|
||||
_inherit = 'sf.cutting_tool.category'
|
||||
_description = '刀具类别'
|
||||
url = '/api/cutting_tool_category/list'
|
||||
|
||||
# 定时同步刀具类别
|
||||
def sync_cutting_tool_category(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
|
||||
strUrl = sf_sync_config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_category_yesterday_list']:
|
||||
brand = self.env['sf.cutting_tool.category'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if brand:
|
||||
brand.id = item['id'],
|
||||
brand.name = item['name'],
|
||||
brand.code = item['code'],
|
||||
brand.active = item['active'],
|
||||
brand.remark = item['remark']
|
||||
else:
|
||||
self.env['sf.cutting_tool.category'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
# 同步所有刀具类别
|
||||
def sync_all_cutting_tool_category(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
|
||||
strUrl = sf_sync_config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_category_all_list']:
|
||||
brand = self.env['sf.cutting_tool.category'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['sf.cutting_tool.category'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
|
||||
class CuttingToolType(models.Model):
|
||||
_inherit = 'sf.cutting_tool.type'
|
||||
_description = '刀具型号'
|
||||
url = '/api/cutting_tool_type/list'
|
||||
|
||||
# 定时同步刀具型号
|
||||
def sync_cutting_tool_type(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
|
||||
strUrl = sf_sync_config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_type_yesterday_list']:
|
||||
brand = self.env['sf.cutting_tool.type'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if brand:
|
||||
brand.id = item['id'],
|
||||
brand.name = item['name'],
|
||||
brand.code = item['code'],
|
||||
brand.active = item['active'],
|
||||
brand.remark = item['remark'],
|
||||
brand.diameter = item['diameter'],
|
||||
brand.cone_angle_pitch = item['cone_angle_pitch'],
|
||||
brand.shank_diameter = item['shank_diameter'],
|
||||
brand.long_blade = item['long_blade'],
|
||||
brand.taper_shank_length = item['taper_shank_length'],
|
||||
brand.tool_length = item['tool_length'],
|
||||
brand.blade_number = item['blade_number']
|
||||
brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
brand.category_id = self.env['sf.cutting_tool.category'].search(
|
||||
[('code', '=', item['category_id'])]).id
|
||||
else:
|
||||
self.env['sf.cutting_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"remark": item['remark'],
|
||||
"code": item['code'],
|
||||
"active": item['active'],
|
||||
"diameter": item['diameter'],
|
||||
"cone_angle_pitch": item['cone_angle_pitch'],
|
||||
"shank_diameter": item['shank_diameter'],
|
||||
"long_blade": item['long_blade'],
|
||||
"taper_shank_length": item['taper_shank_length'],
|
||||
"tool_length": item['tool_length'],
|
||||
"blade_number": item['blade_number'],
|
||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"category_id": self.env['sf.cutting_tool.category'].search(
|
||||
[('code', '=', item['category_id'])]).id,
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
# 同步所有刀具型号
|
||||
def sync_all_cutting_tool_type(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
|
||||
strUrl = sf_sync_config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_type_all_list']:
|
||||
brand = self.env['sf.cutting_tool.type'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['sf.cutting_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"remark": item['remark'],
|
||||
"code": item['code'],
|
||||
"active": item['active'],
|
||||
"diameter": item['diameter'],
|
||||
"cone_angle_pitch": item['cone_angle_pitch'],
|
||||
"shank_diameter": item['shank_diameter'],
|
||||
"long_blade": item['long_blade'],
|
||||
"taper_shank_length": item['taper_shank_length'],
|
||||
"tool_length": item['tool_length'],
|
||||
"blade_number": item['blade_number'],
|
||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"category_id": self.env['sf.cutting_tool.category'].search(
|
||||
[('code', '=', item['category_id'])]).id,
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
|
||||
class sfProcessingOrder(models.Model):
|
||||
_inherit = 'sf.processing.order'
|
||||
_description = '工序'
|
||||
|
||||
Reference in New Issue
Block a user