解决冲突

This commit is contained in:
胡尧
2024-10-15 15:25:31 +08:00
31 changed files with 891 additions and 436 deletions

View File

@@ -108,6 +108,10 @@ td.o_required_modifier {
}
.color_3 {
background-color: #808080;
}
.color_4 {
background-color: rgb(255, 150, 0);
}

View File

@@ -1033,7 +1033,7 @@
name="Overview"
action="quality_alert_team_action"
parent="menu_quality_root"
sequence="5"/>
sequence="5" active="False"/>
<menuitem
id="menu_quality_control"

View File

@@ -217,7 +217,7 @@ class Machine_ftp(models.Model):
status = fields.Boolean('机床在线状态', readonly=True)
# run_status = fields.Selection([('0', '空闲中'), ('1', '加工中'), ('2', '加工中'), ('3', '加工中')], string='机床运行状态',
# readonly=True, default='0')
run_status = fields.Char('机床运行状态', readonly=True)
# run_status = fields.Char('机床运行状态', readonly=True)
run_time = fields.Char('机床累计运行时长', readonly=True)
# 机床系统日期
system_date = fields.Char('机床系统日期', readonly=True)

View File

@@ -38,6 +38,8 @@ class SfMaintenanceEquipment(models.Model):
crea_url = "/api/machine_tool/create"
run_status = fields.Char('机床运行状态', readonly=True)
# AGV运行日志
agv_logs = fields.One2many('maintenance.equipment.agv.log', 'equipment_id', string='AGV运行日志')
# 1212修改后的字段

View File

@@ -1142,14 +1142,16 @@
</div>
<div class="show_state" t-attf-class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record oe_kanban_card oe_kanban_global_click
">
<div t-attf-class="#{record.state.raw_value == '正常' ? 'color_1' : ''}"></div>
<div t-attf-class="#{record.state.raw_value == '故障' ? 'color_2' : ''}"></div>
<div t-attf-class="#{record.state.raw_value == '不可用' ? 'color_3' : ''}"></div>
<div t-attf-class="#{record.run_status.raw_value == '运行中' ? 'color_1' : ''}"></div>
<div t-attf-class="#{record.run_status.raw_value == '待机' ? 'color_4' : ''}"></div>
<div t-attf-class="#{record.run_status.raw_value == '故障' ? 'color_2' : ''}"></div>
<div t-attf-class="#{record.run_status.raw_value == '离线' ? 'color_3' : ''}"></div>
<p class="o_kanban_record_bottom state_zc"
t-attf-class="#{record.state.raw_value == '正常' ? 'font_color_1' : ''}
#{record.state.raw_value == '故障' ? 'font_color_2' : ''}
#{record.state.raw_value == '不可用' ? 'font_color_3' : ''}">
<field name="state"/>
t-attf-class="#{record.run_status.raw_value == '运行中' ? 'font_color_1' : ''}
#{record.run_status.raw_value == '待机' ? 'font_color_4' : ''}
#{record.run_status.raw_value == '故障' ? 'font_color_2' : ''}
#{record.run_status.raw_value == '离线' ? 'font_color_3' : ''}">
<field name="run_status"/>
</p>
</div>
</div>

View File

@@ -596,14 +596,6 @@ class Manufacturing_Connect(http.Controller):
if panel_workorder:
panel_workorder.write({'production_line_state': '已下产线'})
workorder.write({'state': 'to be detected'})
# workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
# [
# ('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
# ('production_id', '=', order.production_id.id),
# ('workorder_id', '=', order.id),
# ('workorder_state', '=', 'done')])
# if workpiece_delivery:
# delivery_Arr.append(workpiece_delivery.id)
else:
res = {'Succeed': False, 'ErrorCode': 204,
'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']}

View File

@@ -59,7 +59,7 @@ class ResMrpWorkOrder(models.Model):
compute='_compute_state', store=True,
default='pending', copy=False, readonly=True, recursive=True, index=True, tracking=True)
# state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')], tracking=True)
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效')
@api.depends('production_id.manual_quotation')
def _compute_manual_quotation(self):

View File

@@ -351,8 +351,11 @@
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="default_order">sequence</attribute>
<attribute name="decoration-warning">delivery_warning == 'warning'</attribute>
<attribute name="decoration-danger">delivery_warning == 'overdue'</attribute>
</xpath>
<xpath expr="//field[@name='state']" position="replace">
<field name="delivery_warning" invisible="True"/>
<field name="state" widget="badge" decoration-warning="state == 'progress'"
decoration-success="state == 'done'" decoration-danger="state in ('cancel','rework')"
decoration-muted="state == 'to be detected'"

View File

@@ -101,7 +101,9 @@
<!-- <field name="target">fullscreen</field>-->
<field name="target">current</field>
<field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>
<field name="context">{'search_default_product': 1, 'search_default_workcenter_id': active_id}</field>
<field name="context">{'search_default_product': 1, 'search_default_workcenter_id':
active_id,'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1}
</field>
<field name="help" type="html">
<p class="o_view_nocontent_workorder">
没有工单要做!
@@ -221,15 +223,52 @@
</page>
</xpath>
<xpath expr="//label[1]" position="before">
<field name='routing_type' readonly="1"/>
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<!-- -->
<field name="production_id" invisible="0"/>
<field name="duration_expected" invisible="1"/>
<field name="date_planned_start" invisible="1"/>
<field name="date_planned_finished" invisible="1"/>
<field name="duration" widget="mrp_timer"
invisible="1" sum="real duration"/>
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
<field name="manual_quotation" readonly="1"
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
<field name="processing_panel" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="equipment_id" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割","装夹预调"))]}'/>
<field name="production_line_id"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割","装夹预调"))]}'/>
<field name="production_line_state" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割","装夹预调"))]}'/>
<field name='routing_type' invisible="1"/>
<field name='process_state' invisible="1"/>
<field name='tag_type' readonly="1" attrs='{"invisible": [("tag_type","=",False)]}'
decoration-danger="tag_type == '重新加工'"/>
<field name="rfid_code" force_save="1" readonly="1" cache="True"
<field name="rfid_code" force_save="1" readonly="0" cache="True"
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
</xpath>
<xpath expr="//form//sheet//group//group//div[2]" position="replace">
</xpath>
<xpath expr="//form//sheet//group//group//div[1]" position="after">
<field name="save_name" widget="CopyClipboardChar"
attrs="{'invisible':[('routing_type','!=','装夹预调')]}"/>
<label for="material_length" string="物料尺寸"/>
<div class="o_address_format">
<label for="material_length" string="长"/>
<field name="material_length" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="material_width" string="宽"/>
<field name="material_width" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="material_height" string="高"/>
<field name="material_height" class="o_address_zip"/>
</div>
<field name="part_number" string="成品的零件图号"/>
</xpath>
<xpath expr="//label[1]" position="attributes">
<attribute name="string">计划加工时间</attribute>
</xpath>
@@ -246,76 +285,12 @@
<field name='materiel_width' string="宽"/>
<field name='materiel_height' string="高"/>
</xpath>
<field name="production_id" position="after" invisible="0">
<group>
<field name="date_planned_start" invisible="1"/>
<field name="date_planned_finished" invisible="1"/>
<!-- <field name="production_id" readonly="1"/>-->
<field name="duration" widget="mrp_timer"
attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"
sum="real duration"/>
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
<field name="manual_quotation" readonly="1"
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
<field name="processing_panel" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="equipment_id" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割","装夹预调"))]}'/>
<field name="production_line_id"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="production_line_state" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割","装夹预调"))]}'/>
<!-- <field name="functional_fixture_id" -->
<!-- attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/> -->
<!-- <field name="functional_fixture_code" force_save="1" -->
<!-- attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/> -->
<!-- <field name="functional_fixture_type_id" -->
<!-- attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/> -->
</group>
<!-- <group>-->
<!-- <div>-->
<!-- <label for="glb_file" string="加工模型"/>-->
<!-- <field name="glb_file" readonly="1" widget="Viewer3D"/>-->
<!-- </div>-->
<!-- &lt;!&ndash; <field name="glb_file" string="模型" readonly="1" widget="Viewer3D"/>&ndash;&gt;-->
<!-- </group>-->
<!-- <field name="processing_panel" readonly="1" attrs="{'invisible': [('routing_type', 'in', ('获取CNC加工程序','装夹','解除装夹',-->
<!-- '前置三元定位检测','后置三元质量检测','解除装夹'))]}"/>-->
</field>
<!-- <page string="Components" name="components">-->
<xpath expr="//page[1]" position="before">
<!-- <page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>-->
<!-- <group>-->
<!-- <field name="routing_type" invisible="1"/>-->
<!-- <field name="tray_code"/>-->
<!-- <field name="tray_id" readonly="1"/>-->
<!-- </group>-->
<!-- <group>-->
<!-- <field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}'-->
<!-- style="color:green"/>-->
<!-- <field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","!=",False)]}'/>-->
<!-- <div>-->
<!-- <field name="pro_code_ok" invisible="1"/>-->
<!-- </div>-->
<!-- </group>-->
<!-- <div class="col-12 col-lg-6 o_setting_box">-->
<!-- <button type="object" class="oe_highlight" name="gettray" string="绑定托盘"-->
<!-- attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>-->
<!-- </div>-->
<!-- </page>-->
<page string="工件装夹" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
<group>
<field name="_barcode_scanned" widget="barcode_handler"/>
<!-- <group string="卡盘">-->
<!-- <field name="chuck_serial_number"/>-->
<!-- <field name="chuck_name"/>-->
<!-- <field name="chuck_brand_id"/>-->
<!-- <field name="chuck_type_id"/>-->
<!-- <field name="chuck_model_id"/>-->
<!-- </group>-->
<group string="托盘">
<field name="tray_serial_number" readonly="1" string="序列号"/>
</group>
@@ -330,10 +305,6 @@
<field name="tray_model_id" readonly="1" string="型号"/>
</group>
</group>
<group string="加工图纸">
<!-- 隐藏加工图纸字段名 -->
<field name="processing_drawing" widget="pdf_viewer" string="" readonly="1"/>
</group>
<group string="预调程序信息">
<field name="preset_program_information" colspan="2" nolabel="1"
placeholder="如有预调程序信息请在此处输入....."/>
@@ -520,7 +491,8 @@
<xpath expr="//form//header" position="inside">
<button type="object" class="oe_highlight jikimo_button_confirm" name="get_three_check_datas"
string="获取数据" attrs='{"invisible": ["|", ("state","!=","progress"), ("routing_type","!=","装夹预调")]}'/>
string="获取数据"
attrs='{"invisible": ["|", ("state","!=","progress"), ("routing_type","!=","装夹预调")]}'/>
</xpath>
@@ -571,9 +543,7 @@
<!-- <field name="button_state" invisible="1"/>-->
</tree>
</field>
<group>
<field name="cnc_worksheet" string="工作指令" widget="pdf_viewer"/>
</group>
</page>
<page string="CMM程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
<field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1">
@@ -602,33 +572,43 @@
</page>
</xpath>
<xpath expr="//form//sheet//group//group//div[1]" position="after">
<label for="date_start" string="实际加工时间"/>
<div class="oe_inline">
<field name="date_start" class="mr8 oe_inline"/>
<strong class="mr8 oe_inline"></strong>
<field name="date_finished" class="oe_inline"/>
</div>
</xpath>
<xpath expr="//form//sheet//group//group//div[3]" position="after">
<field name="save_name" widget="CopyClipboardChar"
attrs="{'invisible':[('routing_type','!=','装夹预调')]}"/>
<label for="material_length" string="物料尺寸"/>
<div class="o_address_format">
<label for="material_length" string="长"/>
<field name="material_length" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="material_width" string="宽"/>
<field name="material_width" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="material_height" string="高"/>
<field name="material_height" class="o_address_zip"/>
</div>
<field name="part_number" string="成品的零件图号"/>
<!-- <xpath expr="//form//sheet//group//group//div[1]" position="after">-->
<!-- <label for="date_start" string="实际加工时间"/>-->
<!-- <div class="oe_inline">-->
<!-- <field name="date_start" class="mr8 oe_inline"/>-->
<!-- <strong class="mr8 oe_inline">到</strong>-->
<!-- <field name="date_finished" class="oe_inline"/>-->
<!-- </div>-->
<!-- </xpath>-->
<xpath expr="//page[@name='time_tracking']//field[@name='time_ids']//tree//field[@name='date_end']"
position="after">
<field name="duration" string="实际时长"/>
</xpath>
</field>
</record>
<record id="view_mrp_production_workorder_tray_form_inherit_sf_1" model="ir.ui.view">
<field name="name">mrp.production.workorder.tray.form.inherit.sf.1</field>
<field name="model">mrp.workorder</field>
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
<field name="arch" type="xml">
<xpath expr="//form//sheet//group//group[2]" position="replace">
<group string="装夹图纸" attrs="{'invisible': [('routing_type', '!=', '装夹预调')]}">
<!-- 隐藏加工图纸字段名 -->
<field name="processing_drawing" widget="pdf_viewer" string="" readonly="1"/>
<!-- <field name="production_id" invisible="0"/>-->
</group>
<group string="工作指令" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}">
<field name="cnc_worksheet" string="" widget="pdf_viewer"/>
</group>
</xpath>
<!-- <xpath expr="//form//sheet//group//group[1]" position="before">-->
<!-- <field name="production_id"/>-->
<!-- </xpath>-->
</field>
</record>
<record id="workcenter_form_workorder_search" model="ir.ui.view">
<field name="name">custom.workorder.search</field>
<field name="model">mrp.workorder</field>
@@ -640,6 +620,12 @@
<xpath expr="//filter[@name='progress']" position="after">
<filter string="待检测" name="state" domain="[('state','=','to be detected')]"/>
</xpath>
<xpath expr="//filter[@name='date_start_filter']" position="before">
<separator/>
<filter string="预警" name="filter_order_warning" domain="[('delivery_warning', '=', 'warning')]"/>
<filter string="逾期" name="filter_order_overdue" domain="[('delivery_warning', '=', 'overdue')]"/>
<separator/>
</xpath>
</field>
</record>

View File

@@ -11,11 +11,12 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify', 'stock', 'mrp'],
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify', 'stock', 'sf_quality', 'mrp'],
'data': [
'data/bussiness_node.xml',
# 'data/cron_data.xml',
'data/cron_data.xml',
'data/template_data.xml',
'security/ir.model.access.csv',
],
'test': [

View File

@@ -12,15 +12,16 @@
<field name="model">sale.order</field>
</record>
<!-- <record id="bussiness_sale_order_overdue_warning" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">销售订单逾期预警</field>-->
<!-- <field name="model">sale.order</field>-->
<!-- </record>-->
<record id="bussiness_sale_order_overdue_warning" model="jikimo.message.bussiness.node">
<field name="name">销售订单逾期预警</field>
<field name="model">sale.order</field>
</record>
<record id="bussiness_sale_order_overdue" model="jikimo.message.bussiness.node">
<field name="name">销售订单已逾期</field>
<field name="model">sale.order</field>
</record>
<!-- <record id="bussiness_sale_order_overdue" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">销售订单已逾期</field>-->
<!-- <field name="model">sale.order</field>-->
<!-- </record>-->
<record id="transfer_inventory" model="jikimo.message.bussiness.node">
<field name="name">调拨入库</field>
@@ -66,34 +67,50 @@
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<!-- <record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">CNC工单逾期预警</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<!-- <record id="bussiness_mrp_workorder_cnc_overdue" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">CNC工单已逾期</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<!-- <record id="bussiness_mrp_workorder_unclamp_overdue_warning" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">解除装夹工单逾期预警</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">
<field name="name">装夹预调工单逾期预警</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_mrp_workorder_pre_overdue" model="jikimo.message.bussiness.node">
<field name="name">装夹预调工单已逾期</field>
<field name="model">mrp.workorder</field>
</record>
<!-- <record id="bussiness_mrp_workorder_unclamp_overdue" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">解除装夹工单逾期</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">
<field name="name">CNC加工工单逾期预警</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_mrp_workorder_cnc_overdue" model="jikimo.message.bussiness.node">
<field name="name">CNC工单已逾期</field>
<field name="model">mrp.workorder</field>
</record>
<!-- <record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">表面工艺工单逾期预警</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<record id="bussiness_mrp_workorder_unclamp_overdue_warning" model="jikimo.message.bussiness.node">
<field name="name">解除装夹工单逾期预警</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_mrp_workorder_unclamp_overdue" model="jikimo.message.bussiness.node">
<field name="name">解除装夹工单已逾期</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">
<field name="name">表面工艺工单逾期预警</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_mrp_workorder_surface_overdue" model="jikimo.message.bussiness.node">
<field name="name">表面工艺工单已逾期</field>
<field name="model">mrp.workorder</field>
</record>
<record id="bussiness_quality_cnc_test" model="jikimo.message.bussiness.node">
<field name="name">待质量判定</field>
<field name="model">quality.cnc.test</field>
</record>
<!-- <record id="bussiness_mrp_workorder_surface_overdue" model="jikimo.message.bussiness.node">-->
<!-- <field name="name">表面工艺工单已逾期</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- </record>-->
<record id="bussiness_maintenance_logs" model="jikimo.message.bussiness.node">
<field name="name">设备故障</field>
<field name="model">sf.maintenance.logs</field>

View File

@@ -1,24 +1,11 @@
<odoo>
<data noupdate="1">
<record model="ir.cron" id="ir_cron_sale_order_overdue_warning">
<field name="name">销售订单逾期预警</field>
<field name="name">检查销售订单是否已逾期预警和逾期</field>
<field name="model_id" ref="model_sale_order"/>
<field name="state">code</field>
<field name="code">model._overdue_warning_func()</field>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="user_id" ref="base.user_root"/>
<field name="active" eval="True"/>
</record>
<record model="ir.cron" id="ir_cron_sale_order_overdue">
<field name="name">销售订单已逾期</field>
<field name="model_id" ref="model_sale_order"/>
<field name="state">code</field>
<field name="code">model._overdue_func()</field>
<field name="interval_number">1</field>
<field name="code">model._overdue_or_warning_func()</field>
<field name="interval_number">10</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
@@ -27,11 +14,11 @@
</record>
<record model="ir.cron" id="ir_cron_mrp_workorder_overdue_warning">
<field name="name">装夹预调工单逾期预警</field>
<field name="name">检查工单是否已逾期预警和逾期</field>
<field name="model_id" ref="model_mrp_workorder"/>
<field name="state">code</field>
<field name="code">model._overdue_warning_func()</field>
<field name="interval_number">1</field>
<field name="code">model._overdue_or_warning_func()</field>
<field name="interval_number">10</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
@@ -39,122 +26,17 @@
<field name="active" eval="True"/>
</record>
<record model="ir.cron" id="ir_cron_mrp_workorder_overdue">
<field name="name">工单已逾期</field>
<record model="ir.cron" id="ir_cron_mrp_workorder_overdue_warning">
<field name="name">检查工单是否完成并恢复正常时效</field>
<field name="model_id" ref="model_mrp_workorder"/>
<field name="state">code</field>
<field name="code">model._overdue_func()</field>
<field name="interval_number">1</field>
<field name="code">model._recover_time_warning_func()</field>
<field name="interval_number">10</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="user_id" ref="base.user_root"/>
<field name="active" eval="True"/>
</record>
<!-- -->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_overdue_warning">-->
<!-- <field name="name">工单逾期预警</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_warning_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue">-->
<!-- <field name="name">工单已逾期</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- -->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue_warning">-->
<!-- <field name="name">工单逾期预警</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_warning_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue">-->
<!-- <field name="name">工单已逾期</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- -->
<!-- -->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue_warning">-->
<!-- <field name="name">工单逾期预警</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_warning_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue">-->
<!-- <field name="name">工单已逾期</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- -->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue_warning">-->
<!-- <field name="name">工单逾期预警</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_warning_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
<!-- <record model="ir.cron" id="ir_cron_mrp_workorder_pre_overdue">-->
<!-- <field name="name">工单已逾期</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model._overdue_func()</field>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">minutes</field>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field name="doall" eval="False"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="active" eval="True"/>-->
<!-- </record>-->
</data>
</odoo>

View File

@@ -16,7 +16,7 @@
</record>
<record id="template_to_be_confirm" model="jikimo.message.template">
<field name="name">确认接单</field>
<field name="name">待排程提醒</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="model">sale.order</field>
<field name="bussiness_node_id" ref="bussiness_to_be_confirm"/>
@@ -27,6 +27,31 @@
事项:{{mrp_production_count}}个制造订单待计划排程
</field>
</record>
<record id="template_sale_order_overdue_warning" model="jikimo.message.template">
<field name="name">销售订单逾期预警</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="model">sale.order</field>
<field name="bussiness_node_id" ref="bussiness_sale_order_overdue_warning"/>
<field name="msgtype">markdown</field>
<field name="urgency">normal</field>
<field name="content">### 销售订单逾期预警
事项:共有[{{warning_num}}]({{url}})个销售订单有逾期风险
</field>
</record>
<record id="template_sale_order_overdue" model="jikimo.message.template">
<field name="name">销售订单已逾期</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="model">sale.order</field>
<field name="bussiness_node_id" ref="bussiness_sale_order_overdue"/>
<field name="msgtype">markdown</field>
<field name="urgency">urgent</field>
<field name="content">### 销售订单已逾期提醒
事项:共有[{{overdue_num}}]({{url}})个销售订单已逾期
</field>
</record>
<record id="template_material_purchase_remind" model="jikimo.message.template">
<field name="name">坯料采购提醒</field>
<field name="model_id" ref="purchase.model_purchase_order"/>
@@ -63,6 +88,102 @@
事项:共{{number}}个工单已下发,请查收知悉</field>
</record>
<record id="template_mrp_workorder_pre_overdue_warning" model="jikimo.message.template">
<field name="name">装夹预调工单逾期预警</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_pre_overdue_warning"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单逾期预警
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
</record>
<record id="template_mrp_workorder_pre_overdue" model="jikimo.message.template">
<field name="name">装夹预调工单已逾期</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_pre_overdue"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单已逾期提醒
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
</record>
<record id="template_mrp_workorder_cnc_overdue_warning" model="jikimo.message.template">
<field name="name">CNC加工工单逾期预警</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_cnc_overdue_warning"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单逾期预警
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
</record>
<record id="template_mrp_workorder_cnc_overdue" model="jikimo.message.template">
<field name="name">CNC加工工单已逾期</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_cnc_overdue"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单已逾期提醒
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
</record>
<record id="template_mrp_workorder_unclamp_overdue_warning" model="jikimo.message.template">
<field name="name">解除装夹工单逾期预警</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_unclamp_overdue_warning"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单逾期预警
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
</record>
<record id="template_mrp_workorder_unclamp_overdue" model="jikimo.message.template">
<field name="name">解除装夹工单已逾期</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_unclamp_overdue"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单已逾期提醒
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
</record>
<record id="template_mrp_workorder_surface_overdue_warning" model="jikimo.message.template">
<field name="name">表面工艺工单逾期预警</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_surface_overdue_warning"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单逾期预警
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
</record>
<record id="template_mrp_workorder_surface_overdue" model="jikimo.message.template">
<field name="name">表面工艺工单已逾期</field>
<field name="model_id" ref="mrp_workorder.model_mrp_workorder"/>
<field name="model">mrp.workorder</field>
<field name="bussiness_node_id" ref="bussiness_mrp_workorder_surface_overdue"/>
<field name="msgtype">markdown</field>
<field name="send_type">timing</field>
<field name="urgency">normal</field>
<field name="content">### 工单已逾期提醒
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
</record>
<record id="template_transfer_inventory_remind" model="jikimo.message.template">
@@ -131,6 +252,17 @@
<field name="content">### 订单发货提醒:
单号:发料出库单[{{name}}]({{request_url}})
事项:销售订单{{sale_order_name}}已全部产出并入库,请及时发货</field>
</record>
<record id="template_quality_cnc_test" model="jikimo.message.template">
<field name="name">待质量判定</field>
<field name="model_id" ref="sf_quality.model_quality_cnc_test"/>
<field name="model">quality.cnc.test</field>
<field name="bussiness_node_id" ref="bussiness_quality_cnc_test"/>
<field name="msgtype">markdown</field>
<field name="urgency">normal</field>
<field name="content">### 待质量判定提醒
事项:共有[{{judge_num}}]({{url}})个工单需判定质量结果</field>
</record>
<record id="template_maintenance_logs" model="jikimo.message.template">
<field name="name">设备故障</field>

View File

@@ -8,4 +8,5 @@ from . import sf_message_purchase
from . import sf_message_workorder
from . import sf_message_functional_tool_dismantle
from . import sf_message_mrp_production
from . import sf_message_quality_cnc_test
from . import sf_message_maintenance_logs

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
import logging
from datetime import datetime, timedelta
from odoo import models, fields, api, _
class SFMessageQualityCncTest(models.Model):
_name = 'quality.cnc.test'
_inherit = ['quality.cnc.test', 'jikimo.message.dispatch']
def create(self, vals_list):
res = super(SFMessageQualityCncTest, self).create(vals_list)
if res:
try:
logging.info('add_queue res:%s' % res)
res.add_queue('待质量判定')
except Exception as e:
logging.info('add_queue error:%s' % e)
return res
# 继承并重写jikimo.message.dispatch的_get_message()
def _get_message(self, message_queue_ids):
contents = []
url = self.env['ir.config_parameter'].get_param('web.base.url')
i = 0
for item in message_queue_ids:
if item.message_template_id.bussiness_node_id.name == '待质量判定':
content = item.message_template_id.content
i += 1
if i >= 1:
action_id = self.env.ref('sf_quality.action_quality_cnc_test').id
url_with_id = f"{url}/web#view_type=list&action={action_id}"
content_template = content.replace('{{judge_num}}', str(i))
content_template = content_template.replace('{{url}}', url_with_id)
contents.append(content_template)
return contents

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import logging
from datetime import datetime, timedelta
from odoo import models, fields, api, _
@@ -12,6 +13,7 @@ class SFMessageSale(models.Model):
res = super(SFMessageSale, self).create(vals_list)
if res:
try:
logging.info('add_queue res:%s' % res)
res.add_queue('待接单')
except Exception as e:
logging.info('add_queue error:%s' % e)
@@ -42,16 +44,20 @@ class SFMessageSale(models.Model):
# 继承并重写jikimo.message.dispatch的_get_message()
def _get_message(self, message_queue_ids):
contents = []
bussiness_node = None
url = self.env['ir.config_parameter'].get_param('web.base.url')
current_time_strf = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
current_time = self.env['sf.sync.common'].sudo().get_add_time(current_time_strf)
current_time_datetime = datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S')
time_range = timedelta(minutes=2)
i = 0
for item in message_queue_ids:
# 待接单的处理
if item.message_template_id.bussiness_node_id.name == '待接单':
content = super(SFMessageSale, self)._get_message(item)
action_id = self.env.ref('sale.action_quotations_with_onboarding').id
url = f"{url}/web#id={item.res_id}&view_type=form&action={action_id}"
content = content[0].replace('{{url}}', url)
url_with_id = f"{url}/web#id={item.res_id}&view_type=form&action={action_id}"
content = content[0].replace('{{url}}', url_with_id)
contents.append(content)
# 确认接单的处理
elif item.message_template_id.bussiness_node_id.name == '确认接单':
content = super(SFMessageSale, self)._get_message(item)
sale_order_line = self.env['sale.order.line'].search([('order_id', '=', int(item.res_id))])
@@ -59,16 +65,77 @@ class SFMessageSale(models.Model):
sale_order_line[
0].product_id.name
action_id = self.env.ref('sf_plan.sf_production_plan_action1').id
url = f"{url}/web#view_type=list&action={action_id}"
content = content[0].replace('{{product_id}}', product).replace('{{url}}', url)
url_with_id = f"{url}/web#view_type=list&action={action_id}"
content = content[0].replace('{{product_id}}', product).replace('{{url}}', url_with_id)
contents.append(content)
elif item.message_template_id.bussiness_node_id.name in ['销售订单逾期预警', '销售订单已逾期']:
bussiness_node = item.message_template_id.bussiness_node_id.name
for reminder_time in item.message_template_id.reminder_time_ids:
content = item.message_template_id.content
target_time = datetime.combine(current_time_datetime.date(), datetime.min.time()).replace(
hour=reminder_time.time_point,
minute=0,
second=0,
microsecond=0
)
logging.info(current_time)
logging.info(target_time)
if target_time - time_range <= current_time_datetime <= target_time + time_range:
search_condition = [
('delivery_warning', '=', 'warning')] if bussiness_node == '销售订单逾期预警' else [
('delivery_warning', '=', 'overdue')]
record = self.sudo().search(search_condition + [('id', '=', int(item.res_id))])
if record:
i += 1
if i >= 1:
action_id = self.env.ref('sale.action_orders').id
url_with_id = f"{url}/web#view_type=list&action={action_id}"
content_template = content.replace('{{url}}', url_with_id)
if bussiness_node == '销售订单逾期预警':
content = content_template.replace('{{warning_num}}', str(i))
elif bussiness_node == '销售订单已逾期':
content = content_template.replace('{{overdue_num}}', str(i))
contents.append(content)
return contents
# # 销售订单逾期预警
# def _overdue_warning_func(self):
# sale_order_
# return 1
#
# # 销售订单已逾期
# def _overdue_func(self):
# return 1
# # 销售订单逾期预警和已逾期
def _overdue_or_warning_func(self):
today = datetime.today().date()
deadline_check = today + timedelta(days=1)
logging.info(f"today: {today}, deadline_check: {deadline_check}")
sale_order = self.sudo().search([('state', 'in', ['sale']), ('deadline_of_delivery', '!=', False)])
for item in sale_order:
production = self.env['mrp.production'].search([('origin', '=', item.name)])
production_not_done = production.filtered(lambda p: p.state not in ['done', 'scrap', 'cancel'])
production_done_count = len(production.filtered(lambda p: p.state in ['done', 'scrap', 'cancel']))
if len(production_not_done) != item.mrp_production_count:
if deadline_check == item.deadline_of_delivery:
item.delivery_warning = 'warning'
elif today == item.deadline_of_delivery:
item.delivery_warning = 'overdue'
elif production_done_count == item.mrp_production_count:
if item.delivery_status in ['pending', 'partial']:
if deadline_check == item.deadline_of_delivery:
item.delivery_warning = 'warning'
elif today == item.deadline_of_delivery:
item.delivery_warning = 'overdue'
else:
continue
overdue_orders = self.sudo().search([('delivery_warning', 'in', ['warning', 'overdue'])])
for wo in overdue_orders:
message_template = self.env["jikimo.message.template"].search([
("model", "=", self._name),
("bussiness_node_id", "=", self.env.ref('sf_message.bussiness_sale_order_overdue_warning').id)
])
sale_order_has = self.env['jikimo.message.queue'].search([
('res_id', '=', wo.id),
('message_status', '=', 'pending'),
('message_template_id', '=', message_template.id)
])
if not sale_order_has:
if wo.delivery_warning == 'warning':
wo.add_queue('销售订单逾期预警')
elif wo.delivery_warning == 'overdue':
wo.add_queue('销售订单已逾期')

View File

@@ -1,3 +1,4 @@
from datetime import datetime, timedelta
from odoo import models, fields, api, _
import logging, json
import requests
@@ -6,6 +7,7 @@ from urllib.parse import urlencode
_logger = logging.getLogger(__name__)
class SFMessageWork(models.Model):
_name = 'mrp.workorder'
_inherit = ['mrp.workorder', 'jikimo.message.dispatch']
@@ -23,6 +25,17 @@ class SFMessageWork(models.Model):
def _get_message(self, message_queue_ids):
contents = []
product_id = []
bussiness_node = None
url = self.env['ir.config_parameter'].get_param('web.base.url')
current_time_strf = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
current_time = self.env['sf.sync.common'].sudo().get_add_time(current_time_strf)
current_time_datetime = datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S')
time_range = timedelta(minutes=2)
template_names = {
'预警': ['装夹预调工单逾期预警', 'CNC加工工单逾期预警', '解除装夹工单逾期预警', '表面工艺工单逾期预警'],
'已逾期': ['装夹预调工单已逾期', 'CNC加工工单已逾期', '解除装夹工单已逾期', '表面工艺工单已逾期']
}
i = 0
for message_queue_id in message_queue_ids:
if message_queue_id.message_template_id.name == '工单已下发通知':
content = message_queue_id.message_template_id.content
@@ -37,6 +50,37 @@ class SFMessageWork(models.Model):
'{{request_url}}', url)
product_id.append(mrp_workorder_line.product_id.id)
contents.append(content)
elif message_queue_id.message_template_id.name in template_names['预警'] + template_names['已逾期']:
item = message_queue_id.message_template_id
bussiness_node = item.bussiness_node_id.name
for reminder_time in item.reminder_time_ids:
content = item.content
target_time = datetime.combine(current_time_datetime.date(), datetime.min.time()).replace(
hour=reminder_time.time_point,
minute=0,
second=0,
microsecond=0
)
logging.info(current_time)
logging.info(target_time)
logging.info(target_time - time_range)
logging.info(target_time + time_range)
if target_time - time_range <= current_time_datetime <= target_time + time_range:
search_condition = [
('delivery_warning', '=', 'warning')] if bussiness_node in template_names['预警'] else [
('delivery_warning', '=', 'overdue')]
record = self.sudo().search(search_condition + [('id', '=', int(item.res_id))])
if record:
i += 1
if i >= 1:
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
url_with_id = f"{url}/web#view_type=list&action={action_id}"
content_template = content.replace('{{url}}', url_with_id)
if bussiness_node in template_names['预警']:
content = content_template.replace('{{warning_num}}', str(i))
elif bussiness_node in template_names['已逾期']:
content = content_template.replace('{{overdue_num}}', str(i))
contents.append(content)
return contents
def request_url(self):
@@ -52,3 +96,58 @@ class SFMessageWork(models.Model):
full_url = url + "/web#" + query_string
return full_url
def _overdue_or_warning_func(self):
workorders = self.env['mrp.workorder'].search([("state", "in", ["ready", "progress", "to be detected"])])
grouped_workorders = {}
for workorder in workorders:
routing_type = workorder.routing_type
if routing_type not in grouped_workorders:
grouped_workorders[routing_type] = []
grouped_workorders[routing_type].append(workorder)
for routing_type, orders in grouped_workorders.items():
print(f"Routing Type: {routing_type}, Orders: {len(orders)}")
for item in orders:
if item.date_planned_finished:
current_time_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
current_time_datetime = datetime.strptime(current_time_str, '%Y-%m-%d %H:%M:%S')
date_planned_finished_str = self.env['sf.sync.common'].sudo().get_add_time(
item.date_planned_finished.strftime("%Y-%m-%d %H:%M:%S"))
date_planned_finished = datetime.strptime(date_planned_finished_str, '%Y-%m-%d %H:%M:%S')
logging.info(f"Workorder: {item.production_id.name}, Current Time: {current_time_datetime}, "
f"Planned Finish: {date_planned_finished}")
twelve_hours_ago = current_time_datetime - timedelta(hours=12)
if current_time_datetime >= date_planned_finished:
item.delivery_warning = 'overdue'
elif twelve_hours_ago <= current_time_datetime <= date_planned_finished:
item.delivery_warning = 'warning'
business_node_ids = {
'装夹预调': self.env.ref('sf_message.bussiness_mrp_workorder_pre_overdue_warning').id,
'CNC加工': self.env.ref('sf_message.bussiness_mrp_workorder_cnc_overdue_warning').id,
'解除装夹': self.env.ref('sf_message.bussiness_mrp_workorder_unclamp_overdue_warning').id,
'表面工艺': self.env.ref('sf_message.bussiness_mrp_workorder_surface_overdue_warning').id,
}
message_templates = {key: self.env["jikimo.message.template"].sudo().search([
("model", "=", self._name),
("bussiness_node_id", "=", business_node_ids[key])
]) for key in business_node_ids}
for item in orders:
if item.delivery_warning in ['overdue', 'warning']:
bussiness_node_id = business_node_ids.get(item.routing_type)
if bussiness_node_id and message_templates[item.routing_type]:
message_queue_ids = self.env["jikimo.message.queue"].sudo().search([
("message_template_id", "=", message_templates[item.routing_type].id),
("message_status", "=", "pending"),
("res_id", "=", item.id)
])
if not message_queue_ids:
overdue_message = '工单已逾期' if item.delivery_warning == 'overdue' else '工单逾期预警'
queue_method_name = f'add_queue'
# 构建参数列表其中包含item.routing_type和overdue_message
args = [f'{item.routing_type}{overdue_message}']
# 获取add_queue方法并调用它传入参数列表
getattr(item, queue_method_name)(*args)
def _recover_time_warning_func(self):
workorder_done = self.env['mrp.workorder'].search([("state", "=", "done")])
workorder_overdue = workorder_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
workorder_overdue.write({'delivery_warning': 'normal'})

View File

@@ -1,22 +1,28 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_jikimo_message_template_group_sale_salemanager,jikimo_message_template,model_jikimo_message_template,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_template_group_purchase,jikimo_message_template,model_jikimo_message_template,sf_base.group_purchase,1,1,1,0
access_jikimo_message_template_group_sf_stock_user,jikimo_message_template,model_jikimo_message_template,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_template_group_sf_order_user,jikimo_message_template,model_jikimo_message_template,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_template_group_sf_tool_user,jikimo_message_template,model_jikimo_message_template,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_template_group_sale_salemanager,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_template_group_purchase,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_purchase,1,1,1,0
access_jikimo_message_template_group_sf_stock_user,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_template_group_sf_order_user,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_template_group_sf_tool_user,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sale_salemanager,jikimo_message_bussiness_node,model_jikimo_message_bussiness_node,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_bussiness_node_group_purchase,jikimo_message_bussiness_node,model_jikimo_message_bussiness_node,sf_base.group_purchase,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_stock_user,jikimo_message_bussiness_node,model_jikimo_message_bussiness_node,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_order_user,jikimo_message_bussiness_node,model_jikimo_message_bussiness_node,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_tool_user,jikimo_message_bussiness_node,model_jikimo_message_bussiness_node,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sale_salemanager,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_bussiness_node_group_purchase,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_purchase,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_stock_user,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_order_user,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_bussiness_node_group_sf_tool_user,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_queue_group_sale_salemanager,jikimo_message_queue,model_jikimo_message_queue,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_queue_group_purchase,jikimo_message_queue,model_jikimo_message_queue,sf_base.group_purchase,1,1,1,0
access_jikimo_message_queue_group_sf_stock_user,jikimo_message_queue,model_jikimo_message_queue,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_queue_group_sf_order_user,jikimo_message_queue,model_jikimo_message_queue,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_queue_group_sf_tool_user,jikimo_message_queue,model_jikimo_message_queue,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_queue_group_sale_salemanager,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_queue_group_purchase,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_purchase,1,1,1,0
access_jikimo_message_queue_group_sf_stock_user,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_queue_group_sf_order_user,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_queue_group_sf_tool_user,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_sf_tool_user,1,1,1,0
access_jikimo_message_reminder_time_group_sale_salemanager,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_sale_salemanager,1,1,1,0
access_jikimo_message_reminder_time_group_purchase,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_purchase,1,1,1,0
access_jikimo_message_reminder_time_group_sf_stock_user,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_sf_stock_user,1,1,1,0
access_jikimo_message_reminder_time_group_sf_order_user,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_sf_order_user,1,1,1,0
access_jikimo_message_reminder_time_group_sf_tool_user,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_sf_tool_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_jikimo_message_template_group_sale_salemanager jikimo_message_template model_jikimo_message_template jikimo_message_notify.model_jikimo_message_template sf_base.group_sale_salemanager 1 1 1 0
3 access_jikimo_message_template_group_purchase jikimo_message_template model_jikimo_message_template jikimo_message_notify.model_jikimo_message_template sf_base.group_purchase 1 1 1 0
4 access_jikimo_message_template_group_sf_stock_user jikimo_message_template model_jikimo_message_template jikimo_message_notify.model_jikimo_message_template sf_base.group_sf_stock_user 1 1 1 0
5 access_jikimo_message_template_group_sf_order_user jikimo_message_template model_jikimo_message_template jikimo_message_notify.model_jikimo_message_template sf_base.group_sf_order_user 1 1 1 0
6 access_jikimo_message_template_group_sf_tool_user jikimo_message_template model_jikimo_message_template jikimo_message_notify.model_jikimo_message_template sf_base.group_sf_tool_user 1 1 1 0
7 access_jikimo_message_bussiness_node_group_sale_salemanager jikimo_message_bussiness_node model_jikimo_message_bussiness_node jikimo_message_notify.model_jikimo_message_bussiness_node sf_base.group_sale_salemanager 1 1 1 0
8 access_jikimo_message_bussiness_node_group_purchase jikimo_message_bussiness_node model_jikimo_message_bussiness_node jikimo_message_notify.model_jikimo_message_bussiness_node sf_base.group_purchase 1 1 1 0
9 access_jikimo_message_bussiness_node_group_sf_stock_user jikimo_message_bussiness_node model_jikimo_message_bussiness_node jikimo_message_notify.model_jikimo_message_bussiness_node sf_base.group_sf_stock_user 1 1 1 0
10 access_jikimo_message_bussiness_node_group_sf_order_user jikimo_message_bussiness_node model_jikimo_message_bussiness_node jikimo_message_notify.model_jikimo_message_bussiness_node sf_base.group_sf_order_user 1 1 1 0
11 access_jikimo_message_bussiness_node_group_sf_tool_user jikimo_message_bussiness_node model_jikimo_message_bussiness_node jikimo_message_notify.model_jikimo_message_bussiness_node sf_base.group_sf_tool_user 1 1 1 0
12 access_jikimo_message_queue_group_sale_salemanager jikimo_message_queue model_jikimo_message_queue jikimo_message_notify.model_jikimo_message_queue sf_base.group_sale_salemanager 1 1 1 0
13 access_jikimo_message_queue_group_purchase jikimo_message_queue model_jikimo_message_queue jikimo_message_notify.model_jikimo_message_queue sf_base.group_purchase 1 1 1 0
14 access_jikimo_message_queue_group_sf_stock_user jikimo_message_queue model_jikimo_message_queue jikimo_message_notify.model_jikimo_message_queue sf_base.group_sf_stock_user 1 1 1 0
15 access_jikimo_message_queue_group_sf_order_user jikimo_message_queue model_jikimo_message_queue jikimo_message_notify.model_jikimo_message_queue sf_base.group_sf_order_user 1 1 1 0
16 access_jikimo_message_queue_group_sf_tool_user jikimo_message_queue model_jikimo_message_queue jikimo_message_notify.model_jikimo_message_queue sf_base.group_sf_tool_user 1 1 1 0
17 access_jikimo_message_reminder_time_group_sale_salemanager jikimo_message_reminder_time jikimo_message_notify.model_jikimo_message_reminder_time sf_base.group_sale_salemanager 1 1 1 0
18 access_jikimo_message_reminder_time_group_purchase jikimo_message_reminder_time jikimo_message_notify.model_jikimo_message_reminder_time sf_base.group_purchase 1 1 1 0
19 access_jikimo_message_reminder_time_group_sf_stock_user jikimo_message_reminder_time jikimo_message_notify.model_jikimo_message_reminder_time sf_base.group_sf_stock_user 1 1 1 0
20 access_jikimo_message_reminder_time_group_sf_order_user jikimo_message_reminder_time jikimo_message_notify.model_jikimo_message_reminder_time sf_base.group_sf_order_user 1 1 1 0
21 access_jikimo_message_reminder_time_group_sf_tool_user jikimo_message_reminder_time jikimo_message_notify.model_jikimo_message_reminder_time sf_base.group_sf_tool_user 1 1 1 0
22
23
24
25
26
27
28

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © <2016> <top hy>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<data>
</data>
</odoo>

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © <2016> <top hy>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<data>
<record id="sf_message_template_view_form" model="ir.ui.view">
<field name="name">sf.message.template.view.form</field>
<field name="model">message.template</field>
<field name="arch" type="xml">
<form string="消息模板">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" class="w-100" required="1"/>
</h1>
</div>
<group>
<!-- <field name="type"/>-->
<field name="notify_model_id"/>
<field name="content" widget="html" class="oe-bordered-editor"
options="{'style-inline': true, 'codeview': true, 'dynamic_placeholder': true}"/>
<field name="description"/>
<field name="msgtype"/>
<field name="notification_department_id"/>
<field name="notification_employee_ids" widget="many2many_tags"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="sf_message_template_view_tree" model="ir.ui.view">
<field name="name">sf.message.template.view.tree</field>
<field name="model">message.template</field>
<field name="arch" type="xml">
<tree string="消息模板">
<field name="name"/>
<!-- <field name="type"/>-->
<field name="content"/>
<field name="msgtype"/>
<field name="notification_department_id"/>
<field name="notification_employee_ids" widget="many2many_tags"/>
<field name="description"/>
</tree>
</field>
</record>
<record id="sf_message_template_search_view" model="ir.ui.view">
<field name="name">sf.message.template.search.view</field>
<field name="model">message.template</field>
<field name="arch" type="xml">
<search>
<field name="name" string="模糊搜索"
filter_domain="['|','|',('name','like',self),('description','like',self)]"/>
<field name="name"/>
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
</search>
</field>
</record>
<!--定义单证类型视图动作-->
<record id="sf_message_template_action" model="ir.actions.act_window">
<field name="name">消息模板</field>
<field name="res_model">message.template</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="sf_message_template_view_tree"/>
</record>
<menuitem id="msg_set_menu" name="消息设置" parent="base.menu_administration" sequence="1"/>
<menuitem id="sf_message_template_send_menu" name="消息模板" parent="msg_set_menu"
action="sf_message_template_action" sequence="1"/>
</data>
</odoo>

View File

@@ -13,10 +13,11 @@
'author': 'jikimo',
'website': 'https://sf.cs.jikimo.com',
# 此处依赖sf_manufacturing是因为我要重写其中的一个字段operation_id的string故需要sf_manufacturing先安装
'depends': ['quality_control'],
'depends': ['quality_control', 'web_widget_model_viewer', 'sf_manufacturing'],
'data': [
'security/ir.model.access.csv',
'views/view.xml'
'views/view.xml',
'views/quality_cnc_test_view.xml'
],
'assets': {

View File

@@ -3,3 +3,4 @@
from . import custom_quality
from . import quality
from . import quality_cnc_test

View File

@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class SfQualityCncTest(models.Model):
_name = 'quality.cnc.test'
_description = 'CNC加工质检'
name = fields.Char('单号', default=lambda self: self.env['ir.sequence'].next_by_code('quality.cnc.test'))
workorder_id = fields.Many2one('mrp.workorder')
production_id = fields.Many2one(related='workorder_id.production_id', string='制造订单')
product_id = fields.Many2one(related='workorder_id.product_id', string='产品')
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面')
equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备')
production_line_id = fields.Many2one(related='workorder_id.production_line_id',
string='生产线')
part_number = fields.Char(related='workorder_id.part_number', string='成品零件图号')
detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告')
state = fields.Selection([
('waiting', '待判定'),
('done', '已完成')], string='状态', default='waiting')
result = fields.Selection([
('pass', '合格'),
('fail', '不合格')], string='判定结果')
number = fields.Integer('数量', default=1)
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果")
reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
detailed_reason = fields.Text('详细原因')
def submit_pass(self):
self.write({'result': 'pass', 'test_results': self.test_results, 'state': 'done'})
self.workorder_id.write({'test_results': self.test_results})
self.workorder_id.button_finish()
def submit_fail(self):
if not self.reason and not self.detailed_reason and not self.test_results:
raise UserError(_('请填写【判定结果】里的信息'))
else:
self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
self.workorder_id.write(
{'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
self.workorder_id.button_finish()
class SfQualityWorkOrder(models.Model):
_inherit = 'mrp.workorder'
def button_finish(self):
super(SfQualityWorkOrder, self).button_finish()
if self.routing_type == 'CNC加工':
quality_cnc_test = self.env['quality.cnc.test'].search([('workorder_id', '=', self.id)])
if quality_cnc_test:
quality_cnc_test.write({'result': 'fail' if self.test_results in ['返工', '报废'] else 'pass',
'test_results': self.test_results, 'state': 'done',
'reason': self.reason,
'detailed_reason': self.detailed_reason,
'detection_report': self.detection_report})
def write(self, vals):
res = super(SfQualityWorkOrder, self).write(vals)
if self.state == 'to be detected':
quality_cnc_test = self.env['quality.cnc.test'].search([('workorder_id', '=', self.id)])
if not quality_cnc_test:
self.env['quality.cnc.test'].sudo().create({'workorder_id': self.id})

View File

@@ -67,5 +67,11 @@ access_quality_alert_stage,quality.alert.stage,quality.model_quality_alert_stage
access_stock_move_group_quality,stock_move_group_quality,stock.model_stock_move,sf_base.group_quality,1,1,0,0
access_stock_move_group_quality_director,stock_move_group_quality_director,stock.model_stock_move,sf_base.group_quality_director,1,1,0,0
access_quality_cnc_test_group_quality,quality_cnc_test_group_quality,model_quality_cnc_test,sf_base.group_quality,1,1,0,0
access_quality_cnc_test_group_quality_director,quality_cnc_test_group_quality_director,model_quality_cnc_test,sf_base.group_quality_director,1,1,0,0
access_quality_cnc_test_group_sf_equipment_user,quality_cnc_test_group_sf_equipment_user,model_quality_cnc_test,sf_base.group_sf_equipment_user,1,1,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
67
68
69
70
71
72
73
74
75
76
77

View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sequence_quality_cnc_test" model="ir.sequence">
<field name="name">加工质检单编码规则</field>
<field name="code">quality.cnc.test</field>
<field name="prefix">QCT</field>
<field name="padding">4</field>
<field name="company_id" eval="False"/>
</record>
<record id="quality_cnc_test_view_tree" model="ir.ui.view">
<field name="name">quality.cnc.test.view.tree</field>
<field name="model">quality.cnc.test</field>
<field name="arch" type="xml">
<tree sample="1">
<field name="name"/>
<field name="production_id"/>
<field name="processing_panel"/>
<field name="product_id"/>
<field name="part_number"/>
<field name="number"/>
<field name="state"/>
<field name="result"/>
<field name="write_uid" widget='many2one_avatar_user' string="判定人" optional="hide"/>
<field name="write_date" string="判定时间" optional="hide"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="quality_cnc_test_search">
<field name="name">search.quality.cnc.test</field>
<field name="model">quality.cnc.test</field>
<field name="arch" type="xml">
<search string="加工质检">
<filter name="filter_waiting" string="待判定" domain="[('state', '=', 'waiting')]"/>
<separator/>
<field name="production_id" string="制造订单"
filter_domain="[('production_id', 'ilike', self)]"/>
<field name="product_id" string="产品"
filter_domain="[('product_id', 'ilike', self)]"/>
<searchpanel>
<field name="state" icon="fa-filter" enable_counters="1"/>
<field name="result" icon="fa-filter" enable_counters="1"/>
</searchpanel>
</search>
</field>
</record>
<record id="action_quality_cnc_test" model="ir.actions.act_window">
<field name="name">加工质检</field>
<field name="res_model">quality.cnc.test</field>
<field name="view_mode">tree,form</field>
<field name="context">{ 'search_default_filter_waiting':1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
暂无加工质检单
</p>
</field>
</record>
<record model="ir.ui.view" id="quality_cnc_test_view_form">
<field name="name">quality.cnc.test.form.</field>
<field name="model">quality.cnc.test</field>
<field name="arch" type="xml">
<form>
<header>
<button string="合格" type="object" name="submit_pass"
class="oe_highlight" confirm="是否确认提交?"
attrs="{'invisible': [('result','!=', False)]}"/>
<button string="不合格" type="object" name="submit_fail"
class="oe_highlight" confirm="是否确认提交?"
attrs="{'invisible': [('result','!=', False)]}"/>
<field name="state" widget="statusbar"/>
<field name="result" invisible="1"/>
</header>
<sheet>
<h2>
<field name="name" readonly="1"/>
</h2>
<group>
<group>
<field name="production_id"/>
<field name="product_id"/>
<field name="production_line_id"/>
<field name="equipment_id"/>
<field name="model_file" widget="Viewer3D"/>
</group>
<group>
<field name="part_number"/>
<field name="processing_panel"/>
<field name="detection_report"/>
</group>
</group>
<notebook>
<page string="检测报告">
<field name="detection_report" string="" widget="pdf_viewer"/>
</page>
<page string="判定结果">
<group>
<field name="test_results" attrs="{'readonly': [('state','=', 'done')]}"/>
<field name="reason" attrs="{'readonly': [('state','=', 'done')]}"/>
<field name="detailed_reason" attrs="{'readonly': [('state','=', 'done')]}"/>
</group>
</page>
<page string="2D图纸">
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
</page>
<page string="客户质量标准">
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
</page>
<page string="其他" attrs="{'readonly': [('state','=', 'done')]}">
<group>
<field name="write_uid" widget='many2one_avatar_user' string="判定人" readonly="1"/>
<field name="write_date" string="判定时间" readonly="1"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="quality_cnc_test_view_kanban" model="ir.ui.view">
<field name="name">quality.cnc.test.view.kanban</field>
<field name="model">quality.cnc.test</field>
<field name="arch" type="xml">
<kanban sample="1" class="o_kanban_product_template">
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_card oe_kanban_global_click">
<div class="oe_kanban_details">
<div class="o_kanban_record_top mb-0">
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
</div>
</div>
<div>
<div>
<field name="production_id"/>
</div>
<div>
<field name="processing_panel"/>
</div>
<div>
<field name="test_results"
widget="label_selection"
options="{'classes': {'合格': 'success', '返工': 'warning', '报废': 'danger'}}"/>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<menuitem
id="menu_quality_cnc_test"
name="加工质检"
action="action_quality_cnc_test"
sequence="21"
parent="quality_control.menu_quality_control"
/>
<record id="action_quality_cnc_test_kanban" model="ir.actions.act_window">
<field name="name">驾驶舱</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">quality.cnc.test</field>
<field name="view_mode">kanban,form</field>
<field name="view_id" ref="quality_cnc_test_view_kanban"/>
<field name="search_view_id" ref="quality_cnc_test_search"/>
<field name="domain">[]</field>
<field name="context">{ 'search_default_filter_waiting':1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
暂无加工质检单
</p>
</field>
</record>
<menuitem id="menu_quality_cnc_test_dashboard"
name="驾驶舱"
action="action_quality_cnc_test_kanban"
parent="quality_control.menu_quality_root"
sequence="5"/>
</odoo>

View File

@@ -55,6 +55,9 @@ class ReSaleOrder(models.Model):
store=True, readonly=False, copy=False, precompute=True,
states=READONLY_FIELD_STATES, default=fields.Datetime.now)
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效')
# 业务平台分配工厂后在智能工厂先创建销售订单
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
deadline_of_delivery, payments_way, pay_way):

View File

@@ -95,7 +95,7 @@
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
</field>
<field name="payment_term_id" position="after">
<field name="deadline_of_delivery" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
<field name="deadline_of_delivery" readonly="1"/>
<field name="payments_way" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
<field name="pay_way" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
<!-- <field name="schedule_status" readonly="1"/> -->
@@ -106,6 +106,7 @@
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']" position="after">
<field name="remark"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
@@ -208,6 +209,20 @@
</field>
</record>
<record id="sale_order_view_search_inherit_sale_message" model="ir.ui.view">
<field name="name">sale.order.message.search.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.sale_order_view_search_inherit_sale"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//filter[@name='upselling']" position="after">
<separator/>
<filter string="预警" name="filter_order_warning" domain="[('delivery_warning', '=', 'warning')]"/>
<filter string="逾期" name="filter_order_overdue" domain="[('delivery_warning', '=', 'overdue')]"/>
</xpath>
</field>
</record>
<record id="view_order_tree_inherit_sf" model="ir.ui.view">
<field name="name">sale.order.tree</field>
<field name="model">sale.order</field>
@@ -217,18 +232,15 @@
<!-- <attribute name="default_order">schedule_status desc,date_order asc</attribute> -->
<attribute name="default_order">create_date desc</attribute>
<attribute name="create">False</attribute>
<attribute name="decoration-warning">delivery_warning == 'warning'</attribute>
<attribute name="decoration-danger">delivery_warning == 'overdue'</attribute>
</tree>
<field name="name" position="attributes">
<attribute name="string">订单号</attribute>
</field>
<!-- <field name="amount_total" position="after"> -->
<!-- <field name="schedule_status" widget="badge" -->
<!-- decoration-success="schedule_status == 'received'" -->
<!-- decoration-warning="schedule_status == 'to process'" -->
<!-- decoration-danger="schedule_status == 'to receive'" -->
<!-- decoration-muted="schedule_status == 'to process'" -->
<!-- decoration-info="schedule_status == 'to schedule'"/> -->
<!-- </field> -->
<field name="amount_total" position="after">
<field name="delivery_warning" invisible="1"/>
</field>
</field>
</record>
@@ -253,10 +265,18 @@
</field>
</field>
</record>
<record id="sale.product_template_action" model="ir.actions.act_window">
<field name="context">{"search_default_categ_id":1,
"search_default_filter_to_sell":1,"sale_multi_pricelist_product_template": 1}
</field>
</record>
<record id="sale.action_orders" model="ir.actions.act_window">
<field name="search_view_id" ref="sale_order_view_search_inherit_sale_message"/>
<field name="context">{ 'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1}
</field>
</record>
</data>
</odoo>

View File

@@ -234,7 +234,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
sf_functional_tool_assembly_id = fields.Many2one('sf.functional.tool.assembly', '功能刀具组装', readonly=True)
active = fields.Boolean(string='已归档', default=True)
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
@api.depends('functional_tool_name')
def _compute_tool_number(self):
@@ -687,7 +687,7 @@ class FunctionalToolAssembly(models.Model):
sf_cam_work_order_program_knife_plan_id = fields.Many2one('sf.cam.work.order.program.knife.plan',
'CAM工单程序用刀计划', readonly=True)
active = fields.Boolean(string='已归档', default=True)
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
code = fields.Char('功能刀具编码', compute='_compute_code')
@@ -1279,7 +1279,7 @@ class FunctionalToolDismantle(models.Model):
item.picking_num = 0
state = fields.Selection([('待拆解', '待拆解'), ('已拆解', '已拆解')], default='待拆解', tracking=True)
active = fields.Boolean('有效', default=True)
active = fields.Boolean('有效', default=True, groups='base.user_root')
# 刀柄
handle_product_id = fields.Many2one('product.product', string='刀柄', compute='_compute_functional_tool_num',

View File

@@ -402,7 +402,7 @@ class FunctionalToolWarning(models.Model):
dispose_time = fields.Char('处理时间', readonly=True)
dispose_func = fields.Char('处理方法/措施', readonly=True)
active = fields.Boolean(string='已归档', default=True)
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
@@ -554,7 +554,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
sf_functional_tool_entity_ids = fields.One2many('sf.functional.cutting.tool.entity', 'safe_inventory_id',
string='功能刀具信息')
active = fields.Boolean(string='已归档', default=True)
active = fields.Boolean(string='已归档', default=True, groups='base.user_root')
@api.depends('functional_name_id', 'functional_name_id.diameter', 'functional_name_id.angle',
'functional_name_id.functional_cutting_tool_model_id')