Compare commits
60 Commits
feature/pl
...
feature/we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d28eccd1b | ||
|
|
8dc3f2698b | ||
|
|
69c63f708d | ||
|
|
e264306fed | ||
|
|
f557cb8d10 | ||
|
|
cf34e28e35 | ||
|
|
b7595fe4ec | ||
|
|
2551d82a99 | ||
|
|
0cedba8ea4 | ||
|
|
d64a814251 | ||
|
|
86d5de4fa1 | ||
|
|
0bf9c752f6 | ||
|
|
e62eb060fb | ||
|
|
563b44adb1 | ||
|
|
a094946428 | ||
|
|
d28fd5d787 | ||
|
|
41c357d124 | ||
|
|
f94d52a4d9 | ||
|
|
74dc31b083 | ||
|
|
3b1fca529a | ||
|
|
843eeb8a89 | ||
|
|
12e81ec702 | ||
|
|
fe2af8a4ce | ||
|
|
f337a30aba | ||
|
|
7f3a8d877f | ||
|
|
5e6a7d0a39 | ||
|
|
5788a157c5 | ||
|
|
de8ba77bef | ||
|
|
f366b650d0 | ||
|
|
6054ce39f3 | ||
|
|
e1e9dc425b | ||
|
|
3a2a942f3b | ||
|
|
bf9d848f10 | ||
|
|
add7d404a0 | ||
|
|
7e6fa7b6c7 | ||
|
|
3fd17302f5 | ||
|
|
db9cee3e28 | ||
|
|
97a26dfa06 | ||
|
|
cebd895811 | ||
|
|
bb6c208d37 | ||
|
|
921f2c3503 | ||
|
|
1224e0e094 | ||
|
|
a571a870d3 | ||
|
|
d4e0d36166 | ||
|
|
39579aef10 | ||
|
|
1fe8fd6933 | ||
|
|
3b1caca62b | ||
|
|
3fe8c957be | ||
|
|
98923c1797 | ||
|
|
8661dd16c1 | ||
|
|
7157ea1587 | ||
|
|
a580a12d69 | ||
|
|
0d512e2e43 | ||
|
|
103069c554 | ||
|
|
f2482b5128 | ||
|
|
da38d24111 | ||
|
|
1f0ebe71c7 | ||
|
|
f897955f68 | ||
|
|
00a04af94f | ||
|
|
cc40d479a9 |
@@ -1273,3 +1273,18 @@ msgstr ""
|
||||
#: model:product.template,description_sale:mrp_workorder.product_template_stool_top
|
||||
msgid "wooden stool top"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_workorder
|
||||
#: model:quality.point.test_type,name:mrp_workorder.test_type_register_consumed_materials
|
||||
msgid "Register Consumed Materials"
|
||||
msgstr "登记消耗材料"
|
||||
|
||||
#. module: mrp_workorder
|
||||
#: model:quality.point.test_type,name:mrp_workorder.test_type_register_byproducts
|
||||
msgid "Register By-products"
|
||||
msgstr "按产品注册"
|
||||
|
||||
#. module: mrp_workorder
|
||||
#: model:quality.point.test_type,name:mrp_workorder.test_type_print_label
|
||||
msgid "Print label"
|
||||
msgstr "打印标签"
|
||||
@@ -1050,3 +1050,13 @@ msgstr "工作中心故障"
|
||||
#: model:ir.model.fields,field_description:quality.field_quality_point_test_type__active
|
||||
msgid "active"
|
||||
msgstr "有效"
|
||||
|
||||
#. module: quality
|
||||
#: model:quality.point.test_type,name:quality.test_type_instructions
|
||||
msgid "Instructions"
|
||||
msgstr "使用说明"
|
||||
|
||||
#. module: quality
|
||||
#: model:quality.point.test_type,name:quality.test_type_picture
|
||||
msgid "Take a Picture"
|
||||
msgstr "照片"
|
||||
@@ -15,7 +15,7 @@ class TestType(models.Model):
|
||||
_description = "Quality Control Test Type"
|
||||
|
||||
# Used instead of selection field in order to hide a choice depending on the view.
|
||||
name = fields.Char('Name', required=True)
|
||||
name = fields.Char('Name', required=True,translate=True)
|
||||
technical_name = fields.Char('Technical name', required=True)
|
||||
active = fields.Boolean('active', default=True)
|
||||
|
||||
|
||||
@@ -1185,3 +1185,14 @@ msgstr "请先进行质量检查!"
|
||||
#: model_terms:ir.ui.view,arch_db:quality_control.quality_alert_team_view_form
|
||||
msgid "e.g. The QA Masters"
|
||||
msgstr "例如:QA大师"
|
||||
|
||||
|
||||
#. module: quality_control
|
||||
#: model:quality.point.test_type,name:quality_control.test_type_passfail
|
||||
msgid "Pass - Fail"
|
||||
msgstr "通过-失败"
|
||||
|
||||
#. module: quality_control
|
||||
#: model:quality.point.test_type,name:quality_control.test_type_measure
|
||||
msgid "Measure"
|
||||
msgstr "测量"
|
||||
@@ -6,3 +6,4 @@ from . import stock_move
|
||||
from . import stock_move_line
|
||||
from . import stock_picking
|
||||
from . import stock_lot
|
||||
from . import product_category
|
||||
24
quality_control/models/product_category.py
Normal file
24
quality_control/models/product_category.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from math import sqrt
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from datetime import datetime
|
||||
|
||||
import random
|
||||
|
||||
from odoo import api, models, fields, _
|
||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_round
|
||||
from odoo.osv.expression import OR
|
||||
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
_inherit = 'product.category'
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
# 添加过滤条件,确保只返回名称为 'abc' 的记录
|
||||
args += [('name', 'not in', ['Saleable', 'Expenses', 'Deliveries'])]
|
||||
|
||||
# 调用父类的 name_search 方法
|
||||
return super(ProductCategory, self).name_search(name, args=args, operator=operator, limit=limit)
|
||||
@@ -394,3 +394,11 @@ class MachineToolCategory(models.Model):
|
||||
active = fields.Boolean('有效', default=True)
|
||||
category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别',
|
||||
default='shukong')
|
||||
|
||||
|
||||
class MachiningAccuracy(models.Model):
|
||||
_name = 'sf.machining.accuracy'
|
||||
_description = '加工精度'
|
||||
name = fields.Char('一般公差', index=True)
|
||||
standard_tolerance = fields.Char(string="标准公差")
|
||||
sync_id = fields.Char('同步ID')
|
||||
|
||||
@@ -247,3 +247,7 @@ access_sf_cutting_tool_type_group_sf_stock_manager,sf_cutting_tool_type_group_sf
|
||||
access_sf_cutting_tool_material_group_plan_dispatch,sf_cutting_tool_material_group_plan_dispatch,model_sf_cutting_tool_material,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_functional_cutting_tool_model_group_plan_dispatch,sf_functional_cutting_tool_model_group_plan_dispatch,model_sf_functional_cutting_tool_model,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_cutting_tool_type_group_plan_dispatch,sf_cutting_tool_type_group_plan_dispatch,model_sf_cutting_tool_type,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
||||
access_sf_machining_accuracy,sf_machining_accuracy,model_sf_machining_accuracy,base.group_user,1,0,0,0
|
||||
access_sf_machining_accuracy_admin,sf_machining_accuracy_admin,model_sf_machining_accuracy,base.group_system,1,0,0,0
|
||||
|
||||
|
@@ -614,4 +614,23 @@
|
||||
<field name="res_model">sf.machine.control_system</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
#------------------加工精度------------------
|
||||
<record model="ir.ui.view" id="tree_sf_machining_accuracy_view">
|
||||
<field name="name">tree.sf.machining.accuracy</field>
|
||||
<field name="model">sf.machining.accuracy</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="加工精度" create="0" edit="0" delete="0">
|
||||
<field name="name"/>
|
||||
<field name="standard_tolerance"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_machining_accuracy" model="ir.actions.act_window">
|
||||
<field name="name">加工精度</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.machining.accuracy</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -141,12 +141,18 @@
|
||||
sequence="1"
|
||||
action="action_sf_machine_brand"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_machining_accuracy"
|
||||
parent="menu_sf_base"
|
||||
name="加工精度"
|
||||
sequence="1"
|
||||
action="action_sf_machining_accuracy"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_machine_control_system"
|
||||
parent="menu_sf_base"
|
||||
name="数控系统"
|
||||
sequence="1"
|
||||
sequence="2"
|
||||
action="action_sf_machine_control_system"/>
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="adaptive_viewer"/>
|
||||
<field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="adaptive_viewer"/>
|
||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||
<field name="upload_model_file"
|
||||
widget="many2many_binary"
|
||||
@@ -111,6 +109,19 @@
|
||||
'刀具')], 'required': True}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="2D加工图纸">
|
||||
<field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}"
|
||||
widget="adaptive_viewer"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="质检标准">
|
||||
<field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}"
|
||||
widget="adaptive_viewer"/>
|
||||
|
||||
</page>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='default_code']" position="attributes">-->
|
||||
<!-- <attribute name="attrs">{'readonly': [('categ_type', '=', '刀具')], 'invisible':-->
|
||||
<!-- [('product_variant_count', '>' , 1)]}-->
|
||||
|
||||
@@ -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="")
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
'views/equipment_maintenance_standards_views.xml',
|
||||
'views/maintenance_request_views.xml',
|
||||
'views/maintenance_equipment_category_views.xml',
|
||||
'wizard/maintenance_request_wizard.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import base64
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
import requests
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentCategory(models.Model):
|
||||
@@ -122,6 +123,13 @@ class SfMaintenanceEquipment(models.Model):
|
||||
'sf_maintenance_equipment_ids', string='设备维保标准')
|
||||
eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准',
|
||||
domain="[('maintenance_type','=','保养')]")
|
||||
|
||||
initial_action_date = fields.Date(string='重置保养日期')
|
||||
initial_action_date_old = fields.Date(string='重置保养日期(旧)')
|
||||
next_action_date = fields.Date(string='下次预防保养')
|
||||
|
||||
initial_overhaul_date = fields.Date(string='重置维修日期')
|
||||
initial_overhaul_date_old = fields.Date(string='重置维修日期(旧)')
|
||||
overhaul_date = fields.Date(string='下次预防检修')
|
||||
overhaul_period = fields.Integer(string='预防检修频次')
|
||||
overhaul_duration = fields.Float(string='检修时长')
|
||||
@@ -129,6 +137,61 @@ class SfMaintenanceEquipment(models.Model):
|
||||
overhaul_id = fields.Many2one('equipment.maintenance.standards', string='设备检修标准',
|
||||
domain="[('maintenance_type','=','检修')]")
|
||||
|
||||
def confirm_maintenance(self):
|
||||
"""
|
||||
确认保养/检修
|
||||
"""
|
||||
context = self.env.context
|
||||
if context['type'] == '保养':
|
||||
if not self.initial_action_date:
|
||||
raise ValidationError('重置保养日期不能为空!!')
|
||||
elif self.initial_action_date < fields.Date.today():
|
||||
raise ValidationError('重置保养日期不能小于当前日期!!')
|
||||
elif context['type'] == '检修':
|
||||
if not self.initial_overhaul_date:
|
||||
raise ValidationError('重置检修日期不能为空!!')
|
||||
elif self.initial_overhaul_date < fields.Date.today():
|
||||
raise ValidationError('重置检修日期不能小于当前日期!!')
|
||||
|
||||
request_ids = self.env['maintenance.request'].search([('stage_id.done', '=', False),
|
||||
('equipment_id', '=', self.id),
|
||||
('maintenance_type', '=', 'preventive'),
|
||||
('sf_maintenance_type', '=', context['type'])])
|
||||
|
||||
if not request_ids:
|
||||
return self.create_maintenance_request(context['type'])
|
||||
else:
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "maintenance.request.wizard",
|
||||
"views": [[False, "form"]],
|
||||
"target": "new",
|
||||
'context': {
|
||||
'equipment_id': self.id
|
||||
}
|
||||
}
|
||||
|
||||
def create_maintenance_request(self, maintenance_request_type):
|
||||
"""
|
||||
根据条件创建维保计划
|
||||
"""
|
||||
if maintenance_request_type == '保养':
|
||||
self._create_new_request(self.initial_action_date + timedelta(days=self.period))
|
||||
self.initial_action_date_old = self.initial_action_date
|
||||
elif maintenance_request_type == '检修':
|
||||
self._create_new_request1(self.initial_overhaul_date + timedelta(days=self.overhaul_period))
|
||||
self.initial_overhaul_date_old = self.initial_overhaul_date
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': f'创建{maintenance_request_type}计划',
|
||||
'message': f'新{maintenance_request_type}维保计划创建成功',
|
||||
'type': 'success',
|
||||
'next': {'type': 'ir.actions.act_window_close'},
|
||||
}
|
||||
}
|
||||
|
||||
@api.onchange('eq_maintenance_id', 'overhaul_id')
|
||||
def _compute_equipment_maintenance_standards_ids(self):
|
||||
for record in self:
|
||||
@@ -591,11 +654,13 @@ class SfMaintenanceEquipment(models.Model):
|
||||
('equipment_id', '=', equipment.id),
|
||||
('sf_maintenance_type', '=', '保养'),
|
||||
('stage_id.done', '!=', True),
|
||||
('active', '!=', False),
|
||||
('close_date', '=', False)], order="request_date asc", limit=1)
|
||||
last_maintenance_done = self.env['maintenance.request'].search([
|
||||
('equipment_id', '=', equipment.id),
|
||||
('sf_maintenance_type', '=', '保养'),
|
||||
('stage_id.done', '=', True),
|
||||
('active', '!=', False),
|
||||
('close_date', '!=', False)], order="close_date desc", limit=1)
|
||||
if next_maintenance_todo and last_maintenance_done:
|
||||
next_date = next_maintenance_todo.request_date
|
||||
@@ -624,7 +689,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
if next_date < date_now:
|
||||
next_date = date_now
|
||||
else:
|
||||
next_date = equipment.effective_date + timedelta(days=equipment.period)
|
||||
next_date = equipment.initial_action_date + timedelta(days=equipment.period)
|
||||
equipment.next_action_date = next_date
|
||||
else:
|
||||
self.next_action_date = False
|
||||
@@ -635,11 +700,13 @@ class SfMaintenanceEquipment(models.Model):
|
||||
('equipment_id', '=', equipment.id),
|
||||
('sf_maintenance_type', '=', '检修'),
|
||||
('stage_id.done', '!=', True),
|
||||
('active', '!=', False),
|
||||
('close_date', '=', False)], order="request_date asc", limit=1)
|
||||
last_maintenance_done = self.env['maintenance.request'].search([
|
||||
('equipment_id', '=', equipment.id),
|
||||
('sf_maintenance_type', '=', '检修'),
|
||||
('stage_id.done', '=', True),
|
||||
('active', '!=', False),
|
||||
('close_date', '!=', False)], order="close_date desc", limit=1)
|
||||
if next_maintenance_todo and last_maintenance_done:
|
||||
next_date = next_maintenance_todo.request_date
|
||||
@@ -668,7 +735,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
if next_date < date_now:
|
||||
next_date = date_now
|
||||
else:
|
||||
next_date = equipment.effective_date + timedelta(days=equipment.overhaul_period)
|
||||
next_date = equipment.initial_overhaul_date + timedelta(days=equipment.overhaul_period)
|
||||
equipment.overhaul_date = next_date
|
||||
else:
|
||||
self.overhaul_date = False
|
||||
@@ -735,6 +802,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
next_requests = self.env['maintenance.request'].search([('stage_id.done', '=', False),
|
||||
('equipment_id', '=', equipment.id),
|
||||
('maintenance_type', '=', 'preventive'),
|
||||
('active', '=', True),
|
||||
('request_date', '=', equipment.next_action_date),
|
||||
('sf_maintenance_type', '=', '保养')])
|
||||
if not next_requests:
|
||||
@@ -743,6 +811,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
next_requests = self.env['maintenance.request'].search([('stage_id.done', '=', False),
|
||||
('equipment_id', '=', equipment.id),
|
||||
('maintenance_type', '=', 'preventive'),
|
||||
('active', '=', True),
|
||||
('request_date', '=', equipment.overhaul_date),
|
||||
('sf_maintenance_type', '=', '检修')])
|
||||
if not next_requests:
|
||||
|
||||
@@ -14,6 +14,8 @@ class SfMaintenanceEquipmentCategory(models.Model):
|
||||
equipment_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备维保标准',
|
||||
domain="[('maintenance_type','=',sf_maintenance_type)]")
|
||||
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@api.onchange('sf_maintenance_type')
|
||||
def _compute_equipment_maintenance_request_id(self):
|
||||
for record in self:
|
||||
|
||||
@@ -20,7 +20,8 @@ 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,0,0,0
|
||||
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_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
|
||||
|
||||
|
@@ -60,9 +60,9 @@
|
||||
<field name="function_type"/>
|
||||
<field name="code" readonly="1"/>
|
||||
<field name="equipment_type" invisible="1"/>
|
||||
<field name="brand_id" force_save="1" />
|
||||
<field name="brand_id" force_save="1"/>
|
||||
<field name="type_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
domain="[('brand_id', '=', brand_id)]" />
|
||||
domain="[('brand_id', '=', brand_id)]"/>
|
||||
<field name="machine_tool_category" readonly="1" attrs="{'invisible': [('type_id', '=', False)]}"
|
||||
force_save="1"/>
|
||||
<field name="run_time" force_save="1"/>
|
||||
@@ -73,7 +73,7 @@
|
||||
<group>
|
||||
<group string="基础参数">
|
||||
<field name="control_system_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
options="{'no_create': True}" />
|
||||
options="{'no_create': True}"/>
|
||||
<label for="workbench_L" string="工作台尺寸(mm)"/>
|
||||
<div class="test_model">
|
||||
<label for="workbench_L" string="长"/>
|
||||
@@ -85,7 +85,7 @@
|
||||
<field name="workbench_W" class="o_address_zip"
|
||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<span>&nbsp;</span>
|
||||
<label for="workbench_H" string="高"/>
|
||||
<field name="workbench_H" class="o_address_zip"
|
||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
@@ -134,7 +134,7 @@
|
||||
<!-- <field name="guide_rail" required="1"/>-->
|
||||
<field name="number_of_axles" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
widget="radio"
|
||||
options="{'horizontal': true}" />
|
||||
options="{'horizontal': true}"/>
|
||||
<label for="x_axis" string="加工行程(mm)"
|
||||
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
|
||||
<div class="test_model"
|
||||
@@ -196,8 +196,8 @@
|
||||
<field name="T_tool_time"/>
|
||||
<field name="C_tool_time"/>
|
||||
</group>
|
||||
<group string="主轴">
|
||||
<field name="taper_type_id" attrs="{'required': [('equipment_type', '=', '机床')]}" />
|
||||
<group string="主轴">
|
||||
<field name="taper_type_id" attrs="{'required': [('equipment_type', '=', '机床')]}"/>
|
||||
<label for="distance_min" string="主轴端面-工作台距离(mm)"/>
|
||||
<div class="test_model">
|
||||
<label for="distance_min" string="最小(min)"/>
|
||||
@@ -237,7 +237,7 @@
|
||||
<field name="c_precision"/>
|
||||
<field name="c_precision_repeat"/>
|
||||
</group>
|
||||
<group string="进给参数">
|
||||
<group string="进给参数">
|
||||
<field name="X_axis_rapid_traverse_speed"/>
|
||||
<field name="Y_axis_rapid_traverse_speed"/>
|
||||
<field name="Z_axis_rapid_traverse_speed"/>
|
||||
@@ -252,21 +252,21 @@
|
||||
|
||||
|
||||
</page>
|
||||
<page string="AGV运行日志" name="sf_equipment"
|
||||
<page string="AGV运行日志" name="sf_equipment"
|
||||
attrs="{'invisible': [('equipment_type', '!=', 'AGV小车')]}">
|
||||
<field name="agv_logs">
|
||||
<tree create="1" edit="1" delete="1" editable="bottom">
|
||||
<field name = 'run_type'/>
|
||||
<field name = 'run_code'/>
|
||||
<field name = 'run_first'/>
|
||||
<field name = 'run_last'/>
|
||||
<field name = 'production_line'/>
|
||||
<field name = 'workorder'/>
|
||||
<field name = 'time'/>
|
||||
<field name = 'state'/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<field name="agv_logs">
|
||||
<tree create="1" edit="1" delete="1" editable="bottom">
|
||||
<field name='run_type'/>
|
||||
<field name='run_code'/>
|
||||
<field name='run_first'/>
|
||||
<field name='run_last'/>
|
||||
<field name='production_line'/>
|
||||
<field name='workorder'/>
|
||||
<field name='time'/>
|
||||
<field name='state'/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
<page string="设备参数" name="sf_equipment"
|
||||
attrs="{'invisible': [('equipment_type', '!=', 'AGV小车')]}">
|
||||
@@ -979,31 +979,58 @@
|
||||
</group>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='next_action_date']" position="before">
|
||||
|
||||
<field name='eq_maintenance_id' force_save="1" widget="many2one"/>
|
||||
<xpath expr="//page[@name='maintenance']" position="replace">
|
||||
<page string="维保" name="maintenance">
|
||||
<group>
|
||||
<group string="保养">
|
||||
<field name='eq_maintenance_id' force_save="1" widget="many2one"/>
|
||||
<field name="initial_action_date"/>
|
||||
<field name="next_action_date" string="下次预防保养"/>
|
||||
<label for="period" string="预防保养频次"/>
|
||||
<div class="o_row">
|
||||
<field name="period"/>
|
||||
days
|
||||
</div>
|
||||
<label for="maintenance_duration" string="保养时长"/>
|
||||
<div class="o_row">
|
||||
<field name="maintenance_duration"/>
|
||||
hours
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box" style="white-space: nowrap">
|
||||
<button name="confirm_maintenance" string="确认保养" type="object"
|
||||
class="oe_highlight" context="{'type': '保养'}"/>
|
||||
</div>
|
||||
</group>
|
||||
<group string="检修">
|
||||
<field name='overhaul_id'/>
|
||||
<field name="initial_overhaul_date"/>
|
||||
<field name="overhaul_date" string="下次预防检修"/>
|
||||
<label for="overhaul_period" string="预防检修频次"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_period"/>
|
||||
days
|
||||
</div>
|
||||
|
||||
<label for="overhaul_duration" string="检修时长"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_duration"/>
|
||||
hours
|
||||
</div>
|
||||
<field name='equipment_maintenance_standards_ids' widget="many2many_tags"
|
||||
invisible="1"/>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box" style="white-space: nowrap">
|
||||
<button name="confirm_maintenance" string="确认检修" type="object"
|
||||
class="oe_highlight" context="{'type': '检修'}"/>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[hasclass('o_row')][field[@name='maintenance_duration']]" position="after">
|
||||
|
||||
|
||||
<field name='overhaul_id' options="{'no_create':True}"/>
|
||||
<field name="overhaul_date" string="下次预防检修"/>
|
||||
<label for="overhaul_period" string="预防检修频次"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_period"/>
|
||||
days
|
||||
</div>
|
||||
|
||||
<label for="overhaul_duration" string="检修时长"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_duration"/>
|
||||
hours
|
||||
</div>
|
||||
<field name='equipment_maintenance_standards_ids' widget="many2many_tags" invisible="1"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='description']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
@@ -1189,7 +1216,7 @@
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="type" readonly="1"/>
|
||||
<field name="image" widget="image" readonly="1"/>
|
||||
<!-- <field name="equipment_id"/>-->
|
||||
<!-- <field name="equipment_id"/>-->
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
1
sf_maintenance/wizard/__init__.py
Normal file
1
sf_maintenance/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import maintenance_request_wizard
|
||||
26
sf_maintenance/wizard/maintenance_request_wizard.py
Normal file
26
sf_maintenance/wizard/maintenance_request_wizard.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MaintenanceRequestWizard(models.TransientModel):
|
||||
_name = 'maintenance.request.wizard'
|
||||
_description = '维保二次确认弹窗'
|
||||
|
||||
name = fields.Char('')
|
||||
|
||||
def submit(self):
|
||||
context = self.env.context
|
||||
equipment_id = self.env['maintenance.equipment'].sudo().search([('id', '=', context['equipment_id'])])
|
||||
request_ids = self.env['maintenance.request'].search([('stage_id.done', '=', False),
|
||||
('equipment_id', '=', equipment_id.id),
|
||||
('maintenance_type', '=', 'preventive'),
|
||||
('sf_maintenance_type', '=', context['type'])])
|
||||
request_ids.write({'active': False})
|
||||
return equipment_id.create_maintenance_request(context['type'])
|
||||
|
||||
def cancel(self):
|
||||
context = self.env.context
|
||||
equipment_id = self.env['maintenance.equipment'].sudo().search([('id', '=', context['equipment_id'])])
|
||||
if context['type'] == '保养':
|
||||
equipment_id.initial_action_date = equipment_id.initial_action_date_old
|
||||
elif context['type'] == '检修':
|
||||
equipment_id.initial_overhaul_date = equipment_id.initial_overhaul_date_old
|
||||
29
sf_maintenance/wizard/maintenance_request_wizard.xml
Normal file
29
sf_maintenance/wizard/maintenance_request_wizard.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="action_maintenance_request_wizard" model="ir.actions.act_window">
|
||||
<field name="name">维保计划</field>
|
||||
<field name="res_model">maintenance.request.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="maintenance_request_wizard_form_view">
|
||||
<field name="name">maintenance.request.wizard.form.view</field>
|
||||
<field name="model">maintenance.request.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<div>
|
||||
<field name="name" invisible="1"/>
|
||||
有未执行的历史维保计划,是否创建新维保计划!!
|
||||
</div>
|
||||
<footer>
|
||||
<button string="确认" name="submit" type="object" class="oe_highlight"/>
|
||||
<button string="取消" name="cancel" type="object" class="oe_highlight"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -37,12 +37,25 @@ class MrpProduction(models.Model):
|
||||
@api.depends('procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id')
|
||||
def _compute_deadline_of_delivery(self):
|
||||
for production in self:
|
||||
sale_order_ids = production.procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id.ids
|
||||
if not sale_order_ids or len(sale_order_ids) < 1:
|
||||
continue
|
||||
sale_id = self.env['sale.order'].sudo().browse(sale_order_ids[0])
|
||||
if sale_id:
|
||||
production.deadline_of_delivery = sale_id.deadline_of_delivery
|
||||
# 确保 procurement_group_id 和相关字段存在
|
||||
if production.procurement_group_id:
|
||||
# 获取相关的 sale_id
|
||||
sale_order_id = production.procurement_group_id.mrp_production_ids.mapped(
|
||||
'move_dest_ids.group_id.sale_id')
|
||||
|
||||
# 确保 sale_order_id 是有效的 ID 列表
|
||||
if sale_order_id:
|
||||
# 获取 sale.order 记录
|
||||
sale_id = self.env['sale.order'].sudo().browse(sale_order_id.ids) # 使用 mapped 返回的 ID 列表
|
||||
|
||||
# 处理 sale_id
|
||||
if sale_id:
|
||||
# 假设我们只需要第一个 sale_id
|
||||
production.deadline_of_delivery = sale_id[0].deadline_of_delivery if sale_id else False
|
||||
else:
|
||||
production.deadline_of_delivery = False
|
||||
else:
|
||||
production.deadline_of_delivery = False
|
||||
|
||||
@api.depends('workorder_ids.tool_state_remark')
|
||||
def _compute_tool_state_remark(self):
|
||||
|
||||
@@ -1051,6 +1051,17 @@ class ResMrpWorkOrder(models.Model):
|
||||
if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready':
|
||||
workorder.state = 'waiting'
|
||||
continue
|
||||
if (workorder.production_id.tool_state in ['1', '2']
|
||||
and not workorder.production_id.workorder_ids.filtered(lambda a: a.sequence == 0)
|
||||
and workorder.production_id.programming_state == '编程中' and workorder.name == '装夹预调'):
|
||||
if workorder.state == 'pending' and workorder == self.search(
|
||||
[('production_id', '=', workorder.production_id.id),
|
||||
('routing_type', '=', '装夹预调'),
|
||||
('state', 'not in', ['rework', 'done', 'cancel'])],
|
||||
limit=1,
|
||||
order="sequence"):
|
||||
workorder.state = 'waiting'
|
||||
continue
|
||||
|
||||
# elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'cancel', 'progress',
|
||||
# 'rework']:
|
||||
|
||||
@@ -776,6 +776,8 @@ 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)
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
@@ -837,6 +839,11 @@ class ResProductMo(models.Model):
|
||||
else:
|
||||
return self.env.ref('sf_dlm.product_uom_cubic_millimeter')
|
||||
|
||||
def attachment_update(self, name, res_id, res_field):
|
||||
attachment_info = self.env['ir.attachment'].sudo().search(
|
||||
[('res_id', '=', res_id), ('res_field', '=', res_field)], limit=1)
|
||||
attachment_info.write({'name': name})
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
def product_create(self, product_id, item, order_id, order_number, i):
|
||||
copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
|
||||
@@ -875,8 +882,11 @@ class ResProductMo(models.Model):
|
||||
'manual_quotation': item['manual_quotation'] or False,
|
||||
'part_number': item.get('part_number') or '',
|
||||
'active': True,
|
||||
'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']),
|
||||
'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']),
|
||||
}
|
||||
tax_id = self.env['account.tax'].sudo().search(
|
||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||
@@ -884,6 +894,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']:
|
||||
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']:
|
||||
self.attachment_update(item['quality_standard_name'], copy_product_id.product_tmpl_id.id,
|
||||
'quality_standard')
|
||||
return copy_product_id
|
||||
|
||||
def _get_ids(self, param):
|
||||
|
||||
@@ -182,6 +182,11 @@ class StockRule(models.Model):
|
||||
moves._action_confirm()
|
||||
return True
|
||||
|
||||
def attachment_update(self, name, res_id, res_field):
|
||||
attachment_info = self.env['ir.attachment'].sudo().search(
|
||||
[('res_id', '=', res_id), ('res_field', '=', res_field)], limit=1)
|
||||
attachment_info.write({'name': name})
|
||||
|
||||
@api.model
|
||||
def _run_manufacture(self, procurements):
|
||||
productions_values_by_company = defaultdict(list)
|
||||
@@ -276,6 +281,12 @@ class StockRule(models.Model):
|
||||
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({
|
||||
|
||||
@@ -98,8 +98,6 @@
|
||||
<field name="production_line_id" readonly="1"/>
|
||||
<!-- <field name="production_line_state" readonly="1"/>-->
|
||||
<field name="part_number" string="成品的零件图号"/>
|
||||
<field name="part_drawing" widget="adaptive_viewer"/>
|
||||
<field name="quality_standard" widget="adaptive_viewer"/>
|
||||
<field name="tool_state"/>
|
||||
<field name="tool_state_remark" string="备注" attrs="{'invisible': [('tool_state', '!=', '1')]}"/>
|
||||
<field name="deadline_of_delivery" readonly="1"/>
|
||||
@@ -330,6 +328,16 @@
|
||||
<xpath expr="//field[@name='components_availability']" position="attributes">
|
||||
<attribute name="string">投料状态</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="零件图纸">
|
||||
<field name="part_drawing" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//notebook" position="inside">
|
||||
<page string="质检标准">
|
||||
<field name="quality_standard" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -268,8 +268,6 @@
|
||||
<field name="material_height" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="part_number" string="成品的零件图号"/>
|
||||
<field name="machining_drawings" widget="adaptive_viewer" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||
<field name="quality_standard" widget="adaptive_viewer" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//label[1]" position="attributes">
|
||||
<attribute name="string">计划加工时间</attribute>
|
||||
@@ -591,7 +589,18 @@
|
||||
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>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
'data/cron_data.xml',
|
||||
'data/template_data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
'views/mrp_workorder_views.xml',
|
||||
],
|
||||
'test': [
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api
|
||||
|
||||
class SFMessageMaintenanceLogs(models.Model):
|
||||
|
||||
@@ -103,39 +103,58 @@ class SFMessageSale(models.Model):
|
||||
today = datetime.today().date()
|
||||
deadline_check = today + timedelta(days=1)
|
||||
logging.info(f"today: {today}, deadline_check: {deadline_check}")
|
||||
sale_order = self.sudo().search([('state', 'in', ['sale']), ('deadline_of_delivery', '!=', False)])
|
||||
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_not_done = production.filtered(lambda p: p.state not in ['done', 'scrap', 'cancel'])
|
||||
production_done_count = len(production.filtered(lambda p: p.state in ['done', 'scrap', 'cancel']))
|
||||
if len(production_not_done) != item.mrp_production_count:
|
||||
if deadline_check == item.deadline_of_delivery:
|
||||
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']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today == item.deadline_of_delivery:
|
||||
elif today >= item.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}")
|
||||
if item.delivery_status in ['pending', 'partial']:
|
||||
if deadline_check == item.deadline_of_delivery:
|
||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today == item.deadline_of_delivery:
|
||||
elif today >= item.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}")
|
||||
continue
|
||||
# 获取业务节点
|
||||
business_node_ids = {
|
||||
'warning': self.env.ref('sf_message.bussiness_sale_order_overdue_warning').id,
|
||||
'overdue': self.env.ref('sf_message.bussiness_sale_order_overdue').id
|
||||
}
|
||||
overdue_orders = self.sudo().search([('delivery_warning', 'in', ['warning', 'overdue'])])
|
||||
for wo in overdue_orders:
|
||||
message_template = self.env["jikimo.message.template"].search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", self.env.ref('sf_message.bussiness_sale_order_overdue_warning').id)
|
||||
])
|
||||
sale_order_has = self.env['jikimo.message.queue'].search([
|
||||
('res_id', '=', wo.id),
|
||||
('message_status', '=', 'pending'),
|
||||
('message_template_id', '=', message_template.id)
|
||||
])
|
||||
if not sale_order_has:
|
||||
if wo.delivery_warning == 'warning':
|
||||
wo.add_queue('销售订单逾期预警')
|
||||
elif wo.delivery_warning == 'overdue':
|
||||
wo.add_queue('销售订单已逾期')
|
||||
|
||||
|
||||
business_node_id = business_node_ids.get(wo.delivery_warning)
|
||||
if business_node_id:
|
||||
message_template = self.env["jikimo.message.template"].search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", business_node_id)
|
||||
], limit=1)
|
||||
sale_order_has = self.env['jikimo.message.queue'].search([
|
||||
('res_id', '=', wo.id),
|
||||
('message_status', '=', 'pending'),
|
||||
('message_template_id', '=', message_template.id)
|
||||
])
|
||||
if not sale_order_has:
|
||||
message_name = '销售订单逾期预警' if wo.delivery_warning == 'warning' else '销售订单已逾期'
|
||||
wo.add_queue(message_name)
|
||||
|
||||
@@ -73,7 +73,7 @@ class SFMessageWork(models.Model):
|
||||
if record:
|
||||
i += 1
|
||||
if i >= 1:
|
||||
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
|
||||
action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||
content_template = content.replace('{{url}}', url_with_id)
|
||||
if bussiness_node in template_names['预警']:
|
||||
@@ -85,7 +85,7 @@ class SFMessageWork(models.Model):
|
||||
|
||||
def request_url(self):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
|
||||
action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||
@@ -115,12 +115,13 @@ class SFMessageWork(models.Model):
|
||||
item.date_planned_finished.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
date_planned_finished = datetime.strptime(date_planned_finished_str, '%Y-%m-%d %H:%M:%S')
|
||||
twelve_hours_ago = current_time_datetime - timedelta(hours=12)
|
||||
if current_time_datetime >= date_planned_finished:
|
||||
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}")
|
||||
item.delivery_warning = 'overdue'
|
||||
elif twelve_hours_ago <= current_time_datetime <= date_planned_finished:
|
||||
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}")
|
||||
|
||||
34
sf_message/views/mrp_workorder_views.xml
Normal file
34
sf_message/views/mrp_workorder_views.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record model="ir.actions.act_window" id="mrp_workorder_action_notify">
|
||||
<field name="name">工单</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.workorder</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/>
|
||||
<!-- (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')})-->
|
||||
<!-- <field name="target">fullscreen</field>-->
|
||||
<field name="target">current</field>
|
||||
<field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>
|
||||
<field name="context">{'search_default_product': 1, 'search_default_workcenter_id':
|
||||
active_id,'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1,
|
||||
'search_default_ready': 1, 'search_default_progress': 1}
|
||||
</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_workorder">
|
||||
没有工单要做!
|
||||
</p>
|
||||
<p>
|
||||
工作订单是作为制造订单的一部分执行的操作。
|
||||
工序在物料清单中定义或直接添加到制造订单中。
|
||||
</p>
|
||||
<p>
|
||||
使用工作台工作中心控制面板直接登记车间中的操作.
|
||||
平板电脑为您的工人提供工作表,并允许他们报废产品,跟踪时间,
|
||||
发起维护请求,执行质量测试等.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -84,6 +84,8 @@ class ResConfigSettings(models.TransientModel):
|
||||
_logger.info("同步刀具物料切削速度完成")
|
||||
self.env['sf.feed.per.tooth'].sync_all_feed_per_tooth()
|
||||
_logger.info("同步刀具物料每齿走刀量完成")
|
||||
self.env['sf.machining.accuracy'].sync_machining_accuracy_all()
|
||||
_logger.info("同步加工精度完成")
|
||||
|
||||
except Exception as e:
|
||||
_logger.info("sf_all_sync error: %s" % e)
|
||||
|
||||
@@ -74,6 +74,8 @@ class MrStaticResourceDataSync(models.Model):
|
||||
_logger.info("同步刀具物料切削速度完成")
|
||||
self.env['sf.feed.per.tooth'].sync_feed_per_tooth_yesterday()
|
||||
_logger.info("同步刀具物料每齿走刀量完成")
|
||||
self.env['sf.machining.accuracy'].sync_machining_accuracy_all()
|
||||
_logger.info("同步加工精度完成")
|
||||
except Exception as e:
|
||||
traceback_error = traceback.format_exc()
|
||||
logging.error("同步静态资源库失败:%s" % traceback_error)
|
||||
@@ -3133,3 +3135,36 @@ class CuttingToolBasicParameters(models.Model):
|
||||
})
|
||||
else:
|
||||
raise ValidationError("刀具物料基本参数认证未通过")
|
||||
|
||||
|
||||
class MachiningAccuracySync(models.Model):
|
||||
_inherit = 'sf.machining.accuracy'
|
||||
_description = '加工精度'
|
||||
url = '/api/machining_accuracy/list'
|
||||
|
||||
def sync_machining_accuracy_all(self):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
strUrl = config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
_logger.info('加工精度:%s' % result)
|
||||
if result['status'] == 1:
|
||||
machining_accuracy_all_list = result['machining_accuracy_all_list']
|
||||
# 获取同步的id集合
|
||||
ids = [obj['id'] for obj in machining_accuracy_all_list]
|
||||
self.env['sf.machining.accuracy'].sudo().search(
|
||||
[('sync_id', 'not in', ids)]).unlink()
|
||||
for time in machining_accuracy_all_list:
|
||||
machining_accuracy = self.env['sf.machining.accuracy'].sudo().search(
|
||||
[('sync_id', '=', time['id'])])
|
||||
if machining_accuracy:
|
||||
machining_accuracy.name = time['name']
|
||||
machining_accuracy.standard_tolerance = time['standard_tolerance']
|
||||
else:
|
||||
self.env['sf.machining.accuracy'].sudo().create({
|
||||
"sync_id": time['id'],
|
||||
"name": time['name'],
|
||||
"discount": time['discount'],
|
||||
})
|
||||
|
||||
@@ -31,8 +31,8 @@ class SfQualityCncTest(models.Model):
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
|
||||
# machining_drawings = fields.Binary(related='workorder_id.machining_drawings', string='2D加工图纸', readonly=True)
|
||||
# quality_standard = fields.Binary(related='workorder_id.quality_standard', string='质检标准', readonly=True)
|
||||
machining_drawings = fields.Binary('2D加工图纸', related='workorder_id.machining_drawings', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', related='workorder_id.quality_standard', readonly=True)
|
||||
|
||||
def submit_pass(self):
|
||||
if self.test_results in ['返工', '报废']:
|
||||
|
||||
@@ -107,10 +107,10 @@
|
||||
</group>
|
||||
</page>
|
||||
<page string="2D图纸">
|
||||
<!-- <field name="machining_drawings" string="" widget="pdf_viewer"/>-->
|
||||
<field name="machining_drawings" string="" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
<page string="客户质量标准">
|
||||
<!-- <field name="quality_standard" string=""/>-->
|
||||
<field name="quality_standard" string="" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
<page string="其他" attrs="{'invisible': [('state','=', 'waiting')]}">
|
||||
<group>
|
||||
|
||||
@@ -6,6 +6,25 @@
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<xpath expr="//header/button[@name='action_rfq_send'][1]" position="before">
|
||||
<button name="button_confirm" type="object" states="sent" string="Confirm Order"
|
||||
context="{'validate_analytic': True}" class="oe_highlight" id="bid_confirm"
|
||||
data-hotkey="v"/>
|
||||
<button name="button_confirm" type="object" states="draft" context="{'validate_analytic': True}"
|
||||
string="Confirm Order" id="draft_confirm"/>
|
||||
<button name="button_cancel" states="draft,to approve,sent,purchase" string="Cancel" type="object" data-hotkey="x" />
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_cancel'][2]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm'][3]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm'][4]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
|
||||
</field>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
</field>
|
||||
<field name="payment_term_id" position="after">
|
||||
<field name="deadline_of_delivery" readonly="1"/>
|
||||
<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="schedule_status" readonly="1"/> -->
|
||||
|
||||
@@ -51,6 +51,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
string='位置', compute='_compute_current_location_id', store=True)
|
||||
image = fields.Binary('图片', readonly=True)
|
||||
|
||||
stock_num = fields.Integer('库存变更次数', default=0)
|
||||
|
||||
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
|
||||
string='功能刀具安全库存', readonly=True)
|
||||
|
||||
@@ -71,7 +73,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
})
|
||||
|
||||
@api.depends('barcode_id.quant_ids', 'barcode_id.quant_ids.location_id', 'functional_tool_status',
|
||||
'current_shelf_location_id')
|
||||
'current_shelf_location_id', 'stock_num')
|
||||
def _compute_current_location_id(self):
|
||||
for record in self:
|
||||
if record.functional_tool_status == '已拆除':
|
||||
|
||||
@@ -53,6 +53,13 @@ class StockMoveLine(models.Model):
|
||||
[('barcode_id', '=', line_id.lot_id.id),
|
||||
('functional_tool_status', '=', '正常')]).cnc_function_tool_use_verify()
|
||||
|
||||
for move_line in move_lines:
|
||||
if move_line.lot_id:
|
||||
tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||
[('barcode_id', '=', move_line.lot_id.id),
|
||||
('functional_tool_status', '=', '正常')])
|
||||
tool_id.stock_num += tool_id.stock_num
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
Reference in New Issue
Block a user