Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/表面工艺外协修复
# Conflicts: # sf_sale/views/sale_order_view.xml
This commit is contained in:
@@ -329,7 +329,7 @@ class ToolInventory(models.Model):
|
|||||||
blade_number = fields.Integer('刃数(个)')
|
blade_number = fields.Integer('刃数(个)')
|
||||||
extension = fields.Float('伸出长度(mm)')
|
extension = fields.Float('伸出长度(mm)')
|
||||||
work_material = fields.Selection([('钢', '钢'), ('铝', '铝')], string='加工材料')
|
work_material = fields.Selection([('钢', '钢'), ('铝', '铝')], string='加工材料')
|
||||||
life_span = fields.Float('寿命(h)')
|
life_span = fields.Float('寿命(min)')
|
||||||
|
|
||||||
tool_groups_id = fields.Many2one('sf.tool.groups', string='刀具组')
|
tool_groups_id = fields.Many2one('sf.tool.groups', string='刀具组')
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ access_sf_functional_cutting_tool_admin,sf_functional_cutting_tool_admin,model_s
|
|||||||
access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,base.group_user,1,1,1,0
|
access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,base.group_user,1,1,1,0
|
||||||
access_sf_functional_cutting_tool_model_admin,sf_functional_cutting_tool_model_admin,model_sf_functional_cutting_tool_model,base.group_system,1,1,1,0
|
access_sf_functional_cutting_tool_model_admin,sf_functional_cutting_tool_model_admin,model_sf_functional_cutting_tool_model,base.group_system,1,1,1,0
|
||||||
access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,base.group_user,1,1,1,0
|
access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,base.group_user,1,1,1,0
|
||||||
|
access_sf_fixture_material_group_sf_stock_user,sf_fixture_material_group_sf_stock_user,model_sf_fixture_material,sf_warehouse.group_sf_stock_user,1,1,1,0
|
||||||
access_sf_fixture_material_admin,sf_fixture_material_admin,model_sf_fixture_material,base.group_system,1,1,1,0
|
access_sf_fixture_material_admin,sf_fixture_material_admin,model_sf_fixture_material,base.group_system,1,1,1,0
|
||||||
access_sf_fixture_materials_basic_parameters,sf_fixture_materials_basic_parameters,model_sf_fixture_materials_basic_parameters,base.group_user,1,1,1,0
|
access_sf_fixture_materials_basic_parameters,sf_fixture_materials_basic_parameters,model_sf_fixture_materials_basic_parameters,base.group_user,1,1,1,0
|
||||||
access_sf_fixture_materials_basic_parameters_admin,sf_fixture_materials_basic_parameters_admin,model_sf_fixture_materials_basic_parameters,base.group_system,1,1,1,0
|
access_sf_fixture_materials_basic_parameters_admin,sf_fixture_materials_basic_parameters_admin,model_sf_fixture_materials_basic_parameters,base.group_system,1,1,1,0
|
||||||
|
|||||||
|
@@ -164,8 +164,8 @@ class JdEclp(models.Model):
|
|||||||
self.is_bill = True
|
self.is_bill = True
|
||||||
self.logistics_status = '1'
|
self.logistics_status = '1'
|
||||||
|
|
||||||
# 京东物流下单后,销售订单状态改为待收货
|
# # 京东物流下单后,销售订单状态改为待收货
|
||||||
self.env['sale.order'].search([('name', '=', self.origin)]).write({'scheduled_status': 'to receive'})
|
# self.env['sale.order'].search([('name', '=', self.origin)]).write({'scheduled_status': 'to receive'})
|
||||||
|
|
||||||
# else:
|
# else:
|
||||||
# raise UserError("选择京东物流才能下单呦")
|
# raise UserError("选择京东物流才能下单呦")
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
|
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
|
||||||
placeholder="请选择"/>
|
placeholder="请选择"/>
|
||||||
<field name="cutting_tool_model_id" placeholder="请选择" class="custom_required"
|
<field name="cutting_tool_model_id" placeholder="请选择" class="custom_required"
|
||||||
|
options="{'no_create': True}"
|
||||||
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"
|
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"
|
||||||
context="{'default_cutting_tool_material_id': cutting_tool_material_id}"
|
context="{'default_cutting_tool_material_id': cutting_tool_material_id}"
|
||||||
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}">
|
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}">
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
<!-- <button name="%(sf_base.action_sf_cutting_tool_standard_library)d" string="新建" type="action"-->
|
<!-- <button name="%(sf_base.action_sf_cutting_tool_standard_library)d" string="新建" type="action"-->
|
||||||
<!-- context="{'default_cutting_tool_material_id': cutting_tool_material_id}"/>-->
|
<!-- context="{'default_cutting_tool_material_id': cutting_tool_material_id}"/>-->
|
||||||
<field name="specification_id" placeholder="请选择" class="custom_required"
|
<field name="specification_id" placeholder="请选择" class="custom_required"
|
||||||
|
options="{'no_create': True}"
|
||||||
context="{'default_cutting_tool_type': cutting_tool_type,'default_standard_library_id':cutting_tool_model_id}"
|
context="{'default_cutting_tool_type': cutting_tool_type,'default_standard_library_id':cutting_tool_model_id}"
|
||||||
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
|
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
|
||||||
domain="[('standard_library_id','=',cutting_tool_model_id)]"/>
|
domain="[('standard_library_id','=',cutting_tool_model_id)]"/>
|
||||||
@@ -436,7 +438,7 @@
|
|||||||
<field name="cutting_speed_ids" string="" widget="one2many"
|
<field name="cutting_speed_ids" string="" widget="one2many"
|
||||||
attrs="{'readonly': [('id', '!=', False)]}" class="fixTableCss">
|
attrs="{'readonly': [('id', '!=', False)]}" class="fixTableCss">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="execution_standard_id"/>
|
<field name="execution_standard_id" options="{'no_create': True}"/>
|
||||||
<field name="material_code"/>
|
<field name="material_code"/>
|
||||||
<field name="material_grade"/>
|
<field name="material_grade"/>
|
||||||
<field name="tensile_strength"/>
|
<field name="tensile_strength"/>
|
||||||
@@ -453,7 +455,7 @@
|
|||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<!-- <field name="cutting_speed"-->
|
<!-- <field name="cutting_speed"-->
|
||||||
<!-- attrs="{'readonly': [('materials_type_id','!=',False)]}"/>-->
|
<!-- attrs="{'readonly': [('materials_type_id','!=',False)]}"/>-->
|
||||||
<field name="materials_type_id" placeholder="请选择"/>
|
<field name="materials_type_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||||
<field name="blade_diameter"/>
|
<field name="blade_diameter"/>
|
||||||
<field name="feed_per_tooth"/>
|
<field name="feed_per_tooth"/>
|
||||||
</tree>
|
</tree>
|
||||||
@@ -464,8 +466,8 @@
|
|||||||
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="brand_id" placeholder="请选择"/>
|
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||||
<field name="multi_mounting_type_id" placeholder="请选择"
|
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
|
||||||
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
||||||
<field name="length" string="长度(mm)"/>
|
<field name="length" string="长度(mm)"/>
|
||||||
<field name="width" string="宽度(mm)"/>
|
<field name="width" string="宽度(mm)"/>
|
||||||
@@ -553,14 +555,16 @@
|
|||||||
|
|
||||||
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
||||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||||
<field name="materials_model_id" placeholder="请选择"/>
|
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||||
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
||||||
|
options="{'no_create': True}"
|
||||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
||||||
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
||||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||||
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
||||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||||
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
||||||
|
options="{'no_create': True}"
|
||||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -999,7 +999,6 @@ class CNCprocessing(models.Model):
|
|||||||
def cnc_processing_create(self, cnc_workorder, ret, program_path, program_path_tmp):
|
def cnc_processing_create(self, cnc_workorder, ret, program_path, program_path_tmp):
|
||||||
cnc_processing = None
|
cnc_processing = None
|
||||||
for obj in ret['programming_list']:
|
for obj in ret['programming_list']:
|
||||||
# 暂时不注释,批次插入不需要单个workorder
|
|
||||||
workorder = self.env['mrp.workorder'].search(
|
workorder = self.env['mrp.workorder'].search(
|
||||||
[('production_id.name', '=', cnc_workorder.name),
|
[('production_id.name', '=', cnc_workorder.name),
|
||||||
('processing_panel', '=', obj['processing_panel']),
|
('processing_panel', '=', obj['processing_panel']),
|
||||||
@@ -1008,7 +1007,7 @@ class CNCprocessing(models.Model):
|
|||||||
if obj['program_name'] in program_path:
|
if obj['program_name'] in program_path:
|
||||||
logging.info('obj:%s' % obj['program_name'])
|
logging.info('obj:%s' % obj['program_name'])
|
||||||
cnc_processing = self.env['sf.cnc.processing'].create({
|
cnc_processing = self.env['sf.cnc.processing'].create({
|
||||||
# 'workorder_id': workorder.id,
|
'workorder_id': workorder.id,
|
||||||
'sequence_number': obj['sequence_number'],
|
'sequence_number': obj['sequence_number'],
|
||||||
'program_name': obj['program_name'],
|
'program_name': obj['program_name'],
|
||||||
'cutting_tool_name': obj['cutting_tool_name'],
|
'cutting_tool_name': obj['cutting_tool_name'],
|
||||||
@@ -1024,6 +1023,7 @@ class CNCprocessing(models.Model):
|
|||||||
'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
|
'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
|
||||||
})
|
})
|
||||||
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
|
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
|
||||||
|
cnc_workorder.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||||
return cnc_processing
|
return cnc_processing
|
||||||
|
|
||||||
def _json_cnc_processing(self, obj):
|
def _json_cnc_processing(self, obj):
|
||||||
|
|||||||
@@ -471,6 +471,18 @@ class ProductionLot(models.Model):
|
|||||||
# 'target': 'self',
|
# 'target': 'self',
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals_list):
|
||||||
|
for vals in vals_list:
|
||||||
|
if vals.get('rfid'):
|
||||||
|
lots = self.env['stock.lot'].search([('rfid', '=', vals['rfid'])])
|
||||||
|
if lots:
|
||||||
|
for lot in lots:
|
||||||
|
raise ValidationError('Rfid【%s】已被序列号为【%s】的【%s】产品占用!' % (
|
||||||
|
lot.rfid, lot.name, lot.product_id.name))
|
||||||
|
records = super(ProductionLot, self).create(vals_list)
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
class StockPicking(models.Model):
|
class StockPicking(models.Model):
|
||||||
_inherit = 'stock.picking'
|
_inherit = 'stock.picking'
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
cnc_processing = request.env['sf.cnc.processing'].with_user(
|
cnc_processing = request.env['sf.cnc.processing'].with_user(
|
||||||
request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret, program_path,
|
request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret, program_path,
|
||||||
program_path_tmp)
|
program_path_tmp)
|
||||||
|
logging.info('cnc_processing111:%s' % cnc_processing)
|
||||||
if cnc_processing:
|
if cnc_processing:
|
||||||
cnc_processing_arr.append(cnc_processing._json_cnc_processing(cnc_processing))
|
cnc_processing_arr.append(cnc_processing._json_cnc_processing(cnc_processing))
|
||||||
if cnc_program and cnc_processing_arr:
|
if cnc_program and cnc_processing_arr:
|
||||||
|
|||||||
1
sf_oca/__init__.py
Normal file
1
sf_oca/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
23
sf_oca/__manifest__.py
Normal file
23
sf_oca/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
{
|
||||||
|
"name": "sf_oca",
|
||||||
|
"version": "1.0",
|
||||||
|
'summary': '智能工厂oca模块',
|
||||||
|
'sequence': 1,
|
||||||
|
'description': """
|
||||||
|
在本模块,进行流程的审核
|
||||||
|
""",
|
||||||
|
'category': 'sf',
|
||||||
|
'website': 'https://www.sf.jikimo.com',
|
||||||
|
"depends": ["base_tier_validation_forward"],
|
||||||
|
"data": [
|
||||||
|
"security/ir.model.access.csv",
|
||||||
|
"templates/tier_validation_templates.xml",
|
||||||
|
],
|
||||||
|
"assets": {},
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'installable': True,
|
||||||
|
'application': False,
|
||||||
|
'auto_install': False,
|
||||||
|
}
|
||||||
1
sf_oca/models/__init__.py
Normal file
1
sf_oca/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import tier_validation
|
||||||
18
sf_oca/models/tier_validation.py
Normal file
18
sf_oca/models/tier_validation.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from ast import literal_eval
|
||||||
|
|
||||||
|
from lxml import etree
|
||||||
|
|
||||||
|
from odoo import _, api, fields, models
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.tools.misc import frozendict
|
||||||
|
|
||||||
|
|
||||||
|
class TierValidation(models.AbstractModel):
|
||||||
|
_inherit = "tier.validation"
|
||||||
|
|
||||||
|
def _notify_restarted_review_body(self):
|
||||||
|
return _("%s 取消审批请求.") % (self.env.user.name)
|
||||||
|
|
||||||
1
sf_oca/security/ir.model.access.csv
Normal file
1
sf_oca/security/ir.model.access.csv
Normal file
@@ -0,0 +1 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
122
sf_oca/templates/tier_validation_templates.xml
Normal file
122
sf_oca/templates/tier_validation_templates.xml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<template id="tier_validation_buttons">
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
name="request_validation"
|
||||||
|
string="发起审批"
|
||||||
|
t-attf-attrs="{'invisible': ['|','|',('need_validation', '!=', True),('rejected','=',True),('#{state_field}', '#{state_operator}', #{state_value})]}"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="restart_validation"
|
||||||
|
string="取消审批"
|
||||||
|
t-attf-attrs="{'invisible': ['|',('review_ids', '=', []),('#{state_field}', '#{state_operator}', #{state_value})]}"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template id="tier_validation_label">
|
||||||
|
<div>
|
||||||
|
<field name="need_validation" invisible="1" />
|
||||||
|
<field name="validated" invisible="1" />
|
||||||
|
<field name="rejected" invisible="1" />
|
||||||
|
<div
|
||||||
|
class="alert alert-warning"
|
||||||
|
role="alert"
|
||||||
|
t-attf-attrs="{'invisible': ['|', '|', '|',
|
||||||
|
('validated', '=', True), ('#{state_field}', '#{state_operator}', #{state_value}),
|
||||||
|
('rejected', '=', True), ('review_ids', '=', [])]}"
|
||||||
|
style="margin-bottom:0px;"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-info-circle" />
|
||||||
|
这个单据需要验证.
|
||||||
|
<field name="can_review" invisible="1" />
|
||||||
|
<button
|
||||||
|
name="validate_tier"
|
||||||
|
string="验证"
|
||||||
|
attrs="{'invisible': [('can_review', '=', False)]}"
|
||||||
|
type="object"
|
||||||
|
class="oe_inline oe_button btn-success"
|
||||||
|
icon="fa-thumbs-up"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="reject_tier"
|
||||||
|
string="拒绝"
|
||||||
|
attrs="{'invisible': [('can_review', '=', False)]}"
|
||||||
|
type="object"
|
||||||
|
class="btn-icon btn-danger"
|
||||||
|
icon="fa-thumbs-down"
|
||||||
|
/>
|
||||||
|
<br /><field name="next_review" readonly="1" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="alert alert-success"
|
||||||
|
role="alert"
|
||||||
|
t-attf-attrs="{'invisible': ['|', '|', ('validated', '!=', True), ('#{state_field}', '#{state_operator}', #{state_value}), ('review_ids', '=', [])]}"
|
||||||
|
style="margin-bottom:0px;"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-thumbs-up" />
|
||||||
|
Operation has been
|
||||||
|
<b>validated</b>
|
||||||
|
!
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="alert alert-danger"
|
||||||
|
role="alert"
|
||||||
|
t-attf-attrs="{'invisible': ['|', '|', ('rejected', '!=', True), ('#{state_field}', '#{state_operator}', #{state_value}), ('review_ids', '=', [])]}"
|
||||||
|
style="margin-bottom:0px;"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-thumbs-down" />
|
||||||
|
Operation has been
|
||||||
|
<b>rejected</b>
|
||||||
|
.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template id="tier_validation_reviews">
|
||||||
|
<field
|
||||||
|
name="review_ids"
|
||||||
|
widget="tier_validation"
|
||||||
|
attrs="{'invisible':[('review_ids', '=', [])]}"
|
||||||
|
style="width:100%%; margin-top: 10px;"
|
||||||
|
>
|
||||||
|
<tree>
|
||||||
|
<field name="id" />
|
||||||
|
<field name="name" />
|
||||||
|
<field name="sequence" />
|
||||||
|
<field name="requested_by" />
|
||||||
|
<field name="status" />
|
||||||
|
<field name="todo_by" />
|
||||||
|
<field name="done_by" />
|
||||||
|
<field name="reviewed_date" />
|
||||||
|
<field name="reviewed_formated_date" />
|
||||||
|
<field name="comment" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<template
|
||||||
|
id="tier_validation_label_forward"
|
||||||
|
inherit_id="sf_oca.tier_validation_label"
|
||||||
|
>
|
||||||
|
<xpath expr="//button[@name='reject_tier']" position="after">
|
||||||
|
<field name="can_forward" invisible="1" />
|
||||||
|
<button
|
||||||
|
name="forward_tier"
|
||||||
|
string="Forward"
|
||||||
|
attrs="{'invisible': [('can_forward', '=', False)]}"
|
||||||
|
type="object"
|
||||||
|
class="oe_inline oe_button btn-warning"
|
||||||
|
icon="fa-arrow-circle-right"
|
||||||
|
/>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</odoo>
|
||||||
@@ -83,6 +83,9 @@
|
|||||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||||
</attribute>
|
</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
|
||||||
|
<attribute name="options">{'no_create': True}</attribute>
|
||||||
|
</xpath>
|
||||||
<field name="partner_ref" position="attributes">
|
<field name="partner_ref" position="attributes">
|
||||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||||
('直装固定式', '直装固定式')], string='刀位接口型号')
|
('直装固定式', '直装固定式')], string='刀位接口型号')
|
||||||
diameter = fields.Integer(string='刀具直径(mm)')
|
diameter = fields.Float(string='刀具直径(mm)')
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)')
|
max_lifetime_value = fields.Integer(string='最大寿命值(min)')
|
||||||
alarm_value = fields.Integer(string='报警值(min)')
|
alarm_value = fields.Integer(string='报警值(min)')
|
||||||
@@ -209,7 +209,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
||||||
compute='_compute_tool_number', store=True)
|
compute='_compute_tool_number', store=True)
|
||||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', compute='_compute_tool_number', store=True)
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', compute='_compute_tool_number', store=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', compute='_compute_tool_number', store=True)
|
diameter = fields.Float(string='刀具直径(mm)', compute='_compute_tool_number', store=True)
|
||||||
tool_included_angle = fields.Float(string='刀尖R角(mm)', compute='_compute_tool_number', store=True)
|
tool_included_angle = fields.Float(string='刀尖R角(mm)', compute='_compute_tool_number', store=True)
|
||||||
tool_loading_length = fields.Float(string='总长度(mm)', compute='_compute_tool_number', store=True)
|
tool_loading_length = fields.Float(string='总长度(mm)', compute='_compute_tool_number', store=True)
|
||||||
extension_length = fields.Float(string='伸出长(mm)')
|
extension_length = fields.Float(string='伸出长(mm)')
|
||||||
@@ -368,7 +368,7 @@ class FunctionalToolAssembly(models.Model):
|
|||||||
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
group_expand='_read_group_functional_tool_type_ids')
|
group_expand='_read_group_functional_tool_type_ids')
|
||||||
functional_tool_diameter = fields.Integer(string='功能刀具直径(mm)', readonly=True)
|
functional_tool_diameter = fields.Float(string='功能刀具直径(mm)', readonly=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||||
@@ -542,7 +542,7 @@ class FunctionalToolAssembly(models.Model):
|
|||||||
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', readonly=True)
|
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', readonly=True)
|
||||||
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
||||||
string='组装后功能刀具类型', readonly=True)
|
string='组装后功能刀具类型', readonly=True)
|
||||||
after_assembly_functional_tool_diameter = fields.Integer(string='组装后功能刀具直径(mm)', readonly=True)
|
after_assembly_functional_tool_diameter = fields.Float(string='组装后功能刀具直径(mm)', readonly=True)
|
||||||
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)', readonly=True)
|
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)', readonly=True)
|
||||||
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', readonly=True)
|
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', readonly=True)
|
||||||
cut_time = fields.Integer(string='已切削时间(min)', readonly=True)
|
cut_time = fields.Integer(string='已切削时间(min)', readonly=True)
|
||||||
@@ -696,7 +696,7 @@ class FunctionalToolDismantle(models.Model):
|
|||||||
tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||||
compute='_compute_functional_tool_num')
|
compute='_compute_functional_tool_num')
|
||||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', compute='_compute_functional_tool_num', store=True)
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', compute='_compute_functional_tool_num', store=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', compute='_compute_functional_tool_num', store=True)
|
diameter = fields.Float(string='刀具直径(mm)', compute='_compute_functional_tool_num', store=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', compute='_compute_functional_tool_num', store=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', compute='_compute_functional_tool_num', store=True)
|
||||||
rfid = fields.Char('Rfid', compute='_compute_functional_tool_num', store=True)
|
rfid = fields.Char('Rfid', compute='_compute_functional_tool_num', store=True)
|
||||||
rfid_dismantle = fields.Char('Rfid(已拆解)', readonly=True)
|
rfid_dismantle = fields.Char('Rfid(已拆解)', readonly=True)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
||||||
group_expand='_read_group_mrs_cutting_tool_type_id', compute_sudo=True)
|
group_expand='_read_group_mrs_cutting_tool_type_id', compute_sudo=True)
|
||||||
|
|
||||||
functional_tool_diameter = fields.Integer(string='刀具直径(mm)', readonly=True)
|
functional_tool_diameter = fields.Float(string='刀具直径(mm)', readonly=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||||
@@ -244,7 +244,7 @@ class FunctionalToolWarning(models.Model):
|
|||||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', related='functional_tool_name_id.barcode_id')
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', related='functional_tool_name_id.barcode_id')
|
||||||
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型')
|
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型')
|
||||||
diameter = fields.Integer(string='刀具直径(mm)')
|
diameter = fields.Float(string='刀具直径(mm)')
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||||
# 其他信息
|
# 其他信息
|
||||||
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
|
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
|
||||||
@@ -298,7 +298,7 @@ class StockMoveLine(models.Model):
|
|||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||||
group_expand='_read_group_functional_tool_type_id')
|
group_expand='_read_group_functional_tool_type_id')
|
||||||
functional_tool_name = fields.Char('刀具名称')
|
functional_tool_name = fields.Char('刀具名称')
|
||||||
diameter = fields.Integer(string='刀具直径(mm)')
|
diameter = fields.Float(string='刀具直径(mm)')
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||||
install_tool_time = fields.Datetime("刀具组装时间", default=fields.Datetime.now())
|
install_tool_time = fields.Datetime("刀具组装时间", default=fields.Datetime.now())
|
||||||
code = fields.Char('编码')
|
code = fields.Char('编码')
|
||||||
@@ -320,7 +320,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=False, required=True)
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=False, required=True)
|
||||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
|
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
|
||||||
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
|
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
diameter = fields.Float(string='刀具直径(mm)', readonly=False)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
||||||
tool_stock_num = fields.Integer(string='刀具房数量')
|
tool_stock_num = fields.Integer(string='刀具房数量')
|
||||||
side_shelf_num = fields.Integer(string='线边刀库数量')
|
side_shelf_num = fields.Integer(string='线边刀库数量')
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
|
|
||||||
image = fields.Binary('图片', related='functional_tool_name_id.image')
|
image = fields.Binary('图片', related='functional_tool_name_id.image')
|
||||||
tool_code = fields.Char('功能刀具编码', related='functional_tool_name_id.code')
|
tool_code = fields.Char('功能刀具编码', related='functional_tool_name_id.code')
|
||||||
|
rfid = fields.Char('Rfid', related='functional_tool_name_id.rfid')
|
||||||
functional_tool_type = fields.Char('功能刀具类型', related='functional_tool_name_id.sf_cutting_tool_type_id.name')
|
functional_tool_type = fields.Char('功能刀具类型', related='functional_tool_name_id.sf_cutting_tool_type_id.name')
|
||||||
tool_groups = fields.Char('刀具组', related='functional_tool_name_id.tool_groups_id.name')
|
tool_groups = fields.Char('刀具组', related='functional_tool_name_id.tool_groups_id.name')
|
||||||
diameter = fields.Integer('直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
|
diameter = fields.Float('直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
|
||||||
knife_tip_r_angle = fields.Float('刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
|
knife_tip_r_angle = fields.Float('刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
|
||||||
life_value_max = fields.Integer('最大寿命值(min)', related='functional_tool_name_id.max_lifetime_value')
|
life_value_max = fields.Integer('最大寿命值(min)', related='functional_tool_name_id.max_lifetime_value')
|
||||||
alarm_value = fields.Integer('报警值(min)', related='functional_tool_name_id.alarm_value')
|
alarm_value = fields.Integer('报警值(min)', related='functional_tool_name_id.alarm_value')
|
||||||
@@ -26,15 +27,15 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
# if datas:
|
# if datas:
|
||||||
# print(datas)
|
# print(datas)
|
||||||
|
|
||||||
@api.model_create_multi
|
# @api.model_create_multi
|
||||||
def create(self, vals_list):
|
# def create(self, vals_list):
|
||||||
tools = super().create(vals_list)
|
# tools = super().create(vals_list)
|
||||||
for tool in tools:
|
# for tool in tools:
|
||||||
self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
# self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
||||||
'maintenance_equipment_id': tool.equipment_id.id,
|
# 'maintenance_equipment_id': tool.equipment_id.id,
|
||||||
'cutter_spacing_code_id': tool.id
|
# 'cutter_spacing_code_id': tool.id
|
||||||
})
|
# })
|
||||||
return tools
|
# return tools
|
||||||
|
|
||||||
|
|
||||||
class SfMaintenanceEquipment(models.Model):
|
class SfMaintenanceEquipment(models.Model):
|
||||||
@@ -68,6 +69,18 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
[('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)])
|
[('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)])
|
||||||
functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||||
[('rfid', '=', data['RfidCode'])])
|
[('rfid', '=', data['RfidCode'])])
|
||||||
|
if functional_tool_id:
|
||||||
|
# 查询该功能刀具是否已经装在机床内其他位置,如果是就删除
|
||||||
|
equipment_tools = self.env['maintenance.equipment.tool'].sudo().search(
|
||||||
|
[('functional_tool_name_id', '=', functional_tool_id.id), ('code', '!=', tool_id)])
|
||||||
|
if equipment_tools:
|
||||||
|
for item in equipment_tools:
|
||||||
|
item.write({
|
||||||
|
'functional_tool_name_id': False,
|
||||||
|
'tool_install_time': None
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
logging.info('Rfid为【%s】的功能刀具不存在!' % data['RfidCode'])
|
||||||
time = None
|
time = None
|
||||||
if data['AddDatetime']:
|
if data['AddDatetime']:
|
||||||
datatime = str(data['AddDatetime'])
|
datatime = str(data['AddDatetime'])
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ class CNCprocessing(models.Model):
|
|||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
obj = super(CNCprocessing, self).create(vals)
|
obj = super(CNCprocessing, self).create(vals)
|
||||||
# 调用CAM工单程序用刀计划创建方法
|
for item in obj:
|
||||||
self.env['sf.cam.work.order.program.knife.plan'].create_cam_work_plan(obj)
|
# 调用CAM工单程序用刀计划创建方法
|
||||||
|
self.env['sf.cam.work.order.program.knife.plan'].create_cam_work_plan(item)
|
||||||
logging.info('成功调用CAM工单程序用刀计划创建方法!!!')
|
logging.info('成功调用CAM工单程序用刀计划创建方法!!!')
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|||||||
@@ -184,27 +184,10 @@
|
|||||||
<field name="model">sf.functional.cutting.tool.entity</field>
|
<field name="model">sf.functional.cutting.tool.entity</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search>
|
<search>
|
||||||
<field name="barcode_id"/>
|
|
||||||
<field name="rfid"/>
|
<field name="rfid"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="tool_name_id"/>
|
||||||
<field name="image" widget='image'/>
|
|
||||||
<field name="functional_tool_diameter"/>
|
<field name="functional_tool_diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="coarse_middle_thin" optional="hide"/>
|
|
||||||
<field name="new_former" optional="hide"/>
|
|
||||||
<field name="tool_loading_length" optional="hide"/>
|
|
||||||
<field name="functional_tool_length" optional="hide"/>
|
|
||||||
<field name="effective_length" optional="hide"/>
|
|
||||||
<field name="tool_room_num"/>
|
|
||||||
<field name="line_edge_knife_library_num"/>
|
|
||||||
<field name="machine_knife_library_num"/>
|
|
||||||
<field name="max_lifetime_value"/>
|
|
||||||
<field name="alarm_value"/>
|
|
||||||
<field name="used_value"/>
|
|
||||||
<field name="functional_tool_status" optional="hide"/>
|
|
||||||
|
|
||||||
<field name="current_location_id" invisible="True"/>
|
|
||||||
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
|
||||||
<filter string="未拆除" name="no_state_removed" domain="[('functional_tool_status', '!=', '已拆除')]"/>
|
<filter string="未拆除" name="no_state_removed" domain="[('functional_tool_status', '!=', '已拆除')]"/>
|
||||||
<filter string="已拆除" name="state_removed" domain="[('functional_tool_status', '=', '已拆除')]"/>
|
<filter string="已拆除" name="state_removed" domain="[('functional_tool_status', '=', '已拆除')]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<field name='product_template_ids'>
|
<field name='product_template_ids'>
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="code" readonly="1"/>
|
<field name="code" readonly="1"/>
|
||||||
|
<field name="rfid"/>
|
||||||
<field name="tool_code"/>
|
<field name="tool_code"/>
|
||||||
<field name="functional_tool_type"/>
|
<field name="functional_tool_type"/>
|
||||||
<field name="functional_tool_name_id" readonly="1"/>
|
<field name="functional_tool_name_id" readonly="1"/>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta, datetime
|
||||||
|
|
||||||
from odoo import fields, models, api
|
from odoo import fields, models, api
|
||||||
@@ -25,7 +27,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||||
('直装固定式', '直装固定式')], string='刀位接口型号', readonly=True)
|
('直装固定式', '直装固定式')], string='刀位接口型号', readonly=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=True)
|
diameter = fields.Float(string='刀具直径(mm)', readonly=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
||||||
alarm_value = fields.Integer(string='报警值(min)', readonly=True)
|
alarm_value = fields.Integer(string='报警值(min)', readonly=True)
|
||||||
@@ -37,7 +39,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
# 待换功能刀具信息
|
# 待换功能刀具信息
|
||||||
replacement_tool_name = fields.Char(string='待换功能刀具名称', compute='_compute_name')
|
replacement_tool_name = fields.Char(string='待换功能刀具名称', compute='_compute_name')
|
||||||
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
|
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
|
||||||
replacement_diameter = fields.Integer(string='待换刀具直径(mm)')
|
replacement_diameter = fields.Float(string='待换刀具直径(mm)')
|
||||||
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', required=True)
|
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', required=True)
|
||||||
replacement_tool_setting_length = fields.Float(string='待换刀具总长度(mm)', required=True)
|
replacement_tool_setting_length = fields.Float(string='待换刀具总长度(mm)', required=True)
|
||||||
replacement_extension_length = fields.Float(string='待换刀具伸出长(mm)')
|
replacement_extension_length = fields.Float(string='待换刀具伸出长(mm)')
|
||||||
@@ -151,7 +153,7 @@ class ToolTransferRequestInformation(models.TransientModel):
|
|||||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||||
('直装固定式', '直装固定式')], string='刀位接口型号', readonly=True)
|
('直装固定式', '直装固定式')], string='刀位接口型号', readonly=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=True)
|
diameter = fields.Float(string='刀具直径(mm)', readonly=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
||||||
alarm_value = fields.Integer(string='报警值(min)', readonly=True)
|
alarm_value = fields.Integer(string='报警值(min)', readonly=True)
|
||||||
@@ -195,7 +197,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
group_expand='_read_group_functional_tool_type_ids')
|
group_expand='_read_group_functional_tool_type_ids')
|
||||||
functional_tool_diameter = fields.Integer(string='功能刀具直径(mm)', readonly=True)
|
functional_tool_diameter = fields.Float(string='功能刀具直径(mm)', readonly=True)
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||||
@@ -461,7 +463,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', compute='_compute_name', store=True)
|
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', compute='_compute_name', store=True)
|
||||||
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
||||||
string='组装后功能刀具类型')
|
string='组装后功能刀具类型')
|
||||||
after_assembly_functional_tool_diameter = fields.Integer(string='组装后功能刀具直径(mm)')
|
after_assembly_functional_tool_diameter = fields.Float(string='组装后功能刀具直径(mm)')
|
||||||
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)')
|
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)')
|
||||||
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', default='0')
|
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', default='0')
|
||||||
cut_time = fields.Integer(string='已切削时间(min)')
|
cut_time = fields.Integer(string='已切削时间(min)')
|
||||||
@@ -613,17 +615,17 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly, self)
|
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly, self)
|
||||||
# 刀具物料出库
|
# 刀具物料出库
|
||||||
if self.handle_code_id:
|
if self.handle_code_id:
|
||||||
product_id.tool_material_stock_moves(self.handle_code_id)
|
product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code)
|
||||||
if self.integral_product_id:
|
if self.integral_product_id:
|
||||||
self.integral_product_id.material_stock_moves(self.integral_freight_barcode)
|
self.integral_product_id.material_stock_moves(self.integral_freight_barcode,self.assembly_order_code)
|
||||||
if self.blade_product_id:
|
if self.blade_product_id:
|
||||||
self.blade_product_id.material_stock_moves(self.blade_freight_barcode)
|
self.blade_product_id.material_stock_moves(self.blade_freight_barcode,self.assembly_order_code)
|
||||||
if self.bar_product_id:
|
if self.bar_product_id:
|
||||||
self.bar_product_id.material_stock_moves(self.bar_freight_barcode)
|
self.bar_product_id.material_stock_moves(self.bar_freight_barcode,self.assembly_order_code)
|
||||||
if self.pad_product_id:
|
if self.pad_product_id:
|
||||||
self.pad_product_id.material_stock_moves(self.pad_freight_barcode)
|
self.pad_product_id.material_stock_moves(self.pad_freight_barcode,self.assembly_order_code)
|
||||||
if self.chuck_product_id:
|
if self.chuck_product_id:
|
||||||
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode)
|
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode,self.assembly_order_code)
|
||||||
|
|
||||||
# ============================创建功能刀具列表、安全库存记录===============================
|
# ============================创建功能刀具列表、安全库存记录===============================
|
||||||
# 封装功能刀具数据
|
# 封装功能刀具数据
|
||||||
@@ -807,6 +809,7 @@ class ProductProduct(models.Model):
|
|||||||
"""
|
"""
|
||||||
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
||||||
|
|
||||||
|
logging.info("product_id: %s" % product_id)
|
||||||
stock_lot = self.env['stock.lot'].create({
|
stock_lot = self.env['stock.lot'].create({
|
||||||
'name': self.get_stock_lot_name(tool_assembly_order_id),
|
'name': self.get_stock_lot_name(tool_assembly_order_id),
|
||||||
'product_id': product_id.id,
|
'product_id': product_id.id,
|
||||||
@@ -817,7 +820,7 @@ class ProductProduct(models.Model):
|
|||||||
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
||||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||||
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
|
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
|
||||||
'功能刀具组装', obj, obj.after_tool_groups_id)
|
self.assembly_order_code, obj, obj.after_tool_groups_id)
|
||||||
|
|
||||||
return stock_lot
|
return stock_lot
|
||||||
|
|
||||||
@@ -843,7 +846,7 @@ class ProductProduct(models.Model):
|
|||||||
num = "%03d" % m
|
num = "%03d" % m
|
||||||
return code + str(num)
|
return code + str(num)
|
||||||
|
|
||||||
def tool_material_stock_moves(self, tool_material):
|
def tool_material_stock_moves(self, tool_material, assembly_order_code):
|
||||||
"""
|
"""
|
||||||
对刀具物料进行库存移动到 刀具组装位置
|
对刀具物料进行库存移动到 刀具组装位置
|
||||||
"""
|
"""
|
||||||
@@ -851,12 +854,12 @@ class ProductProduct(models.Model):
|
|||||||
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
||||||
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False, False)
|
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False, False)
|
||||||
|
|
||||||
def material_stock_moves(self, shelf_location_barcode):
|
def material_stock_moves(self, shelf_location_barcode, assembly_order_code):
|
||||||
# 创建库存移动记录
|
# 创建库存移动记录
|
||||||
stock_move_id = self.env['stock.move'].sudo().create({
|
stock_move_id = self.env['stock.move'].sudo().create({
|
||||||
'name': '功能刀具组装',
|
'name': assembly_order_code,
|
||||||
'product_id': self.id,
|
'product_id': self.id,
|
||||||
'location_id': self.env['stock.location'].search([('name', '=', '刀具房')]).id,
|
'location_id': self.env['stock.location'].search([('name', '=', '刀具房')]).id,
|
||||||
'location_dest_id': self.env['stock.location'].search([('name', '=', '刀具组装位置')]).id,
|
'location_dest_id': self.env['stock.location'].search([('name', '=', '刀具组装位置')]).id,
|
||||||
|
|||||||
@@ -880,7 +880,7 @@ class SfStockPicking(models.Model):
|
|||||||
line.compute_destination_location_id()
|
line.compute_destination_location_id()
|
||||||
else:
|
else:
|
||||||
# 对除刀柄之外的刀具物料进行 目标货位必填校验
|
# 对除刀柄之外的刀具物料进行 目标货位必填校验
|
||||||
if self.location_dest_id.name == '刀具房' and line.product_id.cutting_tool_material_id not in (
|
if self.location_dest_id.name == '刀具房' and line.product_id.cutting_tool_material_id.name not in (
|
||||||
'刀柄', False):
|
'刀柄', False):
|
||||||
raise ValidationError('请选择【%s】产品的目标货位!' % line.product_id.name)
|
raise ValidationError('请选择【%s】产品的目标货位!' % line.product_id.name)
|
||||||
if line.current_location_id:
|
if line.current_location_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user