Compare commits
112 Commits
feature/ma
...
feature/10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b686a8272 | ||
|
|
1699f61d3f | ||
|
|
a0eec00749 | ||
|
|
f5365b4a3a | ||
|
|
8b9aa1c454 | ||
|
|
9a4d7e87ec | ||
|
|
b434329fc4 | ||
|
|
72998f04c6 | ||
|
|
23db164452 | ||
|
|
1f11d188c1 | ||
|
|
5106768330 | ||
|
|
6c0d9486fc | ||
|
|
211d74d9ff | ||
|
|
6134ac3b4c | ||
|
|
85c24e3d94 | ||
|
|
106945fba7 | ||
|
|
8ea72198ea | ||
|
|
41cd76ad14 | ||
|
|
e20510bc4f | ||
|
|
1d14ab27af | ||
|
|
fd55abec72 | ||
|
|
76597f6ccb | ||
|
|
d7779e969d | ||
|
|
9d28eccd1b | ||
|
|
27339afaae | ||
|
|
8dc3f2698b | ||
|
|
4fd7ad8d03 | ||
|
|
3bc33fe2fc | ||
|
|
c21319a127 | ||
|
|
02e21a8fde | ||
|
|
2cf578de65 | ||
|
|
9665cdfc84 | ||
|
|
bef7376827 | ||
|
|
e73e9d6960 | ||
|
|
892f5d0e70 | ||
|
|
61339da204 | ||
|
|
25db392864 | ||
|
|
745fd429c2 | ||
|
|
5c59a27a81 | ||
|
|
9bac3675f6 | ||
|
|
b4fbbd48fb | ||
|
|
3559d67c05 | ||
|
|
816623b1fe | ||
|
|
91b913a7bd | ||
|
|
ba8393a8c7 | ||
|
|
06d061165b | ||
|
|
18a7dbbff9 | ||
|
|
dc545e6d49 | ||
|
|
1467dbf88c | ||
|
|
e9caf78b81 | ||
|
|
aa1353cf99 | ||
|
|
14d49f2944 | ||
|
|
8560069b19 | ||
|
|
8dc23a638f | ||
|
|
5363557faf | ||
|
|
3c026004f3 | ||
|
|
651c8f266b | ||
|
|
a3bfbe66c4 | ||
|
|
563e40adc6 | ||
|
|
f88a784a87 | ||
|
|
01df5e86cd | ||
|
|
41f853b6c9 | ||
|
|
6162c731f2 | ||
|
|
4f1d518ef3 | ||
|
|
a97f581c99 | ||
|
|
036179ec4d | ||
|
|
d33188dedf | ||
|
|
7033f95273 | ||
|
|
00689d76cc | ||
|
|
86d97ef331 | ||
|
|
05a183f46f | ||
|
|
50959d2e9c | ||
|
|
519ce0d5bb | ||
|
|
f06842cdcb | ||
|
|
d5a1caad10 | ||
|
|
e51fff4120 | ||
|
|
a1a520ec39 | ||
|
|
1b714a9962 | ||
|
|
9d133096c7 | ||
|
|
ab10271b4d | ||
|
|
ac2eba4734 | ||
|
|
b64893436b | ||
|
|
ee148239d2 | ||
|
|
4cc03aee9b | ||
|
|
31a703952c | ||
|
|
69c63f708d | ||
|
|
ae08c5b56e | ||
|
|
dc76dcdc2f | ||
|
|
6a040d16ea | ||
|
|
30e8d04b70 | ||
|
|
2b3375ad41 | ||
|
|
8a059a5520 | ||
|
|
49a2f02b54 | ||
|
|
ef92f24d35 | ||
|
|
0207914592 | ||
|
|
5776c97744 | ||
|
|
180cdf2a08 | ||
|
|
47720948ff | ||
|
|
7814a2b622 | ||
|
|
06981fb894 | ||
|
|
19dbd9901d | ||
|
|
4985b0a85d | ||
|
|
39f99d6ce7 | ||
|
|
c8f25ea4b3 | ||
|
|
cab9e08066 | ||
|
|
2b83f82989 | ||
|
|
598e8fee9c | ||
|
|
6f3a788101 | ||
|
|
30ff349b37 | ||
|
|
4018797384 | ||
|
|
a1efde6ef9 | ||
|
|
3f84972bfd |
@@ -1,2 +1,5 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_jikimo_workorder_exception","access.jikimo.workorder.exception","model_jikimo_workorder_exception","mrp.group_mrp_user",1,1,1,0
|
||||
"access_jikimo_workorder_exception_group_quality","access.jikimo.workorder.exception.group_quality","model_jikimo_workorder_exception","sf_base.group_quality",1,1,1,0
|
||||
"access_jikimo_workorder_exception_group_quality_director","access.jikimo.workorder.exception.group_quality_director","model_jikimo_workorder_exception","sf_base.group_quality_director",1,1,1,0
|
||||
|
||||
|
||||
|
@@ -402,3 +402,11 @@ class MachiningAccuracy(models.Model):
|
||||
name = fields.Char('一般公差', index=True)
|
||||
standard_tolerance = fields.Char(string="标准公差")
|
||||
sync_id = fields.Char('同步ID')
|
||||
|
||||
|
||||
class ReSaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
person_of_delivery = fields.Char('收货人')
|
||||
telephone_of_delivery = fields.Char('电话号码')
|
||||
address_of_delivery = fields.Char('联系地址')
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
<field name="category_id" ref="base.module_category_manufacturing_manufacturing"/>
|
||||
</record>
|
||||
|
||||
<record id="group_production_engineer" model="res.groups">
|
||||
<field name="name">工艺工程师</field>
|
||||
<field name="implied_ids" eval="[(4, ref('group_sf_mrp_user'))]"/>
|
||||
<field name="category_id" ref="base.module_category_manufacturing_manufacturing"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.module.category" id="module_category_plan">
|
||||
<field name="name">计划</field>
|
||||
@@ -65,7 +70,7 @@
|
||||
<record id="group_plan_dispatch" model="res.groups">
|
||||
<field name="name">计划调度岗</field>
|
||||
<field name="category_id" ref="module_category_plan"/>
|
||||
<!-- <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> -->
|
||||
<!-- <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> -->
|
||||
</record>
|
||||
|
||||
<record id="group_plan_director" model="res.groups">
|
||||
|
||||
@@ -36,6 +36,7 @@ class StatusChange(models.Model):
|
||||
# 使用super()来调用原始方法(在本例中为'sale.order'模型的'action_confirm'方法)
|
||||
try:
|
||||
res = super(StatusChange, self).action_confirm()
|
||||
logging.info('原生方法返回结果:%s' % res)
|
||||
# 原有方法执行后,进行额外的操作(如调用外部API)
|
||||
process_start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
@@ -61,6 +62,7 @@ class StatusChange(models.Model):
|
||||
traceback_error = traceback.format_exc()
|
||||
logging.error("工厂加工同步订单状态失败:%s " % traceback_error)
|
||||
raise UserError(e)
|
||||
logging.info('最终返回值:%s' % res)
|
||||
return res
|
||||
|
||||
def action_cancel(self):
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form//sheet//notebook//page[@name='operations']" position="after">
|
||||
<page string="发货信息" name="tracking">
|
||||
<page string="发货信息" name="tracking" attrs="{'invisible': [('picking_type_code', '!=', 'outgoing')]}">
|
||||
<group>
|
||||
<group>
|
||||
<field name="senderNickName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'],
|
||||
'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing','jikimo_attachment_viewer'],
|
||||
'data': [
|
||||
'data/stock_data.xml',
|
||||
'views/product_template_management_view.xml',
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<field name='categ_id' class="custom_required" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name='part_name' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||
<field name="upload_model_file"
|
||||
@@ -110,13 +111,13 @@
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="2D加工图纸">
|
||||
<page string="2D加工图纸" attrs="{'invisible': [('categ_type', '!=', '成品')]}">
|
||||
<field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}"
|
||||
widget="adaptive_viewer"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="质检标准">
|
||||
<page string="质检标准" attrs="{'invisible': [('categ_type', '!=', '成品')]}">
|
||||
<field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}"
|
||||
widget="adaptive_viewer"/>
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
from . import hr_employee
|
||||
from . import res_config_setting
|
||||
from . import res_users
|
||||
|
||||
@@ -11,6 +11,42 @@ class JkmPracticeEmployee(models.Model):
|
||||
|
||||
we_id = fields.Char(string='企微ID', index=True)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for val in vals_list:
|
||||
if 'work_email' in val:
|
||||
val["we_id"] = self._get_we_id(val.get('work_email'))
|
||||
return super(JkmPracticeEmployee, self).create(vals_list)
|
||||
|
||||
def write(self, vals):
|
||||
if 'work_email' in vals:
|
||||
vals["we_id"] = self._get_we_id(vals.get('work_email'))
|
||||
return super(JkmPracticeEmployee, self).write(vals)
|
||||
|
||||
@api.depends('work_contact_id', 'work_contact_id.mobile', 'work_contact_id.email')
|
||||
def _compute_work_contact_details(self):
|
||||
for employee in self:
|
||||
if employee.work_contact_id:
|
||||
employee.mobile_phone = employee.work_contact_id.mobile
|
||||
employee.work_email = employee.work_contact_id.email
|
||||
if employee.work_contact_id.email:
|
||||
employee.we_id = self._get_we_id(employee.work_contact_id.email)
|
||||
|
||||
def _get_we_id(self, work_email):
|
||||
json1 = {
|
||||
'params': {
|
||||
'work_email': work_email
|
||||
}
|
||||
}
|
||||
url = '/api/get/we_id/info'
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
ret = requests.post((config['ims_url'] + url), json=json1, data={})
|
||||
result = ret.json()['result']
|
||||
if result['code'] == 200:
|
||||
if result['we_id']:
|
||||
return result['we_id']
|
||||
return None
|
||||
|
||||
def _employee_info_sync(self):
|
||||
url = '/api/get/organization'
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
|
||||
15
sf_hr/models/res_users.py
Normal file
15
sf_hr/models/res_users.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import random
|
||||
from odoo import models, fields, api
|
||||
from odoo.http import request
|
||||
from odoo.exceptions import AccessDenied
|
||||
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
we_employee_id = fields.Char(string=u'企业微信账号', related='employee_id.we_id', default="")
|
||||
@@ -62,22 +62,22 @@ class SfMaintenanceEquipmentOEE(models.Model):
|
||||
("封存(报废)", "封存(报废)")],
|
||||
default='正常', string="机床状态", related='equipment_id.state')
|
||||
|
||||
online_time = fields.Char('开机时长(小时)', reaonly='True')
|
||||
online_time = fields.Char('开机时长(小时)', readonly='True')
|
||||
|
||||
offline_time = fields.Char('关机时长(小时)', reaonly='True')
|
||||
idle_nums = fields.Integer('待机次数', reaonly='True')
|
||||
offline_time = fields.Char('关机时长(小时)', readonly='True')
|
||||
idle_nums = fields.Integer('待机次数', readonly='True')
|
||||
# 待机时长
|
||||
|
||||
idle_time = fields.Char('待机时长(小时)', reaonly='True')
|
||||
idle_time = fields.Char('待机时长(小时)', readonly='True')
|
||||
|
||||
# 待机率
|
||||
idle_rate = fields.Char('待机率(%)', reaonly='True')
|
||||
idle_rate = fields.Char('待机率(%)', readonly='True')
|
||||
|
||||
work_time = fields.Char('加工时长(小时)', reaonly='True')
|
||||
work_rate = fields.Char('可用率(%)', reaonly='True')
|
||||
fault_time = fields.Char('故障时长(小时)', reaonly='True')
|
||||
fault_rate = fields.Char('故障率(%)', reaonly='True')
|
||||
fault_nums = fields.Integer('故障次数', reaonly='True')
|
||||
work_time = fields.Char('加工时长(小时)', readonly='True')
|
||||
work_rate = fields.Char('可用率(%)', readonly='True')
|
||||
fault_time = fields.Char('故障时长(小时)', readonly='True')
|
||||
fault_rate = fields.Char('故障率(%)', readonly='True')
|
||||
fault_nums = fields.Integer('故障次数', readonly='True')
|
||||
|
||||
# 设备故障日志
|
||||
sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_oee_id', '设备故障日志',
|
||||
@@ -367,25 +367,25 @@ class SfMaintenanceEquipmentOEELog(models.Model):
|
||||
[("ZXJGZX", "钻铣加工中心"), ("CXJGZX", "车削加工中心"), ("FHJGZX", "复合加工中心")],
|
||||
default="", string="功能类型")
|
||||
machine_tool_picture = fields.Binary('设备图片')
|
||||
type_id = fields.Many2one('sf.machine_tool.type', '品牌型号', reaonly='True')
|
||||
type_id = fields.Many2one('sf.machine_tool.type', '品牌型号', readonly='True')
|
||||
state = fields.Selection([("加工", "加工"), ("关机", "关机"), ("待机", "待机"), ("故障", "故障"),
|
||||
("检修", "检修"), ("保养", "保养")], default="", string="实时状态")
|
||||
online_time = fields.Char('开机时长', reaonly='True')
|
||||
online_time = fields.Char('开机时长', readonly='True')
|
||||
|
||||
offline_time = fields.Char('关机时长', reaonly='True')
|
||||
offline_nums = fields.Integer('关机次数', reaonly='True')
|
||||
offline_time = fields.Char('关机时长', readonly='True')
|
||||
offline_nums = fields.Integer('关机次数', readonly='True')
|
||||
# 待机时长
|
||||
|
||||
idle_time = fields.Char('待机时长', reaonly='True')
|
||||
idle_time = fields.Char('待机时长', readonly='True')
|
||||
|
||||
# 待机率
|
||||
idle_rate = fields.Char('待机率', reaonly='True')
|
||||
idle_rate = fields.Char('待机率', readonly='True')
|
||||
|
||||
work_time = fields.Char('加工时长', reaonly='True')
|
||||
work_rate = fields.Char('可用率', reaonly='True')
|
||||
fault_time = fields.Char('故障时长', reaonly='True')
|
||||
fault_rate = fields.Char('故障率', reaonly='True')
|
||||
fault_nums = fields.Integer('故障次数', reaonly='True')
|
||||
work_time = fields.Char('加工时长', readonly='True')
|
||||
work_rate = fields.Char('可用率', readonly='True')
|
||||
fault_time = fields.Char('故障时长', readonly='True')
|
||||
fault_rate = fields.Char('故障率', readonly='True')
|
||||
fault_nums = fields.Integer('故障次数', readonly='True')
|
||||
|
||||
detail_ids = fields.One2many('maintenance.equipment.oee.log.detail', 'log_id', string='日志详情')
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ access_maintenance_equipment_agv_log,maintenance_equipment_agv_log,model_mainten
|
||||
|
||||
access_maintenance_system_user,equipment.request system user,maintenance.model_maintenance_request,base.group_user,1,1,1,0
|
||||
access_maintenance_wizard_system_user,maintenance.request.wizard system user,model_maintenance_request_wizard,base.group_user,1,1,1,0
|
||||
access_maintenance_sf_group_equipment_user,equipment.request_sf_group_equipment_user,maintenance.model_maintenance_request,sf_group_equipment_user,1,1,1,0
|
||||
access_maintenance_wizard_sf_group_equipment_user,maintenance_wizard_sf_group_equipment_user,model_maintenance_request_wizard,sf_group_equipment_user,1,1,1,0
|
||||
access_maintenance_sf_group_equipment_manager,equipment.request_sf_group_equipment_manager,maintenance.model_maintenance_request,sf_group_equipment_manager,1,1,1,0
|
||||
access_maintenance_wizard_sf_group_equipment_manager,maintenance_wizard_sf_group_equipment_manager,model_maintenance_request_wizard,sf_group_equipment_manager,1,1,1,0
|
||||
|
||||
access_maintenance_equipment_group_plan_dispatch,maintenance.equipment,maintenance.model_maintenance_equipment,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_maintenance_equipment_oee_group_plan_dispatch,maintenance_equipment_oee,model_maintenance_equipment_oee,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
@@ -80,13 +80,19 @@
|
||||
<field name="user_id" string="维保人"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='close_date']" position="replace">
|
||||
<field name="close_date" attrs="{'invisible': [('done', '!=', True)]}" readonly="True" string="维保日期"/>
|
||||
<field name="close_date" attrs="{'invisible': [('done', '!=', True)]}" readonly="True"
|
||||
string="维保日期"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='request_date']" position="attributes">
|
||||
<attribute name="string">计划维保日期</attribute>
|
||||
</xpath>
|
||||
|
||||
<sheet>
|
||||
|
||||
<notebook>
|
||||
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}" context="{'default_standard_id': 'id'}">
|
||||
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}"
|
||||
context="{'default_standard_id': 'id'}">
|
||||
<field name="maintenance_standards" widget="one2many_list">
|
||||
<tree multi_edit="" editable="">
|
||||
<field name="name" class="table_custom_required"/>
|
||||
@@ -98,11 +104,33 @@
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
|
||||
</sheet>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="maintenance_request_view_tree_sf" model="ir.ui.view">
|
||||
<field name="name">maintenance.request.view.tree.sf</field>
|
||||
<field name="model">maintenance.request</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='request_date']" position="replace">
|
||||
<field name="request_date" string="计划维保日期"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<field name="sf_maintenance_type"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="equipment_request_view_search_sf" model="ir.ui.view">
|
||||
<field name="name">maintenance.request.view.search.sf</field>
|
||||
<field name="model">maintenance.request</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='inactive']" position="replace">
|
||||
<filter string="不活跃的" name="inactive" domain="[('archive', '=', True)]"/>
|
||||
<filter string="已归档" name="in_active" domain="[('active', '=', False)]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -110,8 +138,8 @@
|
||||
<record id="hr_equipment_request_action1" model="ir.actions.act_window">
|
||||
<field name="name">维保计划</field>
|
||||
<field name="res_model">maintenance.request</field>
|
||||
<field name="view_mode">kanban,tree,form,pivot,graph,calendar</field>
|
||||
<field name="view_id" ref="maintenance.hr_equipment_request_view_kanban"/>
|
||||
<field name="view_mode">tree,kanban,form,pivot,graph,calendar</field>
|
||||
<field name="view_id" ref="sf_maintenance.maintenance_request_view_tree_sf"/>
|
||||
<field name="context">{'default_user_id': uid}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse'],
|
||||
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse','jikimo_attachment_viewer'],
|
||||
'data': [
|
||||
'data/stock_data.xml',
|
||||
'data/empty_racks_data.xml',
|
||||
@@ -29,6 +29,7 @@
|
||||
'views/production_line_view.xml',
|
||||
'views/mrp_workcenter_views.xml',
|
||||
'views/mrp_workorder_view.xml',
|
||||
'views/stock_picking_view.xml',
|
||||
'views/model_type_view.xml',
|
||||
'views/agv_setting_views.xml',
|
||||
'views/sf_maintenance_equipment.xml',
|
||||
@@ -45,6 +46,8 @@
|
||||
'sf_manufacturing/static/src/scss/kanban_change.scss',
|
||||
'sf_manufacturing/static/src/xml/button_show_on_tree.xml',
|
||||
'sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js',
|
||||
'sf_manufacturing/static/src/js/qr.js',
|
||||
'sf_manufacturing/static/src/xml/qr.xml',
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
@@ -141,12 +141,14 @@ class MrpProduction(models.Model):
|
||||
], string='工序状态', default='待装夹')
|
||||
|
||||
# 零件图号
|
||||
part_number = fields.Char('零件图号', readonly=True)
|
||||
part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
|
||||
|
||||
# 上传零件图纸
|
||||
part_drawing = fields.Binary('零件图纸', readonly=True)
|
||||
part_drawing = fields.Binary('零件图纸', related='product_id.machining_drawings', readonly=True)
|
||||
|
||||
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', related='product_id.quality_standard', readonly=True)
|
||||
|
||||
part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True)
|
||||
|
||||
@api.depends('product_id.manual_quotation')
|
||||
def _compute_manual_quotation(self):
|
||||
@@ -806,6 +808,8 @@ class MrpProduction(models.Model):
|
||||
'date_to': date_planned_end,
|
||||
})
|
||||
# work.write({'date_planned_start': date_planned_start, 'date_planned_finished': date_planned_end})
|
||||
# 设置一个较大的结束时间,防止在设置开始时间时,结束时间小于开始时间
|
||||
work.date_planned_finished = datetime.datetime.today() + datetime.timedelta(days=100)
|
||||
work.date_planned_start = date_planned_start
|
||||
work.date_planned_finished = date_planned_end
|
||||
routing_workcenter = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
|
||||
@@ -59,7 +59,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
compute='_compute_state', store=True,
|
||||
default='pending', copy=False, readonly=True, recursive=True, index=True, tracking=True)
|
||||
|
||||
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效')
|
||||
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效',
|
||||
tracking=True)
|
||||
|
||||
@api.depends('production_id.manual_quotation')
|
||||
def _compute_manual_quotation(self):
|
||||
@@ -227,6 +228,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
part_number = fields.Char(related='production_id.part_number', string='零件图号')
|
||||
machining_drawings = fields.Binary('2D加工图纸', related='production_id.part_drawing', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', related='production_id.quality_standard', readonly=True)
|
||||
part_name = fields.Char(related='production_id.part_name', string='零件名称')
|
||||
|
||||
# 工序状态
|
||||
process_state = fields.Selection([
|
||||
@@ -305,6 +307,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
is_delivery = fields.Boolean('是否配送完成', default=False)
|
||||
rfid_code = fields.Char('RFID码')
|
||||
rfid_code_old = fields.Char('RFID码(已解除)')
|
||||
is_test_env = fields.Boolean('测试环境', default=False)
|
||||
|
||||
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
|
||||
string='生产线', store=True, tracking=True)
|
||||
@@ -320,6 +323,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
is_rework = fields.Boolean(string='是否返工', default=False)
|
||||
|
||||
def button_change_env(self):
|
||||
self.is_test_env = not self.is_test_env
|
||||
|
||||
@api.constrains('blocked_by_workorder_ids')
|
||||
def _check_no_cyclic_dependencies(self):
|
||||
if self.production_id.state not in ['rework'] and self.state not in ['rework']:
|
||||
@@ -1105,6 +1111,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
if self.routing_type == '装夹预调':
|
||||
# 判断是否有坯料的序列号信息
|
||||
boolean = False
|
||||
if self.production_id.move_raw_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
boolean = True
|
||||
|
||||
@@ -141,11 +141,11 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_coarse_medium_fine = fields.Selection(related='cutting_tool_model_id.integral_coarse_medium_fine', string='粗/中/精')
|
||||
# cutting_tool_model_id.integral_coarse_medium_fine
|
||||
# cutting_tool_run_out_accuracy_max = fields.Float('端跳精度max', digits=(6, 1))
|
||||
cutting_tool_run_out_accuracy_max = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_max', string='端跳精度max', digits=(6, 1))
|
||||
cutting_tool_run_out_accuracy_max = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_max', string='端跳精度max')
|
||||
# cutting_tool_model_id.integral_run_out_accuracy_max
|
||||
# cutting_tool_run_out_accuracy_min = fields.Float('端跳精度min', digits=(6, 1))
|
||||
cutting_tool_run_out_accuracy_min = fields.Char(related='cutting_tool_model_id.integral_run_out_accuracy_min',
|
||||
string='端跳精度min', digits=(6, 1))
|
||||
string='端跳精度min')
|
||||
# cutting_tool_model_id.integral_run_out_accuracy_min
|
||||
# cutting_tool_blade_tip_working_size = fields.Char('刀尖倒角度(°)', size=20)
|
||||
cutting_tool_blade_tip_working_size = fields.Char(related='specification_id.blade_tip_working_size',
|
||||
@@ -777,8 +777,7 @@ class ResProductMo(models.Model):
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
machining_drawings_name = fields.Char('2D加工图纸名', readonly=True)
|
||||
quality_standard_name = fields.Char('质检标准名', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', readonly=True)
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
@@ -840,10 +839,10 @@ class ResProductMo(models.Model):
|
||||
else:
|
||||
return self.env.ref('sf_dlm.product_uom_cubic_millimeter')
|
||||
|
||||
def attachment_update(self, name, res_id, res_field):
|
||||
def attachment_update(self, name, res_id, res_field, mimetype):
|
||||
attachment_info = self.env['ir.attachment'].sudo().search(
|
||||
[('res_id', '=', res_id), ('res_field', '=', res_field)], limit=1)
|
||||
attachment_info.write({'name': name})
|
||||
attachment_info.write({'name': name, 'mimetype': mimetype})
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
def product_create(self, product_id, item, order_id, order_number, i):
|
||||
@@ -883,11 +882,10 @@ class ResProductMo(models.Model):
|
||||
'manual_quotation': item['manual_quotation'] or False,
|
||||
'part_number': item.get('part_number') or '',
|
||||
'active': True,
|
||||
'machining_drawings_name': item['machining_drawings_name'],
|
||||
'quality_standard_name': item['quality_standard_name'],
|
||||
'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(
|
||||
item['machining_drawings']),
|
||||
'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
|
||||
'part_name': item['part_name'],
|
||||
}
|
||||
tax_id = self.env['account.tax'].sudo().search(
|
||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||
@@ -895,12 +893,12 @@ class ResProductMo(models.Model):
|
||||
vals.update({'taxes_id': [(6, 0, [int(tax_id)])]})
|
||||
copy_product_id.sudo().write(vals)
|
||||
product_id.product_tmpl_id.active = False
|
||||
if item['machining_drawings'] and item['machining_drawings_name']:
|
||||
if item['machining_drawings'] and item['machining_drawings_name'] and item['machining_drawings_mimetype']:
|
||||
self.attachment_update(item['machining_drawings_name'], copy_product_id.product_tmpl_id.id,
|
||||
'machining_drawings')
|
||||
if item['quality_standard'] and item['quality_standard_name']:
|
||||
'machining_drawings', item['machining_drawings_mimetype'])
|
||||
if item['quality_standard'] and item['quality_standard_name'] and item['quality_standard_mimetype']:
|
||||
self.attachment_update(item['quality_standard_name'], copy_product_id.product_tmpl_id.id,
|
||||
'quality_standard')
|
||||
'quality_standard', item['quality_standard_mimetype'])
|
||||
return copy_product_id
|
||||
|
||||
def _get_ids(self, param):
|
||||
|
||||
@@ -272,21 +272,6 @@ class StockRule(models.Model):
|
||||
workorder_duration += workorder.duration_expected
|
||||
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||
# 根据销售订单号查询快速订单
|
||||
quick_easy_order = self.env['quick.easy.order'].sudo().search([('sale_order_id', '=', sale_order.id)])
|
||||
if quick_easy_order:
|
||||
production.write({'part_number': quick_easy_order.part_drawing_number,
|
||||
'part_drawing': quick_easy_order.machining_drawings})
|
||||
else:
|
||||
production.write({'part_number': production.product_id.part_number,
|
||||
'part_drawing': production.product_id.machining_drawings,
|
||||
'quality_standard': production.product_id.quality_standard})
|
||||
if production.product_id.machining_drawings and production.product_id.machining_drawings_name:
|
||||
self.attachment_update(production.product_id.machining_drawings_name, production.id,
|
||||
'part_drawing')
|
||||
if production.product_id.quality_standard and production.product_id.quality_standard_name:
|
||||
self.attachment_update(production.product_id.quality_standard_name, production.id,
|
||||
'quality_standard')
|
||||
if sale_order:
|
||||
# sale_order.write({'schedule_status': 'to schedule'})
|
||||
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
||||
@@ -563,6 +548,42 @@ class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")
|
||||
person_of_delivery = fields.Char('收货人', compute='_compute_move_ids', store=True)
|
||||
telephone_of_delivery = fields.Char('电话号码', compute='_compute_move_ids', store=True)
|
||||
address_of_delivery = fields.Char('联系地址', compute='_compute_move_ids', store=True)
|
||||
|
||||
retrospect_ref = fields.Char('追溯参考', compute='_compute_move_ids', store=True)
|
||||
|
||||
@api.depends('move_ids')
|
||||
def _compute_move_ids(self):
|
||||
for item in self:
|
||||
if item.move_ids:
|
||||
if item.picking_type_id.sequence_code == 'DL':
|
||||
sale_name = item.move_ids[0].product_id.name.split('-')[1]
|
||||
if 'S' in sale_name:
|
||||
sale_id = self.env['sale.order'].sudo().search([('name', '=', sale_name)])
|
||||
item.person_of_delivery = sale_id.person_of_delivery
|
||||
item.telephone_of_delivery = sale_id.telephone_of_delivery
|
||||
item.address_of_delivery = sale_id.address_of_delivery
|
||||
else:
|
||||
raise ValidationError('坯料名称格式错误,正确格式为[R-S???-?]!!!')
|
||||
move_ids = []
|
||||
for move_id in item.move_ids:
|
||||
move_ids.append(move_id.product_id.id)
|
||||
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
||||
default_codes = ''
|
||||
if boms:
|
||||
for bom in boms:
|
||||
code = bom.product_tmpl_id.default_code.split('-')[-1]
|
||||
default_code = bom.product_tmpl_id.default_code.split(f'-{code}')[0]
|
||||
if default_code not in default_codes:
|
||||
if default_codes == '':
|
||||
default_codes = default_code
|
||||
else:
|
||||
default_codes = default_codes + ',' + default_code
|
||||
item.retrospect_ref = default_codes
|
||||
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
||||
pass
|
||||
|
||||
# 设置外协出入单的名称
|
||||
def _get_name_Res(self, rescode):
|
||||
@@ -756,6 +777,8 @@ class ReStockMove(models.Model):
|
||||
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
||||
elif self.product_id.tracking == "lot":
|
||||
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
||||
if not self.move_line_nosuggest_ids:
|
||||
self._generate_serial_numbers()
|
||||
|
||||
return {
|
||||
'name': _('Detailed Operations'),
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="group_show_button" model="res.groups">
|
||||
<field name="name">演示模式</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
|
||||
@@ -168,4 +168,3 @@ access_sf_agv_scheduling_group_sf_equipment_user,sf_agv_scheduling_group_sf_equi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
115
sf_manufacturing/static/src/js/qr.js
Normal file
115
sf_manufacturing/static/src/js/qr.js
Normal file
@@ -0,0 +1,115 @@
|
||||
/** @odoo-module **/
|
||||
import { registry } from '@web/core/registry';
|
||||
import { Component } from '@odoo/owl';
|
||||
|
||||
class QRCodeWidget extends Component {
|
||||
// 初始化组件
|
||||
setup() {
|
||||
console.log('QRCodeWidget setup');
|
||||
this.qrCodeValue = ''; // 初始化为空字符串,用于存储条码
|
||||
this.inputBuffer = ''; // 存储临时输入的字符
|
||||
this.inputTimer = null; // 定时器
|
||||
|
||||
// 显式绑定上下文
|
||||
this.onGlobalKeyDown = this.onGlobalKeyDown.bind(this);
|
||||
window.addEventListener('keydown', this.onGlobalKeyDown);
|
||||
}
|
||||
|
||||
// 清理事件监听器,防止内存泄漏
|
||||
willUnmount() {
|
||||
window.removeEventListener('keydown', this.onGlobalKeyDown);
|
||||
if (this.inputTimer) {
|
||||
clearTimeout(this.inputTimer);
|
||||
}
|
||||
}
|
||||
|
||||
// 全局键盘事件监听器
|
||||
onGlobalKeyDown(event) {
|
||||
|
||||
// 如果是Tab键,表示扫码输入结束
|
||||
if (event.key === 'Tab' || event.key === 'Enter') {
|
||||
this.qrCodeValue = this.inputBuffer; // 完整条码赋值
|
||||
console.log('完整条码:', this.qrCodeValue);
|
||||
this.onQRCodeChange(this.qrCodeValue); // 调用父组件的 onQRCodeChange 方法
|
||||
this.inputBuffer = ''; // 清空临时缓冲区
|
||||
event.preventDefault(); // 阻止Tab键的默认行为
|
||||
return;
|
||||
}
|
||||
|
||||
// 只处理可打印字符
|
||||
if (event.key.length === 1) {
|
||||
this.inputBuffer += event.key; // 添加到缓冲区
|
||||
// console.log('当前缓冲区:', this.inputBuffer);
|
||||
|
||||
// 清除之前的定时器,重新开始计时
|
||||
if (this.inputTimer) {
|
||||
clearTimeout(this.inputTimer);
|
||||
}
|
||||
|
||||
// 启动一个定时器,如果500ms内没有新的输入,则认为条码输入完成
|
||||
this.inputTimer = setTimeout(() => {
|
||||
this.qrCodeValue = this.inputBuffer;
|
||||
// console.log('定时器触发,完整条码:', this.qrCodeValue);
|
||||
this.inputBuffer = ''; // 清空缓冲区
|
||||
}, 500); // 可以根据需要调整时间
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 处理二维码输入变更
|
||||
async onQRCodeChange(qrCodeValue) {
|
||||
console.log('onQRCodeChange二维码输入变更', qrCodeValue); // 检查二维码的输入是否被捕获
|
||||
|
||||
if (qrCodeValue) {
|
||||
// console.log('二维码输入变更');
|
||||
try {
|
||||
// 发起 RPC 请求
|
||||
const result = await this.env.services.rpc('/web/dataset/call_kw', {
|
||||
model: 'mrp.workorder',
|
||||
method: 'search_read',
|
||||
args: [
|
||||
[['rfid_code', '=', qrCodeValue]], // 查询条件
|
||||
['id'] // 返回的字段
|
||||
],
|
||||
kwargs: {}
|
||||
});
|
||||
|
||||
if (result.length > 0) {
|
||||
console.log('该二维码对应的工单存在!');
|
||||
} else {
|
||||
console.log('未找到对应的工单。');
|
||||
|
||||
const routingTypeField = document.querySelector('[name="routing_type"]');
|
||||
if (routingTypeField) {
|
||||
let fieldValue = routingTypeField.querySelector('span').getAttribute('raw-value');
|
||||
console.log('Routing Type Value:', fieldValue);
|
||||
// 清理多余的引号
|
||||
fieldValue = fieldValue ? fieldValue.replace(/["]+/g, '') : null;
|
||||
console.log(fieldValue);
|
||||
|
||||
if (fieldValue && fieldValue === '装夹预调') {
|
||||
// console.log('routing_type 为装夹预调');
|
||||
|
||||
// 检查 RFID 值
|
||||
if (!qrCodeValue || qrCodeValue.length <= 3) return;
|
||||
|
||||
// 查找 name="button_start" 按钮并触发点击事件
|
||||
const startButton = document.querySelector('[name="button_start"]');
|
||||
if (startButton) {
|
||||
startButton.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询工单时出错:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 返回模板名称
|
||||
static template = 'sf_manufacturing.QRCodeWidgetTemplate';
|
||||
}
|
||||
|
||||
// 将自定义字段注册到字段注册表
|
||||
registry.category('fields').add('qrcode_widget', QRCodeWidget);
|
||||
12
sf_manufacturing/static/src/xml/qr.xml
Normal file
12
sf_manufacturing/static/src/xml/qr.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-name="sf_manufacturing.QRCodeWidgetTemplate" owl="1">
|
||||
<!-- <div> -->
|
||||
<!-- <input type="text" t-att-value="props.value" placeholder="Scan QR code here" /> -->
|
||||
<!-- </div> -->
|
||||
<div t-esc="props.value">
|
||||
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<field name="production_line_id" readonly="1"/>
|
||||
<!-- <field name="production_line_state" readonly="1"/>-->
|
||||
<field name="part_name"/>
|
||||
<field name="part_number" string="成品的零件图号"/>
|
||||
<field name="tool_state"/>
|
||||
<field name="tool_state_remark" string="备注" attrs="{'invisible': [('tool_state', '!=', '1')]}"/>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<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,'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1}
|
||||
active_id,'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1,'search_default_filter_order_normal':1}
|
||||
</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_workorder">
|
||||
@@ -125,9 +125,9 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form" position="inside">
|
||||
<script src="sf_manufacturing/static/src/js/customRFID.js"/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//form" position="inside"> -->
|
||||
<!-- <script src="sf_manufacturing/static/src/js/customRFID.js"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//header/field[@name='state']" position="replace">
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="pending,waiting,ready,progress,to be detected,done,rework"/>
|
||||
@@ -197,7 +197,7 @@
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
||||
<!-- <button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"-->
|
||||
<!-- attrs="{'invisible': ['|','|','|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done'),('is_rework','=',True),'&',('rfid_code','in',['',False]),('state','=','done')]}"/>-->
|
||||
<button name="button_rework_pre" type="object" string="返工"
|
||||
<button name="button_rework_pre" type="object" string="异常反馈"
|
||||
class="btn-primary"
|
||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
|
||||
<button name="unbind_tray" type="object" string="解绑托盘"
|
||||
@@ -225,6 +225,7 @@
|
||||
<xpath expr="//label[1]" position="before">
|
||||
<!-- -->
|
||||
<field name="production_id" invisible="0"/>
|
||||
<field name="routing_type" string="工单类型" readonly="1"/>
|
||||
<field name="duration_expected" invisible="1"/>
|
||||
<field name="date_planned_start" invisible="1"/>
|
||||
<field name="date_planned_finished" invisible="1"/>
|
||||
@@ -246,11 +247,24 @@
|
||||
<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="0" cache="True"
|
||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
||||
<field name="is_test_env" invisible="1"/>
|
||||
<field name="rfid_code" force_save="1" readonly="1" cache="True"
|
||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}" widget='qrcode_widget'/>
|
||||
<field name="rfid_code" string="RFID码(手动输入框)" force_save="1" readonly="0" cache="True"
|
||||
attrs="{'invisible': ['|',('rfid_code_old', '!=', False), ('is_test_env', '=', False)]}"/>
|
||||
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
||||
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//header" position="inside">
|
||||
<div class="o_statusbar_buttons"><button name="button_change_env"
|
||||
type="object"
|
||||
string="演示模式"
|
||||
class="btn-primary"
|
||||
groups="sf_manufacturing.group_show_button"/>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//form//sheet//group//group//div[2]" position="replace">
|
||||
</xpath>
|
||||
<xpath expr="//form//sheet//group//group//div[1]" position="after">
|
||||
@@ -267,6 +281,7 @@
|
||||
<label for="material_height" string="高"/>
|
||||
<field name="material_height" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number" string="成品的零件图号"/>
|
||||
</xpath>
|
||||
<xpath expr="//label[1]" position="attributes">
|
||||
@@ -466,6 +481,15 @@
|
||||
<field name='X_deviation_angle' readonly="1"/>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<page string="2D加工图纸" attrs="{'invisible': [('routing_type','!=','装夹预调')]}">
|
||||
<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">
|
||||
@@ -519,6 +543,13 @@
|
||||
<!-- attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>-->
|
||||
<!-- </div>-->
|
||||
</page>
|
||||
<page string="2D加工图纸" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<field name="machining_drawings" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
|
||||
<page string="质检标准" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<field name="quality_standard" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
@@ -589,18 +620,6 @@
|
||||
mrp.group_mrp_manager,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user,sf_base.group_sf_order_user
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="2D加工图纸">
|
||||
<field name="machining_drawings" widget="adaptive_viewer"
|
||||
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="质检标准">
|
||||
<field name="quality_standard" widget="adaptive_viewer"
|
||||
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -641,6 +660,7 @@
|
||||
<separator/>
|
||||
<filter string="预警" name="filter_order_warning" domain="[('delivery_warning', '=', 'warning')]"/>
|
||||
<filter string="逾期" name="filter_order_overdue" domain="[('delivery_warning', '=', 'overdue')]"/>
|
||||
<filter string="正常" name="filter_order_normal" domain="[('delivery_warning', '=', 'normal')]"/>
|
||||
<separator/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -1,22 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="view_stock_move_operations_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">stock.move.operations.form.inherit.sf</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='action_assign_serial_show_details']" position="after">
|
||||
<button name="print_serial_numbers" string="序列号打印" type="object"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <record id="view_stock_move_operations_inherit_sf" model="ir.ui.view">-->
|
||||
<!-- <field name="name">stock.move.operations.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">stock.move</field>-->
|
||||
<!-- <field name="inherit_id" ref="stock.view_stock_move_operations"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//button[@name='action_assign_serial_show_details']" position="after">-->
|
||||
<!-- <button name="print_serial_numbers" string="序列号打印" type="object"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record model="ir.ui.view" id="view_picking_form_inherit_sf">
|
||||
<record model="ir.ui.view" id="view_picking_form_inherit_sf_1">
|
||||
<field name="name">stock.picking.form.inherit.sf</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<field name="retrospect_ref"/>
|
||||
<field name="person_of_delivery"/>
|
||||
<field name="telephone_of_delivery"/>
|
||||
<field name="address_of_delivery"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_vpicktree_1" model="ir.ui.view">
|
||||
<field name="name">sf.vpicktree.1</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.vpicktree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<field name="retrospect_ref"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_picking_internal_search_sf" model="ir.ui.view">
|
||||
<field name="name">stock.picking.search</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='picking_type']" position="after">
|
||||
<filter string="追溯参考" name="retrospect_ref" domain="[]"
|
||||
context="{'group_by': 'retrospect_ref'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
@@ -13,6 +13,19 @@
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="ir_cron_sale_order_recover_time_warning">
|
||||
<field name="name">检查销售订单是否完成并恢复正常时效</field>
|
||||
<field name="model_id" ref="model_sale_order"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model._recover_sale_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"/>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 销售订单逾期预警
|
||||
事项:共有[{{warning_num}}]({{url}})个销售订单有逾期风险
|
||||
事项:[共有{{warning_num}}个销售订单有逾期风险]({{url}})
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">urgent</field>
|
||||
<field name="content">### 销售订单已逾期提醒
|
||||
事项:共有[{{overdue_num}}]({{url}})个销售订单已逾期
|
||||
事项:[共有{{overdue_num}}个销售订单已逾期]({{url}})
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单逾期预警
|
||||
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
|
||||
事项:[共有{{warning_num}}个工单有逾期风险]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_pre_overdue" model="jikimo.message.template">
|
||||
@@ -109,7 +109,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单已逾期提醒
|
||||
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
|
||||
事项:[共有{{overdue_num}}个工单已逾期]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_cnc_overdue_warning" model="jikimo.message.template">
|
||||
@@ -121,7 +121,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单逾期预警
|
||||
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
|
||||
事项:[共有{{warning_num}}个工单有逾期风险]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_cnc_overdue" model="jikimo.message.template">
|
||||
@@ -133,7 +133,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单已逾期提醒
|
||||
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
|
||||
事项:[共有{{overdue_num}}个工单已逾期]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_unclamp_overdue_warning" model="jikimo.message.template">
|
||||
@@ -145,7 +145,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单逾期预警
|
||||
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
|
||||
事项:[共有{{warning_num}}个工单有逾期风险]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_unclamp_overdue" model="jikimo.message.template">
|
||||
@@ -157,7 +157,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单已逾期提醒
|
||||
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
|
||||
事项:[共有{{overdue_num}}个工单已逾期]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_surface_overdue_warning" model="jikimo.message.template">
|
||||
@@ -169,7 +169,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单逾期预警
|
||||
事项:共有[{{warning_num}}]({{url}})工单有逾期风险</field>
|
||||
事项:[共有{{warning_num}}个工单有逾期风险]({{url}})</field>
|
||||
</record>
|
||||
|
||||
<record id="template_mrp_workorder_surface_overdue" model="jikimo.message.template">
|
||||
@@ -181,7 +181,7 @@
|
||||
<field name="send_type">timing</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工单已逾期提醒
|
||||
事项:共有[{{overdue_num}}]({{url}})工单已逾期</field>
|
||||
事项:[共有{{overdue_num}}个工单已逾期]({{url}})</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 待质量判定提醒
|
||||
事项:共有[{{judge_num}}]({{url}})个工单需判定质量结果</field>
|
||||
事项:[共有{{judge_num}}个工单需判定质量结果]({{url}})</field>
|
||||
</record>
|
||||
<record id="template_maintenance_logs" model="jikimo.message.template">
|
||||
<field name="name">设备故障</field>
|
||||
|
||||
@@ -34,18 +34,19 @@ class SFMessageSale(models.Model):
|
||||
picking_id.procurement_group_id.stock_move_ids.move_orig_ids.purchase_line_id.order_id).ids
|
||||
purchase_order_id.extend(purchase_order_ids)
|
||||
if purchase_order_id:
|
||||
purchase_order_list = self.env['purchase.order'].search([('id', 'in', purchase_order_id)])
|
||||
purchase_order_list = self.env['purchase.order'].sudo().search([('id', 'in', purchase_order_id)])
|
||||
for purchase_order_info in purchase_order_list:
|
||||
purchase_order_info.add_queue('坯料采购提醒')
|
||||
except Exception as e:
|
||||
logging.info('add_queue error:%s' % e)
|
||||
logging.info('action_confirm res:%s' % res)
|
||||
return res
|
||||
|
||||
# 继承并重写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')
|
||||
url = self.env['ir.config_parameter'].sudo().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')
|
||||
@@ -60,7 +61,7 @@ class SFMessageSale(models.Model):
|
||||
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))])
|
||||
sale_order_line = self.env['sale.order.line'].sudo().search([('order_id', '=', int(item.res_id))])
|
||||
product = sale_order_line[0].product_id.name if len(sale_order_line) == 1 else '%s...' % \
|
||||
sale_order_line[
|
||||
0].product_id.name
|
||||
@@ -100,42 +101,49 @@ class SFMessageSale(models.Model):
|
||||
|
||||
# # 销售订单逾期预警和已逾期
|
||||
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}")
|
||||
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)
|
||||
today_str = datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S')
|
||||
today = today_str.strftime("%Y-%m-%d")
|
||||
# 计算下一天的日期
|
||||
deadline_check_str = today_str + timedelta(days=1)
|
||||
deadline_check = deadline_check_str.strftime("%Y-%m-%d")
|
||||
logging.info(
|
||||
f"today: {today}, deadline_check: {deadline_check},current_time_strf: {current_time_strf}, current_time: {current_time}'")
|
||||
sale_order = self.sudo().search(
|
||||
[('state', 'in', ['sale']), ('deadline_of_delivery', '!=', False), ('delivery_status', '!=', 'full')])
|
||||
for item in sale_order:
|
||||
production = self.env['mrp.production'].search([('origin', '=', item.name)])
|
||||
production = self.env['mrp.production'].sudo().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']))
|
||||
deadline_of_delivery = item.deadline_of_delivery.strftime("%Y-%m-%d")
|
||||
if (len(production_not_done) >= 1 and len(production_not_done) != item.mrp_production_count) or len(
|
||||
production_not_done) != production_done_count:
|
||||
logging.info("-----不等于----")
|
||||
logging.info(f"name: {item.name}")
|
||||
logging.info(
|
||||
f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
# logging.info("-----不等于----")
|
||||
# logging.info(f"name: {item.name}")
|
||||
# logging.info(
|
||||
# f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
# logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
if deadline_check == deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today >= item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
elif today >= deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
item.delivery_warning = 'overdue'
|
||||
elif production_done_count == item.mrp_production_count:
|
||||
logging.info("-----等于----")
|
||||
logging.info(f"name: {item.name}")
|
||||
logging.info(
|
||||
f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
# logging.info("-----等于----")
|
||||
# logging.info(f"name: {item.name}")
|
||||
# logging.info(
|
||||
# f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
# logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
if item.delivery_status in ['pending', 'partial']:
|
||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
if deadline_check == deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today >= item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
elif today >= deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
item.delivery_warning = 'overdue'
|
||||
else:
|
||||
logging.info("-----1111111----")
|
||||
logging.info(f"name: {item.name}")
|
||||
logging.info(
|
||||
f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
# logging.info("-----1111111----")
|
||||
# logging.info(f"name: {item.name}")
|
||||
# logging.info(
|
||||
# f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
continue
|
||||
# 获取业务节点
|
||||
business_node_ids = {
|
||||
@@ -146,11 +154,11 @@ class SFMessageSale(models.Model):
|
||||
for wo in overdue_orders:
|
||||
business_node_id = business_node_ids.get(wo.delivery_warning)
|
||||
if business_node_id:
|
||||
message_template = self.env["jikimo.message.template"].search([
|
||||
message_template = self.env["jikimo.message.template"].sudo().search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", business_node_id)
|
||||
], limit=1)
|
||||
sale_order_has = self.env['jikimo.message.queue'].search([
|
||||
sale_order_has = self.env['jikimo.message.queue'].sudo().search([
|
||||
('res_id', '=', wo.id),
|
||||
('message_status', '=', 'pending'),
|
||||
('message_template_id', '=', message_template.id)
|
||||
@@ -158,3 +166,32 @@ class SFMessageSale(models.Model):
|
||||
if not sale_order_has:
|
||||
message_name = '销售订单逾期预警' if wo.delivery_warning == 'warning' else '销售订单已逾期'
|
||||
wo.add_queue(message_name)
|
||||
if wo.delivery_warning == 'overdue':
|
||||
# 把消息队列中销售订单预警的状态改为取消发送
|
||||
business_node_id_warning = business_node_ids['warning']
|
||||
if business_node_id_warning:
|
||||
message_template_warning = self.env["jikimo.message.template"].search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", business_node_id_warning)
|
||||
], limit=1)
|
||||
if message_template_warning:
|
||||
sale_order_warning = self.env['jikimo.message.queue'].search([
|
||||
('res_id', '=', wo.id),
|
||||
('message_status', '=', 'pending'),
|
||||
('message_template_id', '=', message_template_warning.id)
|
||||
])
|
||||
if sale_order_warning:
|
||||
logging.info('取消发送:%s' % sale_order_warning)
|
||||
sale_order_warning.write({'message_status': 'cancel'})
|
||||
|
||||
def _recover_sale_time_warning_func(self):
|
||||
sale_order_done = self.sudo().search([('state', 'in', ['sale']), ('delivery_status', '=', 'full')])
|
||||
sale_order_overdue = sale_order_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
|
||||
if sale_order_overdue:
|
||||
sale_order_overdue.write({'delivery_warning': 'normal'})
|
||||
message_queue_ids = self.env["jikimo.message.queue"].sudo().search([
|
||||
("message_status", "=", "pending"),
|
||||
("res_id", "in", [item.id for item in sale_order_overdue])
|
||||
])
|
||||
if message_queue_ids:
|
||||
message_queue_ids.write({'message_status': 'cancel'})
|
||||
|
||||
@@ -29,14 +29,14 @@ class SFMessageStockPicking(models.Model):
|
||||
[('origin', '=', record.origin), ('state', '!=', 'done'),
|
||||
('picking_type_id.sequence_code', '=', 'SFP')])
|
||||
if not stock_picking_sfp:
|
||||
stock_picking_send = self.env["jikimo.message.queue"].search([('res_id', '=', record.id)])
|
||||
stock_picking_send = self.env["jikimo.message.queue"].sudo().search([('res_id', '=', record.id)])
|
||||
if not stock_picking_send:
|
||||
record.add_queue('订单发货提醒')
|
||||
|
||||
def deal_stock_picking_sfp(self, message_queue_id): # 处理订单发货提醒
|
||||
content = None
|
||||
stock_picking = self.env['stock.picking'].search([('id', '=', int(message_queue_id.res_id))])
|
||||
stock_picking_out = self.env['stock.picking'].search(
|
||||
stock_picking = self.env['stock.picking'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
stock_picking_out = self.env['stock.picking'].sudo().search(
|
||||
[('origin', '=', stock_picking.origin), ('state', '=', 'assigned'),
|
||||
('picking_type_id.sequence_code', '=', 'OUT')])
|
||||
if stock_picking_out and len(stock_picking_out) > 0:
|
||||
@@ -54,10 +54,10 @@ class SFMessageStockPicking(models.Model):
|
||||
i = 0
|
||||
if message_queue_id.message_template_id.name == '坯料发料提醒':
|
||||
content = message_queue_id.message_template_id.content
|
||||
stock_picking_line = self.env['stock.picking'].search([('id', '=', int(message_queue_id.res_id))])
|
||||
mrp_production_info = self.env['mrp.production'].search(
|
||||
stock_picking_line = self.env['stock.picking'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
mrp_production_info = self.env['mrp.production'].sudo().search(
|
||||
[('name', '=', stock_picking_line.origin)])
|
||||
mrp_production_list = self.env['mrp.production'].search(
|
||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', mrp_production_info.product_id.id)])
|
||||
for mrp_production_line in mrp_production_list:
|
||||
picking_ids = mrp_production_line.picking_ids
|
||||
@@ -87,9 +87,9 @@ class SFMessageStockPicking(models.Model):
|
||||
return super(SFMessageStockPicking, self).get_special_url(id, tmplate_name, special_name, model_id)
|
||||
|
||||
def request_url(self):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('stock.stock_picking_type_action').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||
menu_id = self.env['ir.model.data'].sudo().search([('name', '=', 'module_theme_treehouse')]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
||||
'view_type': 'kanban'}
|
||||
@@ -100,9 +100,9 @@ class SFMessageStockPicking(models.Model):
|
||||
return full_url
|
||||
|
||||
def request_url1(self, id):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||
menu_id = self.env['ir.model.data'].sudo().search([('name', '=', 'module_theme_treehouse')]).id
|
||||
# 查询参数
|
||||
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
||||
'view_type': 'form'}
|
||||
|
||||
@@ -26,7 +26,7 @@ class SFMessageWork(models.Model):
|
||||
contents = []
|
||||
product_id = []
|
||||
bussiness_node = None
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
url = self.env['ir.config_parameter'].sudo().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')
|
||||
@@ -39,8 +39,8 @@ class SFMessageWork(models.Model):
|
||||
for message_queue_id in message_queue_ids:
|
||||
if message_queue_id.message_template_id.name == '工单已下发通知':
|
||||
content = message_queue_id.message_template_id.content
|
||||
mrp_workorder_line = self.env['mrp.workorder'].search([('id', '=', int(message_queue_id.res_id))])
|
||||
mrp_workorder_list = self.env['mrp.workorder'].search(
|
||||
mrp_workorder_line = self.env['mrp.workorder'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
mrp_workorder_list = self.env['mrp.workorder'].sudo().search(
|
||||
[('product_id', '=', mrp_workorder_line.product_id.id), ('state', '=', 'ready'),
|
||||
('routing_type', '=', '装夹预调')])
|
||||
if len(mrp_workorder_list) > 0 and mrp_workorder_line.product_id.id not in product_id:
|
||||
@@ -61,20 +61,32 @@ class SFMessageWork(models.Model):
|
||||
second=0,
|
||||
microsecond=0
|
||||
)
|
||||
logging.info(current_time)
|
||||
logging.info(target_time)
|
||||
logging.info(target_time - time_range)
|
||||
logging.info(target_time + time_range)
|
||||
# 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))])
|
||||
record = self.sudo().search(search_condition + [('id', '=', int(message_queue_id.res_id))])
|
||||
if record:
|
||||
bussiness_node = item.bussiness_node_id.name
|
||||
# 分割业务节点名称,提取出业务节点关键字
|
||||
business_node_key = bussiness_node.split('工单')[0].strip()
|
||||
workcenter_mapping = {
|
||||
'装夹预调': '工件装夹',
|
||||
'CNC加工': '自动生产',
|
||||
'解除装夹': '工件拆卸',
|
||||
'表面工艺': '表面工艺外协',
|
||||
}
|
||||
workcenter_name = workcenter_mapping.get(business_node_key)
|
||||
active_id = self.env['mrp.workcenter'].search([('name', 'ilike', workcenter_name)],
|
||||
limit=1).id
|
||||
i += 1
|
||||
if i >= 1:
|
||||
action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}&active_id={active_id}"
|
||||
content_template = content.replace('{{url}}', url_with_id)
|
||||
if bussiness_node in template_names['预警']:
|
||||
content = content_template.replace('{{warning_num}}', str(i))
|
||||
@@ -84,10 +96,10 @@ class SFMessageWork(models.Model):
|
||||
return contents
|
||||
|
||||
def request_url(self):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id
|
||||
active_id = self.env['mrp.workcenter'].search([('name', '=', '工件装夹中心')]).id
|
||||
menu_id = self.env['ir.model.data'].sudo().search([('name', '=', 'module_stock_dropshipping')]).id
|
||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', '工件装夹中心')]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||
'view_type': 'list', 'active_id': active_id}
|
||||
@@ -98,7 +110,8 @@ class SFMessageWork(models.Model):
|
||||
return full_url
|
||||
|
||||
def _overdue_or_warning_func(self):
|
||||
workorders = self.env['mrp.workorder'].search([("state", "in", ["ready", "progress", "to be detected"])])
|
||||
workorders = self.env['mrp.workorder'].search(
|
||||
[("state", "in", ["ready", "progress", "to be detected"]), ('schedule_state', '=', '已排')])
|
||||
grouped_workorders = {}
|
||||
for workorder in workorders:
|
||||
routing_type = workorder.routing_type
|
||||
@@ -117,21 +130,25 @@ class SFMessageWork(models.Model):
|
||||
date_planned_finished = datetime.strptime(date_planned_finished_str, '%Y-%m-%d %H:%M:%S')
|
||||
twelve_hours_ago = current_time_datetime - timedelta(hours=12)
|
||||
if current_time_datetime >= date_planned_finished and item.delivery_warning not in ['overdue']:
|
||||
logging.info("------overdue-------")
|
||||
logging.info(f"Workorder: {item.production_id.name}, Current Time: {current_time_datetime}, "
|
||||
f"Planned Finish: {date_planned_finished}")
|
||||
# logging.info("------overdue-------")
|
||||
# logging.info(f"Workorder: {item.production_id.name}, Current Time: {current_time_datetime}, "
|
||||
# f"Planned Finish: {date_planned_finished}")
|
||||
item.delivery_warning = 'overdue'
|
||||
elif twelve_hours_ago <= current_time_datetime <= date_planned_finished and item.delivery_warning not in [
|
||||
'warning']:
|
||||
logging.info("------warning-------")
|
||||
logging.info(f"Workorder: {item.production_id.name}, Current Time: {current_time_datetime}, "
|
||||
f"Planned Finish: {date_planned_finished}")
|
||||
# logging.info("------warning-------")
|
||||
# logging.info(f"Workorder: {item.production_id.name}, Current Time: {current_time_datetime}, "
|
||||
# f"Planned Finish: {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,
|
||||
'装夹预调_overdue': self.env.ref('sf_message.bussiness_mrp_workorder_pre_overdue').id,
|
||||
'装夹预调_warning': self.env.ref('sf_message.bussiness_mrp_workorder_pre_overdue_warning').id,
|
||||
'CNC加工_overdue': self.env.ref('sf_message.bussiness_mrp_workorder_cnc_overdue').id,
|
||||
'CNC加工_warning': self.env.ref('sf_message.bussiness_mrp_workorder_cnc_overdue_warning').id,
|
||||
'解除装夹_overdue': self.env.ref('sf_message.bussiness_mrp_workorder_unclamp_overdue').id,
|
||||
'解除装夹_warning': self.env.ref('sf_message.bussiness_mrp_workorder_unclamp_overdue_warning').id,
|
||||
'表面工艺_overdue': self.env.ref('sf_message.bussiness_mrp_workorder_surface_overdue').id,
|
||||
'表面工艺_warning': 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),
|
||||
@@ -139,13 +156,17 @@ class SFMessageWork(models.Model):
|
||||
]) 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]:
|
||||
warning_type = 'warning' if item.delivery_warning == 'warning' else 'overdue'
|
||||
key = f"{item.routing_type}_{warning_type}"
|
||||
bussiness_node_id = business_node_ids.get(key, None)
|
||||
if bussiness_node_id:
|
||||
message_template = message_templates.get(key)
|
||||
if message_template and message_template.id:
|
||||
message_queue_ids = self.env["jikimo.message.queue"].sudo().search([
|
||||
("message_template_id", "=", message_templates[item.routing_type].id),
|
||||
("message_template_id", "=", message_template.id),
|
||||
("message_status", "=", "pending"),
|
||||
("res_id", "=", item.id)
|
||||
])
|
||||
], limit=1)
|
||||
if not message_queue_ids:
|
||||
overdue_message = '工单已逾期' if item.delivery_warning == 'overdue' else '工单逾期预警'
|
||||
queue_method_name = f'add_queue'
|
||||
@@ -153,8 +174,33 @@ class SFMessageWork(models.Model):
|
||||
args = [f'{item.routing_type}{overdue_message}']
|
||||
# 获取add_queue方法并调用它,传入参数列表
|
||||
getattr(item, queue_method_name)(*args)
|
||||
if item.delivery_warning == 'overdue':
|
||||
# 把消息队列中销售订单预警的状态改为取消发送
|
||||
key = f"{item.routing_type}_{'warning'}"
|
||||
business_node_id_warning = business_node_ids.get(key, None)
|
||||
if business_node_id_warning:
|
||||
message_template_warning = self.env["jikimo.message.template"].search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", business_node_id_warning)
|
||||
], limit=1)
|
||||
if message_template_warning:
|
||||
work_order_warning = self.env['jikimo.message.queue'].search([
|
||||
('res_id', '=', item.id),
|
||||
('message_status', '=', 'pending'),
|
||||
('message_template_id', '=', message_template_warning.id)
|
||||
])
|
||||
if work_order_warning:
|
||||
logging.info('取消发送:%s' % work_order_warning)
|
||||
work_order_warning.write({'message_status': 'cancel'})
|
||||
|
||||
def _recover_time_warning_func(self):
|
||||
workorder_done = self.env['mrp.workorder'].search([("state", "in", ["done", "rework", "cancel"])])
|
||||
workorder_overdue = workorder_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
|
||||
if workorder_overdue:
|
||||
workorder_overdue.write({'delivery_warning': 'normal'})
|
||||
message_queue_ids = self.env["jikimo.message.queue"].sudo().search([
|
||||
("message_status", "=", "pending"),
|
||||
("res_id", "in", [item.id for item in workorder_overdue])
|
||||
])
|
||||
if message_queue_ids:
|
||||
message_queue_ids.write({'message_status': 'cancel'})
|
||||
|
||||
@@ -5,24 +5,28 @@ access_jikimo_message_template_group_purchase,jikimo_message_template,jikimo_mes
|
||||
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_template_group_purchase_director,jikimo_message_template,jikimo_message_notify.model_jikimo_message_template,sf_base.group_purchase_director,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_bussiness_node_group_purchase_director,jikimo_message_bussiness_node,jikimo_message_notify.model_jikimo_message_bussiness_node,sf_base.group_purchase_director,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_queue_group_purchase_director,jikimo_message_queue,jikimo_message_notify.model_jikimo_message_queue,sf_base.group_purchase_director,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
|
||||
access_jikimo_message_reminder_time_group_purchase_director,jikimo_message_reminder_time,jikimo_message_notify.model_jikimo_message_reminder_time,sf_base.group_purchase_director,1,1,1,0
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -246,6 +246,7 @@ class sf_production_plan(models.Model):
|
||||
record.date_planned_finished = item.date_planned_finished
|
||||
# 计算下一个cnc工单的开始时间
|
||||
last_cnc_start = workorder_list[-1].date_planned_finished + timedelta(minutes=pre_duration)
|
||||
# 没有工单也能排程
|
||||
record.state = 'done'
|
||||
# record.production_id.schedule_state = '已排'
|
||||
record.sudo().production_id.schedule_state = '已排'
|
||||
|
||||
@@ -37,52 +37,4 @@ class Action_Plan_All_Wizard(models.TransientModel):
|
||||
# 判断能否排成
|
||||
self.plan_ids.deal_processing_schedule(self.date_planned_start)
|
||||
self.plan_ids.do_production_schedule()
|
||||
# for plan in temp_plan_ids:
|
||||
# # 处理每个计划
|
||||
# # 比如更新计划状态、分配资源等
|
||||
# # 示例:plan.state = 'scheduled'
|
||||
# print('处理计划:', plan.id)
|
||||
# # 拿到计划对象
|
||||
# plan_obj = self.env['sf.production.plan'].browse(plan.id)
|
||||
# plan_obj.production_line_id = self.production_line_id.id
|
||||
# plan.date_planned_start = self.date_planned_start
|
||||
# plan_obj.do_production_schedule()
|
||||
# plan_obj.state = 'done'
|
||||
_logger.info('处理计划: %s 完成', self.plan_ids.ids)
|
||||
|
||||
# # 获取当前生产线
|
||||
# production_line_id = self.production_line_id
|
||||
# # 获取当前生产线的所有生产订单
|
||||
# production_order_ids = self.env['mrp.production'].search([('production_line_id', '=', production_line_id.id)])
|
||||
# # 获取当前生产线的所有生产订单的id
|
||||
# production_order_id_list = []
|
||||
# for production_order_id in production_order_ids:
|
||||
# production_order_id_list.append(production_order_id.id)
|
||||
# # 获取当前生产线的所有生产订单的排程状态
|
||||
# production_order_plan_state_list = []
|
||||
# for production_order_id in production_order_ids:
|
||||
# production_order_plan_state_list.append(production_order_id.plan_state)
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已排程,则报错
|
||||
# if all(production_order_plan_state == '已排程' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已排程,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是未排程,则报错
|
||||
# if all(production_order_plan_state == '未排程' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都未排程,请先排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已完成,则报错
|
||||
# if all(production_order_plan_state == '已完成' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已完成,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已取消,则报错
|
||||
# if all(production_order_plan_state == '已取消' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已取消,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已暂停,则报错
|
||||
# if all(production_order_plan_state == '已暂停' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已暂停,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已完成,则报错
|
||||
# if all(production_order_plan_state == '已完成' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已完成,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已取消,则报错
|
||||
# if all(production_order_plan_state == '已取消' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已取消,请勿重复排程!')
|
||||
# # 如果当前生产线的所有生产订单的排程状态都是已暂停,则报错
|
||||
# if all(production_order_plan_state == '已暂停' for production_order_plan_state in production_order_plan_state_list):
|
||||
# raise UserError('当前生产线的所有生产订单都已暂停,请勿重复排程!')
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'author': 'jikimo',
|
||||
'website': 'https://sf.cs.jikimo.com',
|
||||
# 此处依赖sf_manufacturing是因为我要重写其中的一个字段operation_id的string,故需要sf_manufacturing先安装
|
||||
'depends': ['quality_control', 'web_widget_model_viewer', 'sf_manufacturing'],
|
||||
'depends': ['quality_control', 'web_widget_model_viewer', 'sf_manufacturing','jikimo_attachment_viewer'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/view.xml',
|
||||
|
||||
@@ -33,6 +33,7 @@ class SfQualityCncTest(models.Model):
|
||||
|
||||
machining_drawings = fields.Binary('2D加工图纸', related='workorder_id.machining_drawings', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', related='workorder_id.quality_standard', readonly=True)
|
||||
part_name = fields.Char(related='workorder_id.part_name', string='零件名称')
|
||||
|
||||
def submit_pass(self):
|
||||
if self.test_results in ['返工', '报废']:
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<field name="model_file" widget="Viewer3D"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number"/>
|
||||
<field name="processing_panel"/>
|
||||
</group>
|
||||
|
||||
@@ -220,7 +220,15 @@ class QuickEasyOrder(models.Model):
|
||||
'total_amount': item.price,
|
||||
'remark': '',
|
||||
'manual_quotation': True,
|
||||
'barcode': barcode
|
||||
'barcode': barcode,
|
||||
'part_number': item.part_drawing_number,
|
||||
'machining_drawings_name': '',
|
||||
'quality_standard_name': '',
|
||||
'machining_drawings_mimetype': '',
|
||||
'quality_standard_mimetype': '',
|
||||
'machining_drawings': item.machining_drawings,
|
||||
'quality_standard': '',
|
||||
'part_name': '',
|
||||
})
|
||||
# res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list'])
|
||||
product_id = self.env.ref('sf_dlm.product_template_sf').sudo()
|
||||
|
||||
@@ -32,9 +32,9 @@ class ReSaleOrder(models.Model):
|
||||
tracking=3,
|
||||
default='draft')
|
||||
deadline_of_delivery = fields.Date('订单交期', tracking=True)
|
||||
person_of_delivery = fields.Char('交货人')
|
||||
telephone_of_delivery = fields.Char('交货人电话号码')
|
||||
address_of_delivery = fields.Char('交货人地址')
|
||||
# person_of_delivery = fields.Char('收货人')
|
||||
# telephone_of_delivery = fields.Char('电话号码')
|
||||
# address_of_delivery = fields.Char('联系地址')
|
||||
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True)
|
||||
pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式')
|
||||
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
|
||||
@@ -55,7 +55,8 @@ 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='时效')
|
||||
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效',
|
||||
tracking=True)
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单
|
||||
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
||||
@@ -117,12 +118,16 @@ class ReSaleOrder(models.Model):
|
||||
|
||||
# 业务平台分配工厂时在创建完产品后再创建销售明细信息
|
||||
def sale_order_create_line(self, product, item):
|
||||
machining_accuracy_name = ''
|
||||
if product.model_machining_precision:
|
||||
machining_accuracy_name = self.env['sf.machining.accuracy'].sudo().search(
|
||||
[('sync_id', '=', product.model_machining_precision)]).name
|
||||
vals = {
|
||||
'order_id': self.id,
|
||||
'product_id': product.id,
|
||||
'name': '%s/%s/%s/%s/±%s/%s' % (
|
||||
'name': '%s/%s/%s/%s/%s/%s' % (
|
||||
product.model_long, product.model_width, product.model_height, product.model_volume,
|
||||
product.model_machining_precision,
|
||||
machining_accuracy_name,
|
||||
product.materials_id.name),
|
||||
'price_unit': product.list_price,
|
||||
'product_uom_qty': item['number'],
|
||||
@@ -203,6 +208,8 @@ class RePurchaseOrder(models.Model):
|
||||
compute='_compute_user_id',
|
||||
store=True)
|
||||
|
||||
purchase_type = fields.Selection([('standard', '标准采购'), ('consignment', '委外加工')], string='采购类型', default='standard')
|
||||
|
||||
@api.depends('partner_id')
|
||||
def _compute_user_id(self):
|
||||
if not self.user_id:
|
||||
|
||||
@@ -158,6 +158,11 @@
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
|
||||
<!-- 添加采购类型字段 -->
|
||||
<field name="partner_ref" position="after">
|
||||
<field name="purchase_type" string="采购类型" readonly="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
<field name="unit_price"/>
|
||||
<field name="price" options="{'format': false}"/>
|
||||
<field name="part_drawing_number"/>
|
||||
<!-- <field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="machining_drawings_name" invisible="1"/>-->
|
||||
<field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>
|
||||
<field name="machining_drawings_name" invisible="1"/>
|
||||
<field name="sale_order_id"
|
||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||
</group>
|
||||
|
||||
@@ -96,8 +96,8 @@
|
||||
</field>
|
||||
<field name="payment_term_id" position="after">
|
||||
<field name="deadline_of_delivery" readonly="0"/>
|
||||
<field name="payments_way" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="pay_way" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="payments_way" invisible="1"/>
|
||||
<field name="pay_way" invisible="1"/>
|
||||
<!-- <field name="schedule_status" readonly="1"/> -->
|
||||
</field>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
||||
@@ -181,17 +181,27 @@
|
||||
<attribute name="string">下单日期</attribute>
|
||||
</field>
|
||||
<field name="sale_order_template_id" position="after">
|
||||
<field name="person_of_delivery" string="交货人"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="telephone_of_delivery" string="交货人联系方式"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="address_of_delivery" string="交货人地址"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="remark" attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_order_form_inherit_sale_stock_sf">
|
||||
<field name="name">view_order_form_inherit_sale_stock.sf</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='picking_policy']" position="before">
|
||||
<field name="person_of_delivery" string="收货人"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="telephone_of_delivery" string="电话号码"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
<field name="address_of_delivery" string="联系地址"
|
||||
attrs="{'readonly': [('state', 'in', ('sale','cancel'))]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_quotation_with_onboarding_tree_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">sale.order.quotation.tree.inherit.sf</field>
|
||||
<field name="model">sale.order</field>
|
||||
|
||||
@@ -200,6 +200,8 @@ class MrpProduction(models.Model):
|
||||
self[0].write({'is_rework': False})
|
||||
# 修改制造订单 编程状态变为“编程中” 制造订单状态为‘返工’
|
||||
self.write({'programming_state': '编程中', 'work_state': '编程中', 'state': 'rework'})
|
||||
self[0].workorder_ids.filtered(
|
||||
lambda a: a.name == '装夹预调' and a.state not in ['rework', 'done', 'cancel'])._compute_state()
|
||||
if missing_tool_1:
|
||||
logging.info(f'线边、机内缺刀:{missing_tool_1}')
|
||||
# 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’
|
||||
|
||||
@@ -450,7 +450,7 @@
|
||||
<field name="production_line_name_id" optional="hide"/>
|
||||
<field name="machine_tool_name_id" optional="hide"/>
|
||||
<field name="applicant" optional="hide"/>
|
||||
<field name="apply_time"/>
|
||||
<field name="create_date" string="申请时间"/>
|
||||
<field name="assemble_status" widget='badge'
|
||||
decoration-info="assemble_status == '0'"
|
||||
decoration-warning="assemble_status == '01'"
|
||||
|
||||
@@ -1119,6 +1119,8 @@ class SfPickingType(models.Model):
|
||||
action = super(SfPickingType, self)._get_action(action_xmlid)
|
||||
if not self.env.user.has_group('base.group_system'):
|
||||
action['context']['create'] = False
|
||||
if self.sequence_code in ['DL', 'INT', 'PC']:
|
||||
action['context']['search_default_retrospect_ref'] = 1
|
||||
return action
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user