Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
2
jikimo_purchase_request/__init__.py
Normal file
2
jikimo_purchase_request/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import models
|
||||||
22
jikimo_purchase_request/__manifest__.py
Normal file
22
jikimo_purchase_request/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
{
|
||||||
|
'name': '机企猫 采购申请',
|
||||||
|
'version': '16.0.1.0.0',
|
||||||
|
'summary': """ 机企猫 采购申请 """,
|
||||||
|
'author': '机企猫',
|
||||||
|
'website': 'https://bfw.jikimo.com',
|
||||||
|
'category': 'purchase',
|
||||||
|
'depends': ['sf_manufacturing', 'purchase_request'],
|
||||||
|
'data': [
|
||||||
|
|
||||||
|
],
|
||||||
|
# 'assets': {
|
||||||
|
# 'web.assets_backend': [
|
||||||
|
# 'jikimo_purchase_request/static/src/**/*'
|
||||||
|
# ],
|
||||||
|
# },
|
||||||
|
'application': True,
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
}
|
||||||
2
jikimo_purchase_request/models/__init__.py
Normal file
2
jikimo_purchase_request/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import product_template
|
||||||
17
jikimo_purchase_request/models/product_template.py
Normal file
17
jikimo_purchase_request/models/product_template.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
class ProductTemplate(models.Model):
|
||||||
|
_inherit = 'product.template'
|
||||||
|
|
||||||
|
purchase_request_id = fields.Many2one('purchase.request', string='采购申请')
|
||||||
|
|
||||||
|
def no_bom_product_create(self, product_id, item, order_id, route_type, i, finish_product):
|
||||||
|
""" 创建坯料时,复制采购申请 """
|
||||||
|
template_id = super(ProductTemplate, self).no_bom_product_create(product_id, item, order_id, route_type, i, finish_product)
|
||||||
|
template_id.purchase_request = product_id.purchase_request
|
||||||
|
return template_id
|
||||||
|
|
||||||
|
def copy_template(self, product_template_id):
|
||||||
|
""" 复制成品模板时,复制采购申请 """
|
||||||
|
super(ProductTemplate, self).copy_template(product_template_id)
|
||||||
|
self.purchase_request = product_template_id.purchase_request
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//notebook/page[last()]" position="after">
|
<xpath expr="//notebook/page[last()]" position="after">
|
||||||
<field name="routing_type" invisible="1"/>
|
<field name="routing_type" invisible="1"/>
|
||||||
<page string="异常记录" name="workorder_exception" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}">
|
<page string="异常记录" name="workorder_exception" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "ER")]}'>
|
||||||
<field name="exception_ids" nolabel="1" readonly="1">
|
<field name="exception_ids" nolabel="1" readonly="1">
|
||||||
<tree create="false" delete="false" edit="false">
|
<tree create="false" delete="false" edit="false">
|
||||||
<field name="exception_content" string="反馈的异常/问题信息"/>
|
<field name="exception_content" string="反馈的异常/问题信息"/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="开料要求" attrs='{"invisible": [("routing_type","!=","切割")]}'>
|
<page string="开料要求" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "CMR")]}'>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="product_tmpl_id_materials_id" widget="many2one"/>
|
<field name="product_tmpl_id_materials_id" widget="many2one"/>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page[last()-3]" position="before">
|
<xpath expr="//page[last()-3]" position="before">
|
||||||
<!-- <page string="下发记录" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>-->
|
<!-- <page string="下发记录" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>-->
|
||||||
<page string="下发记录" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="下发记录" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "HDR")]}'>
|
||||||
<field name="delivery_records">
|
<field name="delivery_records">
|
||||||
<tree create="false">
|
<tree create="false">
|
||||||
<field name="delivery_type"/>
|
<field name="delivery_type"/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page[last()-3]" position="before">
|
<xpath expr="//page[last()-3]" position="before">
|
||||||
<page string="机床信息" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="机床信息" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "MTI")]}'>
|
||||||
<group string="机床信息">
|
<group string="机床信息">
|
||||||
<group>
|
<group>
|
||||||
<field name="machine_tool_name"/>
|
<field name="machine_tool_name"/>
|
||||||
|
|||||||
@@ -4,5 +4,63 @@
|
|||||||
<field name="code">PTD</field>
|
<field name="code">PTD</field>
|
||||||
<field name="name">后置三元检测</field>
|
<field name="name">后置三元检测</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_2">
|
||||||
|
<field name="code">WCP</field>
|
||||||
|
<field name="name">工件装夹</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_3">
|
||||||
|
<field name="code">ITD_PP</field>
|
||||||
|
<field name="name">前置三元检测定位参数</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_4">
|
||||||
|
<field name="code">2D_MD</field>
|
||||||
|
<field name="name">2D加工图纸</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_5">
|
||||||
|
<field name="code">QIS</field>
|
||||||
|
<field name="name">质检标准</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_6">
|
||||||
|
<field name="code">WD</field>
|
||||||
|
<field name="name">工件配送</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_9">
|
||||||
|
<field name="code">CNC_P</field>
|
||||||
|
<field name="name">CNC程序</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_10">
|
||||||
|
<field name="code">CMM_P</field>
|
||||||
|
<field name="name">CMM程序</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_11">
|
||||||
|
<field name="code">MTI</field>
|
||||||
|
<field name="name">机床信息</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_12">
|
||||||
|
<field name="code">HDR</field>
|
||||||
|
<field name="name">下发记录</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_13">
|
||||||
|
<field name="code">ER</field>
|
||||||
|
<field name="name">异常记录</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_14">
|
||||||
|
<field name="code">DCP</field>
|
||||||
|
<field name="name">解除装夹</field>
|
||||||
|
</record>
|
||||||
|
<record model="sf.work.individuation.page" id="sf_work_individuation_page_15">
|
||||||
|
<field name="code">CMR</field>
|
||||||
|
<field name="name">开料要求</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- 原生页签先不进行配置 -->
|
||||||
|
<!-- <record model="sf.work.individuation.page" id="sf_work_individuation_page_7">-->
|
||||||
|
<!-- <field name="code">ML</field>-->
|
||||||
|
<!-- <field name="name">物料</field>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
<!-- <record model="sf.work.individuation.page" id="sf_work_individuation_page_8">-->
|
||||||
|
<!-- <field name="code">TT</field>-->
|
||||||
|
<!-- <field name="name">时间跟踪</field>-->
|
||||||
|
<!-- </record>-->
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -365,7 +365,7 @@ class MrpProduction(models.Model):
|
|||||||
and production.schedule_state == '已排' and production.is_rework is False):
|
and production.schedule_state == '已排' and production.is_rework is False):
|
||||||
production.state = 'pending_cam'
|
production.state = 'pending_cam'
|
||||||
if any((wo.test_results == '返工' and wo.state == 'done' and
|
if any((wo.test_results == '返工' and wo.state == 'done' and
|
||||||
(production.programming_state in ['已编程'] or wo.individuation_page_PTD is True))
|
(production.programming_state in ['已编程'] or(wo.individuation_page_list and 'PTD' in wo.individuation_page_list)))
|
||||||
or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程'])
|
or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程'])
|
||||||
for wo in production.workorder_ids) or production.is_rework is True:
|
for wo in production.workorder_ids) or production.is_rework is True:
|
||||||
production.state = 'rework'
|
production.state = 'rework'
|
||||||
|
|||||||
@@ -1442,7 +1442,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
record.production_id.process_state = '待加工'
|
record.production_id.process_state = '待加工'
|
||||||
# 生成工件配送单
|
# 生成工件配送单
|
||||||
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
|
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
|
||||||
if record.routing_type == 'CNC加工' or record.individuation_page_PTD is True:
|
if (record.routing_type == 'CNC加工' or
|
||||||
|
(record.individuation_page_list and 'PTD' in record.individuation_page_list)):
|
||||||
if record.routing_type == 'CNC加工':
|
if record.routing_type == 'CNC加工':
|
||||||
record.process_state = '待解除装夹'
|
record.process_state = '待解除装夹'
|
||||||
# record.write({'process_state': '待加工'})
|
# record.write({'process_state': '待加工'})
|
||||||
@@ -1675,31 +1676,31 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
move_subcontract_workorder_ids = fields.One2many('stock.move', 'subcontract_workorder_id', string='组件')
|
move_subcontract_workorder_ids = fields.One2many('stock.move', 'subcontract_workorder_id', string='组件')
|
||||||
|
|
||||||
# ==============================配置化页签--个性化记录===================================
|
# ==============================配置化页签--个性化记录===================================
|
||||||
routing_workcenter_id = fields.Many2one('mrp.routing.workcenter', compute='_compute_routing_workcenter_id',
|
routing_work_center_id = fields.Many2one('mrp.routing.workcenter', compute='_compute_routing_work_center_id',
|
||||||
store=True)
|
store=True, string='工序作业')
|
||||||
individuation_page_ids = fields.Many2many('sf.work.individuation.page', string='个性化记录', store=True,
|
individuation_page_ids = fields.Many2many('sf.work.individuation.page', string='个性化记录',
|
||||||
compute='_compute_individuation_page_ids')
|
related='routing_work_center_id.individuation_page_ids')
|
||||||
individuation_page_PTD = fields.Boolean('个性化记录(是否显示后置三元检测[PTD]页签)', default=False)
|
individuation_page_list = fields.Char('个性化记录', default='', compute='_compute_individuation_page_ids', store=True)
|
||||||
|
|
||||||
@api.depends('name')
|
@api.depends('name')
|
||||||
def _compute_routing_workcenter_id(self):
|
def _compute_routing_work_center_id(self):
|
||||||
for mw in self:
|
for mw in self:
|
||||||
routing_workcenter_id = self.env['mrp.routing.workcenter'].sudo().search(
|
if not mw.routing_work_center_id and mw.name:
|
||||||
[('name', '=', mw.name), ('routing_type', '=', mw.routing_type)])
|
routing_work_center_id = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
if routing_workcenter_id:
|
[('name', 'in', mw.name.split('-')), ('routing_type', '=', mw.routing_type)])
|
||||||
mw.routing_workcenter_id = routing_workcenter_id.id
|
if routing_work_center_id:
|
||||||
|
mw.routing_work_center_id = routing_work_center_id.id
|
||||||
|
|
||||||
@api.depends('routing_workcenter_id.individuation_page_ids')
|
@api.depends('individuation_page_ids')
|
||||||
def _compute_individuation_page_ids(self):
|
def _compute_individuation_page_ids(self):
|
||||||
for mw in self:
|
for mw in self:
|
||||||
if mw.routing_workcenter_id:
|
mw.individuation_page_list = '[]'
|
||||||
mw.individuation_page_ids = mw.routing_workcenter_id.individuation_page_ids.ids
|
if mw.routing_work_center_id:
|
||||||
# 初始化页签配置
|
if mw.individuation_page_ids:
|
||||||
mw.individuation_page_PTD = False
|
# 根据工单对应的【作业_个性化记录】配置页签
|
||||||
# 根据工单对应的【作业_个性化记录】配置页签
|
individuation_page_list = [item.code for item in mw.individuation_page_ids]
|
||||||
if any(item.code == 'PTD' for item in mw.routing_workcenter_id.individuation_page_ids):
|
if individuation_page_list:
|
||||||
mw.individuation_page_PTD = True
|
mw.individuation_page_list = list(set(individuation_page_list))
|
||||||
|
|
||||||
# =============================================================================================
|
# =============================================================================================
|
||||||
|
|
||||||
is_inspect = fields.Boolean('需送检', compute='_compute_is_inspect', store=True, default=False)
|
is_inspect = fields.Boolean('需送检', compute='_compute_is_inspect', store=True, default=False)
|
||||||
@@ -2009,7 +2010,7 @@ class WorkPieceDelivery(models.Model):
|
|||||||
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
|
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
|
||||||
task_delivery_time = fields.Datetime('任务下发时间')
|
task_delivery_time = fields.Datetime('任务下发时间')
|
||||||
task_completion_time = fields.Datetime('任务完成时间')
|
task_completion_time = fields.Datetime('任务完成时间')
|
||||||
|
|
||||||
def _get_agv_route_type_selection(self):
|
def _get_agv_route_type_selection(self):
|
||||||
return self.env['sf.agv.task.route'].fields_get(['route_type'])['route_type']['selection']
|
return self.env['sf.agv.task.route'].fields_get(['route_type'])['route_type']['selection']
|
||||||
type = fields.Selection(selection=_get_agv_route_type_selection, string='类型')
|
type = fields.Selection(selection=_get_agv_route_type_selection, string='类型')
|
||||||
|
|||||||
@@ -227,8 +227,7 @@
|
|||||||
<!-- attrs='{"invisible": [("rework_flag","=",True)]}' confirm="是否返工"/>-->
|
<!-- attrs='{"invisible": [("rework_flag","=",True)]}' confirm="是否返工"/>-->
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="开料要求"
|
<page string="开料要求" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "CMR")]}'>
|
||||||
attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'>
|
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="product_tmpl_id_materials_id" widget="many2one"/>
|
<field name="product_tmpl_id_materials_id" widget="many2one"/>
|
||||||
@@ -325,7 +324,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="工件装夹" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
|
<page string="工件装夹" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "WCP")]}'>
|
||||||
<group>
|
<group>
|
||||||
<!-- <field name="_barcode_scanned" widget="barcode_handler"/> -->
|
<!-- <field name="_barcode_scanned" widget="barcode_handler"/> -->
|
||||||
<group string="托盘">
|
<group string="托盘">
|
||||||
@@ -347,7 +346,7 @@
|
|||||||
placeholder="如有预调程序信息请在此处输入....."/>
|
placeholder="如有预调程序信息请在此处输入....."/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page string="前置三元检测定位参数" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
|
<page string="前置三元检测定位参数" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "ITD_PP")]}'>
|
||||||
|
|
||||||
<div>左面:</div>
|
<div>左面:</div>
|
||||||
<div class="o_address_format">
|
<div class="o_address_format">
|
||||||
@@ -504,17 +503,7 @@
|
|||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
|
|
||||||
<page string="2D加工图纸"
|
<page string="工件配送" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "WD")]}'>
|
||||||
attrs='{"invisible": [("routing_type","not in",["装夹预调", "人工线下加工"])]}'>
|
|
||||||
<field name="machining_drawings" widget="adaptive_viewer"/>
|
|
||||||
</page>
|
|
||||||
|
|
||||||
<page string="质检标准" attrs="{'invisible': [('routing_type','!=','装夹预调')]}">
|
|
||||||
<field name="quality_standard" widget="adaptive_viewer"/>
|
|
||||||
</page>
|
|
||||||
|
|
||||||
<page string="工件配送"
|
|
||||||
attrs="{'invisible': [('routing_type','!=','装夹预调')]}">
|
|
||||||
<field name="workpiece_delivery_ids">
|
<field name="workpiece_delivery_ids">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="production_id" invisible="1"/>
|
<field name="production_id" invisible="1"/>
|
||||||
@@ -542,11 +531,19 @@
|
|||||||
attrs='{"invisible": ["|", ("state","!=","progress"), ("routing_type","!=","装夹预调")]}'/>
|
attrs='{"invisible": ["|", ("state","!=","progress"), ("routing_type","!=","装夹预调")]}'/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
<!-- =====原生页签,暂时不进行配置===== -->
|
||||||
|
<!-- <xpath expr="//page[@name='components']" position="attributes">-->
|
||||||
|
<!-- <attribute name="attrs">{"invisible": ["!", ("individuation_page_list", "ilike", "ML")]}</attribute>-->
|
||||||
|
<!-- </xpath>-->
|
||||||
|
<!-- <xpath expr="//page[@name='time_tracking']" position="attributes">-->
|
||||||
|
<!-- <attribute name="attrs">{"invisible": ["!", ("individuation_page_list", "ilike", "TT")]}</attribute>-->
|
||||||
|
<!-- </xpath>-->
|
||||||
|
<!-- ============================= -->
|
||||||
|
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<field name="results" invisible="1"/>
|
<field name="results" invisible="1"/>
|
||||||
<field name="individuation_page_PTD" invisible="1"/>
|
<field name="individuation_page_list" invisible="1"/>
|
||||||
<page string="后置三元检测" attrs='{"invisible": [("individuation_page_PTD", "=", False)]}'>
|
<page string="后置三元检测" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "PTD")]}'>
|
||||||
<group>
|
<group>
|
||||||
<field name="test_results"
|
<field name="test_results"
|
||||||
attrs='{"readonly":["&","|",("state","!=","to be detected"), "|",("routing_type","=","CNC加工"),("is_inspect", "=", True),("state","in",["done","rework"])],
|
attrs='{"readonly":["&","|",("state","!=","to be detected"), "|",("routing_type","=","CNC加工"),("is_inspect", "=", True),("state","in",["done","rework"])],
|
||||||
@@ -568,16 +565,16 @@
|
|||||||
<!-- attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>-->
|
<!-- attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
</page>
|
</page>
|
||||||
<page string="2D加工图纸" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="2D加工图纸" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "2D_MD")]}'>
|
||||||
<field name="machining_drawings" widget="adaptive_viewer"/>
|
<field name="machining_drawings" widget="adaptive_viewer"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
||||||
<page string="质检标准" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="质检标准" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "QIS")]}'>
|
||||||
<field name="quality_standard" widget="adaptive_viewer"/>
|
<field name="quality_standard" widget="adaptive_viewer"/>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
|
<page string="CNC程序" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "CNC_P")]}'>
|
||||||
<field name="cnc_ids" widget="one2many" string="工作程序" default_order="sequence_number,id"
|
<field name="cnc_ids" widget="one2many" string="工作程序" default_order="sequence_number,id"
|
||||||
readonly="0">
|
readonly="0">
|
||||||
<tree>
|
<tree>
|
||||||
@@ -601,7 +598,7 @@
|
|||||||
</field>
|
</field>
|
||||||
|
|
||||||
</page>
|
</page>
|
||||||
<page string="CMM程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
|
<page string="CMM程序" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "CMM_P")]}'>
|
||||||
<field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1">
|
<field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="sequence_number"/>
|
<field name="sequence_number"/>
|
||||||
@@ -614,7 +611,7 @@
|
|||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
<page string="解除装夹" attrs='{"invisible": ["!", ("individuation_page_list", "ilike", "DCP")]}'>
|
||||||
<!-- <field name="tray_id" readonly="1"/>-->
|
<!-- <field name="tray_id" readonly="1"/>-->
|
||||||
<!-- <div class="col-12 col-lg-6 o_setting_box">-->
|
<!-- <div class="col-12 col-lg-6 o_setting_box">-->
|
||||||
<!-- <button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"-->
|
<!-- <button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"-->
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
from . import wizard
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ from . import custom_quality
|
|||||||
from . import quality
|
from . import quality
|
||||||
from . import quality_cnc_test
|
from . import quality_cnc_test
|
||||||
from . import mrp_workorder
|
from . import mrp_workorder
|
||||||
|
# from . import stock
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class QualityCheck(models.Model):
|
|||||||
('cancel', '已取消'), ], string='状态', tracking=True, store=True,
|
('cancel', '已取消'), ], string='状态', tracking=True, store=True,
|
||||||
default='none', copy=False, compute='_compute_quality_state')
|
default='none', copy=False, compute='_compute_quality_state')
|
||||||
|
|
||||||
individuation_page_PTD = fields.Boolean('个性化记录(是否显示后置三元检测[PTD]页签)', related='workorder_id.individuation_page_PTD')
|
individuation_page_list = fields.Char('个性化记录', related='workorder_id.individuation_page_list')
|
||||||
work_state = fields.Selection(related='workorder_id.state', string='工单状态')
|
work_state = fields.Selection(related='workorder_id.state', string='工单状态')
|
||||||
processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面')
|
processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面')
|
||||||
|
|
||||||
@@ -93,7 +93,8 @@ class QualityCheck(models.Model):
|
|||||||
raise ValidationError('请填写【判定结果】里的信息')
|
raise ValidationError('请填写【判定结果】里的信息')
|
||||||
if self.test_results == '合格':
|
if self.test_results == '合格':
|
||||||
raise ValidationError('请重新选择【判定结果】-【检测结果】')
|
raise ValidationError('请重新选择【判定结果】-【检测结果】')
|
||||||
if self.workorder_id.routing_type != 'CNC加工' and self.workorder_id.individuation_page_PTD is False:
|
if (self.workorder_id.routing_type != 'CNC加工' and self.workorder_id.individuation_page_list
|
||||||
|
and 'PTD' not in self.workorder_id.individuation_page_list):
|
||||||
self.workorder_id.production_id.write({'detection_result_ids': [(0, 0, {
|
self.workorder_id.production_id.write({'detection_result_ids': [(0, 0, {
|
||||||
'rework_reason': self.reason,
|
'rework_reason': self.reason,
|
||||||
'detailed_reason': self.detailed_reason,
|
'detailed_reason': self.detailed_reason,
|
||||||
|
|||||||
21
sf_quality/models/stock.py
Normal file
21
sf_quality/models/stock.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class StockPicking(models.Model):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
def button_validate(self):
|
||||||
|
"""
|
||||||
|
调拨单若关联了质量检查单,验证调拨单时,应校验是否有不合格品,若存在,应弹窗提示:
|
||||||
|
“警告:存在不合格产品XXXX n 件、YYYYY m件,继续调拨请点“确认”,否则请取消?”
|
||||||
|
"""
|
||||||
|
if self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail'):
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'sf.functional.tool.assembly.order',
|
||||||
|
'name': ' ',
|
||||||
|
'view_mode': 'form',
|
||||||
|
'target': 'new',
|
||||||
|
'context': {'': True}
|
||||||
|
}
|
||||||
|
return super(StockPicking, self).button_validate()
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<xpath expr="//field[@name='alert_ids']" position="after">
|
<xpath expr="//field[@name='alert_ids']" position="after">
|
||||||
<field name="production_id" invisible="1"/>
|
<field name="production_id" invisible="1"/>
|
||||||
<field name="work_state" invisible="1"/>
|
<field name="work_state" invisible="1"/>
|
||||||
<field name="individuation_page_PTD" invisible="1"/>
|
<field name="individuation_page_list" invisible="1"/>
|
||||||
<field name="production_line_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
<field name="production_line_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
||||||
<field name="equipment_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
<field name="equipment_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
||||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||||
|
|||||||
0
sf_quality/wizard/__init__.py
Normal file
0
sf_quality/wizard/__init__.py
Normal file
Reference in New Issue
Block a user