Compare commits
52 Commits
release/re
...
feature/合同
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
000cd9a13c | ||
|
|
a628826b52 | ||
|
|
bdccce07d4 | ||
|
|
4dc19cab81 | ||
|
|
f25d06e08f | ||
|
|
62314d38b3 | ||
|
|
027be2b021 | ||
|
|
372dfd99c4 | ||
|
|
c702d1f3be | ||
|
|
7e33ca44d0 | ||
|
|
c7d9b15624 | ||
|
|
a4d640acb5 | ||
|
|
523cc4ac5e | ||
|
|
9aa2bd5d54 | ||
|
|
ae23edb9d5 | ||
|
|
9695997542 | ||
|
|
90243a7d2f | ||
|
|
5dc5602e3d | ||
|
|
cbf58fd3fb | ||
|
|
0ada4933ba | ||
|
|
b1261bb91b | ||
|
|
ffde591b3c | ||
|
|
356e1e55e4 | ||
|
|
b6ce462171 | ||
|
|
e8b5ff0b75 | ||
|
|
ac3b50c534 | ||
|
|
e7bc434d60 | ||
|
|
2de501b61d | ||
|
|
976d75973d | ||
|
|
e20bf3816a | ||
|
|
44f29d001e | ||
|
|
aff81f0b3a | ||
|
|
88840abf9f | ||
|
|
332276752a | ||
|
|
d852cf54df | ||
|
|
6756cc201c | ||
|
|
06dd9c12e0 | ||
|
|
978e427734 | ||
|
|
dd35a6ae5f | ||
|
|
0a8cc050b8 | ||
|
|
eb47e4c963 | ||
|
|
5636681ee6 | ||
|
|
9b49edb290 | ||
|
|
39b29960e3 | ||
|
|
6abb237491 | ||
|
|
b0c043676c | ||
|
|
8bfe5eca03 | ||
|
|
dbcf8b1089 | ||
|
|
c436bbea46 | ||
|
|
53ceed4649 | ||
|
|
e39e9d8812 | ||
|
|
19e1b16122 |
@@ -62,7 +62,7 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
||||
const dom1 = buttonsDom.children('.o_form_button_save')
|
||||
const dom2 = buttonsDom.children('.o_form_button_cancel')
|
||||
dom1.append('保存')
|
||||
dom2.append('放弃保存')
|
||||
dom2.append('不保存')
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import wizards
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
|
||||
# always loaded
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/documents_data.xml',
|
||||
'wizards/upload_file_wizard_view.xml',
|
||||
'views/views.xml',
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
@@ -1,21 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# from odoo import http
|
||||
|
||||
|
||||
# class JikimoPurchaseTierValidation(http.Controller):
|
||||
# @http.route('/jikimo_purchase_tier_validation/jikimo_purchase_tier_validation', auth='public')
|
||||
# def index(self, **kw):
|
||||
# return "Hello, world"
|
||||
|
||||
# @http.route('/jikimo_purchase_tier_validation/jikimo_purchase_tier_validation/objects', auth='public')
|
||||
# def list(self, **kw):
|
||||
# return http.request.render('jikimo_purchase_tier_validation.listing', {
|
||||
# 'root': '/jikimo_purchase_tier_validation/jikimo_purchase_tier_validation',
|
||||
# 'objects': http.request.env['jikimo_purchase_tier_validation.jikimo_purchase_tier_validation'].search([]),
|
||||
# })
|
||||
|
||||
# @http.route('/jikimo_purchase_tier_validation/jikimo_purchase_tier_validation/objects/<model("jikimo_purchase_tier_validation.jikimo_purchase_tier_validation"):obj>', auth='public')
|
||||
# def object(self, obj, **kw):
|
||||
# return http.request.render('jikimo_purchase_tier_validation.object', {
|
||||
# 'object': obj
|
||||
# })
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- 创建采购合同文件夹 -->
|
||||
<record id="documents_purchase_contracts_folder" model="documents.folder">
|
||||
<field name="name">采购合同</field>
|
||||
<field name="description">存放采购合同相关文件</field>
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,30 +0,0 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<record id="object0" model="jikimo_purchase_tier_validation.jikimo_purchase_tier_validation">
|
||||
<field name="name">Object 0</field>
|
||||
<field name="value">0</field>
|
||||
</record>
|
||||
|
||||
<record id="object1" model="jikimo_purchase_tier_validation.jikimo_purchase_tier_validation">
|
||||
<field name="name">Object 1</field>
|
||||
<field name="value">10</field>
|
||||
</record>
|
||||
|
||||
<record id="object2" model="jikimo_purchase_tier_validation.jikimo_purchase_tier_validation">
|
||||
<field name="name">Object 2</field>
|
||||
<field name="value">20</field>
|
||||
</record>
|
||||
|
||||
<record id="object3" model="jikimo_purchase_tier_validation.jikimo_purchase_tier_validation">
|
||||
<field name="name">Object 3</field>
|
||||
<field name="value">30</field>
|
||||
</record>
|
||||
|
||||
<record id="object4" model="jikimo_purchase_tier_validation.jikimo_purchase_tier_validation">
|
||||
<field name="name">Object 4</field>
|
||||
<field name="value">40</field>
|
||||
</record>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -21,12 +21,8 @@ class jikimo_purchase_tier_validation(models.Model):
|
||||
|
||||
def button_confirm(self):
|
||||
for record in self:
|
||||
# if record.need_validation and record.validation_status != 'validated':
|
||||
# raise ValidationError(_('此操作需要至少对一条记录进行审批。\n请发起审批申请。'))
|
||||
if record.state in ['to approve']:
|
||||
raise ValidationError(_('请先完成审批。'))
|
||||
# if record.state == 'approved':
|
||||
# record.state = 'purchase'
|
||||
res = super(jikimo_purchase_tier_validation, self).button_confirm()
|
||||
for record in self:
|
||||
if record.state == 'approved':
|
||||
@@ -39,45 +35,8 @@ class jikimo_purchase_tier_validation(models.Model):
|
||||
record.message_subscribe([record.partner_id.id])
|
||||
return res
|
||||
|
||||
# def button_confirm(self):
|
||||
# self = self.with_context(skip_validation=True)
|
||||
# return super().button_confirm()
|
||||
#
|
||||
# def _check_state_conditions(self, vals):
|
||||
# self.ensure_one()
|
||||
# if self._context.get('skip_validation'):
|
||||
# return False
|
||||
# return (
|
||||
# self._check_state_from_condition()
|
||||
# and vals.get(self._state_field) in self._state_to
|
||||
# )
|
||||
|
||||
def request_validation(self):
|
||||
for record in self:
|
||||
error_messages = []
|
||||
|
||||
# 检查必填字段
|
||||
required_fields = {
|
||||
'partner_ref': '合同名称',
|
||||
'contract_number': '合同编号'
|
||||
}
|
||||
|
||||
missing_fields = [
|
||||
name for field, name in required_fields.items()
|
||||
if not record[field]
|
||||
]
|
||||
|
||||
if missing_fields:
|
||||
error_messages.append('* 如下字段要求必须填写:%s' % '、'.join(missing_fields))
|
||||
|
||||
# 检查合同文件
|
||||
if not record.contract_document_id:
|
||||
error_messages.append('* 必须点击上传合同文件')
|
||||
|
||||
# 如果有任何错误,一次性显示所有错误信息
|
||||
if error_messages:
|
||||
raise ValidationError('\n'.join(error_messages))
|
||||
|
||||
# 添加通知消息
|
||||
if hasattr(record, 'message_post'):
|
||||
current_user = self.env.user.name
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_ir_attachment_wizard,ir.attachment.wizard,model_ir_attachment_wizard,base.group_user,1,1,1,1
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<template id="listing">
|
||||
<ul>
|
||||
<li t-foreach="objects" t-as="object">
|
||||
<a t-attf-href="#{ root }/objects/#{ object.id }">
|
||||
<t t-esc="object.display_name"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<template id="object">
|
||||
<h1><t t-esc="object.display_name"/></h1>
|
||||
<dl>
|
||||
<t t-foreach="object._fields" t-as="field">
|
||||
<dt><t t-esc="field"/></dt>
|
||||
<dd><t t-esc="object[field]"/></dd>
|
||||
</t>
|
||||
</dl>
|
||||
</template>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -23,76 +23,10 @@
|
||||
<xpath expr="//header/field[@name='state']" position="replace">
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,sent,to approve, approved, purchase" readonly="1"/>
|
||||
</xpath>
|
||||
|
||||
|
||||
<xpath expr="//header/button[last()]" position="after">
|
||||
<button name="button_cancel" states="draft,to approve,sent,purchase" string="取消" type="object" data-hotkey="x" />
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//header/button[@name='action_rfq_send'][1]" position="before">
|
||||
<field name="validation_status" invisible="1"/>
|
||||
<field name="is_upload_contract_file" invisible="1"/>
|
||||
<button name="upload_contract_file" string="上传合同" type="object" class="oe_highlight" attrs="{'invisible': ['|', '|', ('validation_status', '!=', 'no'), ('is_upload_contract_file', '=', True), ('state', 'not in', ['draft', 'sent'])]}"/>]}"/>
|
||||
<button name="delete_contract_file" string="删除合同" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('validation_status', '!=', 'no'), ('is_upload_contract_file', '=', False)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//notebook/page[1]" position="before">
|
||||
<page string="合同" name="contract_documents"
|
||||
attrs="{'invisible': [('contract_document_id', '=', False)]}"
|
||||
autofocus="autofocus">
|
||||
<group>
|
||||
<group>
|
||||
<field name="contract_document_id" invisible="1"/>
|
||||
<field name="contract_file_name" invisible="1"/>
|
||||
<field name="contract_file"
|
||||
widget="adaptive_viewer"
|
||||
filename="contract_file_name"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- actions opening views on models -->
|
||||
<!--
|
||||
<record model="ir.actions.act_window" id="jikimo_purchase_tier_validation.action_window">
|
||||
<field name="name">jikimo_purchase_tier_validation window</field>
|
||||
<field name="res_model">jikimo_purchase_tier_validation.jikimo_purchase_tier_validation</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- server action to the one above -->
|
||||
<!--
|
||||
<record model="ir.actions.server" id="jikimo_purchase_tier_validation.action_server">
|
||||
<field name="name">jikimo_purchase_tier_validation server</field>
|
||||
<field name="model_id" ref="model_jikimo_purchase_tier_validation_jikimo_purchase_tier_validation"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = {
|
||||
"type": "ir.actions.act_window",
|
||||
"view_mode": "tree,form",
|
||||
"res_model": model._name,
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- Top menu item -->
|
||||
<!--
|
||||
<menuitem name="jikimo_purchase_tier_validation" id="jikimo_purchase_tier_validation.menu_root"/>
|
||||
-->
|
||||
<!-- menu categories -->
|
||||
<!--
|
||||
<menuitem name="Menu 1" id="jikimo_purchase_tier_validation.menu_1" parent="jikimo_purchase_tier_validation.menu_root"/>
|
||||
<menuitem name="Menu 2" id="jikimo_purchase_tier_validation.menu_2" parent="jikimo_purchase_tier_validation.menu_root"/>
|
||||
-->
|
||||
<!-- actions -->
|
||||
<!--
|
||||
<menuitem name="List" id="jikimo_purchase_tier_validation.menu_1_list" parent="jikimo_purchase_tier_validation.menu_1"
|
||||
action="jikimo_purchase_tier_validation.action_window"/>
|
||||
<menuitem name="Server to list" id="jikimo_purchase_tier_validation" parent="jikimo_purchase_tier_validation.menu_2"
|
||||
action="jikimo_purchase_tier_validation.action_server"/>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,2 +1 @@
|
||||
from . import upload_file_wizard
|
||||
from . import comment_wizard
|
||||
from . import comment_wizard
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class IrAttachmentWizard(models.TransientModel):
|
||||
_name = 'ir.attachment.wizard'
|
||||
_description = '文件上传向导'
|
||||
|
||||
attachment = fields.Binary(string='选择文件', required=True)
|
||||
filename = fields.Char(string='文件名')
|
||||
res_model = fields.Char()
|
||||
res_id = fields.Integer()
|
||||
|
||||
# def action_upload_file(self):
|
||||
# self.ensure_one()
|
||||
# # 首先创建 ir.attachment
|
||||
# attachment = self.env['ir.attachment'].create({
|
||||
# 'name': self.filename,
|
||||
# 'type': 'binary',
|
||||
# 'datas': self.attachment,
|
||||
# 'res_model': self.res_model,
|
||||
# 'res_id': self.res_id,
|
||||
# })
|
||||
#
|
||||
# # 获取默认的文档文件夹
|
||||
# workspace = self.env['documents.folder'].search([('name', '=', '采购合同')], limit=1)
|
||||
#
|
||||
# # 创建 documents.document 记录
|
||||
# document = self.env['documents.document'].create({
|
||||
# 'name': self.filename,
|
||||
# 'attachment_id': attachment.id,
|
||||
# 'folder_id': workspace.id,
|
||||
# 'res_model': self.res_model,
|
||||
# 'res_id': self.res_id,
|
||||
# })
|
||||
#
|
||||
# return {
|
||||
# 'type': 'ir.actions.client',
|
||||
# 'tag': 'display_notification',
|
||||
# 'params': {
|
||||
# 'title': _('成功'),
|
||||
# 'message': _('文件上传成功'),
|
||||
# 'type': 'success',
|
||||
# }
|
||||
# }
|
||||
|
||||
def action_upload_file(self):
|
||||
self.ensure_one()
|
||||
# 获取当前用户的 partner_id
|
||||
current_partner = self.env.user.partner_id
|
||||
# 首先创建 ir.attachment
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'name': self.filename,
|
||||
'type': 'binary',
|
||||
'datas': self.attachment,
|
||||
'res_model': self.res_model,
|
||||
'res_id': self.res_id,
|
||||
})
|
||||
|
||||
# 获取默认的文档文件夹
|
||||
workspace = self.env['documents.folder'].search([('name', '=', '采购合同')], limit=1)
|
||||
|
||||
# 创建 documents.document 记录
|
||||
document = self.env['documents.document'].create({
|
||||
'name': self.filename,
|
||||
'attachment_id': attachment.id,
|
||||
'folder_id': workspace.id,
|
||||
'res_model': self.res_model,
|
||||
'res_id': self.res_id,
|
||||
'partner_id': current_partner.id,
|
||||
})
|
||||
|
||||
# 更新采购订单的合同文档字段
|
||||
purchase_order = self.env['purchase.order'].browse(self.res_id)
|
||||
purchase_order.write({
|
||||
'contract_document_id': document.id,
|
||||
'is_upload_contract_file': True
|
||||
})
|
||||
|
||||
# 显示成功消息并关闭向导
|
||||
message = {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('成功'),
|
||||
'message': _('文件上传成功'),
|
||||
'type': 'success',
|
||||
'sticky': False, # 自动消失
|
||||
'next': {
|
||||
'type': 'ir.actions.act_window_close'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message
|
||||
|
||||
|
||||
# def action_upload_file(self):
|
||||
# self.ensure_one()
|
||||
# attachment = self.env['ir.attachment'].create({
|
||||
# 'name': self.filename,
|
||||
# 'type': 'binary',
|
||||
# 'datas': self.attachment,
|
||||
# 'res_model': self.res_model,
|
||||
# 'res_id': self.res_id,
|
||||
# })
|
||||
# return {
|
||||
# 'type': 'ir.actions.client',
|
||||
# 'tag': 'display_notification',
|
||||
# 'params': {
|
||||
# 'title': _('成功'),
|
||||
# 'message': _('文件上传成功'),
|
||||
# 'type': 'success',
|
||||
# }
|
||||
# }
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_upload_file_wizard_form" model="ir.ui.view">
|
||||
<field name="name">ir.attachment.wizard.form</field>
|
||||
<field name="model">ir.attachment.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="上传文件">
|
||||
<group>
|
||||
<field name="attachment" widget="binary" filename="filename" options="{'accepted_file_extensions': '.pdf,.doc,.docx,.jpg,.jpeg,.png'}"/>
|
||||
<field name="filename" invisible="1"/>
|
||||
<field name="res_model" invisible="1"/>
|
||||
<field name="res_id" invisible="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_upload_file" string="确认上传" type="object" class="btn-primary"/>
|
||||
<button string="取消" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -4,6 +4,7 @@ import json
|
||||
import logging
|
||||
from odoo.addons.sf_mrs_connect.controllers.controllers import Sf_Mrs_Connect
|
||||
from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect
|
||||
from datetime import datetime
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -30,6 +31,7 @@ class WorkorderExceptionConroller(http.Controller):
|
||||
workorder = request.env['mrp.workorder'].sudo().search([
|
||||
('rfid_code', '=', ret['RfidCode']),
|
||||
('routing_type', '=', 'CNC加工'),
|
||||
('state', '!=', 'rework')
|
||||
])
|
||||
if not workorder:
|
||||
res = {'Succeed': False, 'ErrorCode': 401, 'Error': '无效的工单'}
|
||||
@@ -41,7 +43,10 @@ class WorkorderExceptionConroller(http.Controller):
|
||||
'exception_code': ret.get('coding'),
|
||||
'exception_content': ret.get('Error', '')
|
||||
})
|
||||
|
||||
# 申请重新编程
|
||||
workorder.production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
reprogramming_reason=ret.get('Error', ''))
|
||||
workorder.production_id.write({'programming_state': '编程中', 'work_state': '编程中', 'is_rework': False})
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
_logger.info('workder_exception error:%s' % e)
|
||||
|
||||
@@ -132,6 +132,26 @@ class Sf_Bf_Connect(http.Controller):
|
||||
request.cr.rollback()
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/api/bfm_cancel_order', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_bfm_cancel_order(self, **kw):
|
||||
"""
|
||||
业务平台取消销售订单
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
res = {'status': 1, 'message': '工厂取消销售订单成功'}
|
||||
logging.info('get_bfm_cancel_order:%s' % kw['order_number'])
|
||||
try:
|
||||
sale_order_info = request.env['sale.order'].sudo().search([('name', '=', kw['order_number'])])
|
||||
sale_order_info._action_cancel()
|
||||
return json.JSONEncoder().encode(res)
|
||||
except Exception as e:
|
||||
logging.error('get_bfm_cancel_order error: %s' % e)
|
||||
res['status'] = -1
|
||||
res['message'] = '工厂取消销售订单失败,请联系管理员'
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
|
||||
class jdElcp(http.Controller):
|
||||
|
||||
|
||||
@@ -577,16 +577,19 @@ class MrpProduction(models.Model):
|
||||
|
||||
# 编程单更新
|
||||
# 增加触发时间参数
|
||||
def update_programming_state(self, trigger_time=None):
|
||||
def update_programming_state(self, trigger_time=None, reprogramming_reason=None):
|
||||
try:
|
||||
manufacturing_type = 'rework'
|
||||
manufacturing_type = None
|
||||
if self.is_scrap:
|
||||
manufacturing_type = 'scrap'
|
||||
elif self.tool_state == '2':
|
||||
manufacturing_type = 'invalid_tool_rework'
|
||||
elif self.is_rework:
|
||||
manufacturing_type = 'rework'
|
||||
res = {'programming_no': self.programming_no,
|
||||
'manufacturing_type': manufacturing_type,
|
||||
'trigger_time': trigger_time}
|
||||
'trigger_time': trigger_time,
|
||||
'reprogramming_reason': reprogramming_reason}
|
||||
logging.info('res=%s:' % res)
|
||||
configsettings = self.env['res.config.settings'].get_values()
|
||||
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
||||
@@ -655,6 +658,8 @@ class MrpProduction(models.Model):
|
||||
programme_way = 'manual operation'
|
||||
else:
|
||||
programme_way = 'auto'
|
||||
if cnc.production_type == '人工线下加工':
|
||||
programme_way = 'manual operation'
|
||||
if quick_order:
|
||||
programme_way = 'manual operation'
|
||||
try:
|
||||
@@ -1292,7 +1297,7 @@ class MrpProduction(models.Model):
|
||||
for rework_item in rework_workorder:
|
||||
pending_workorder = production.workorder_ids.filtered(
|
||||
lambda m1: m1.state in [
|
||||
'pending'] and m1.processing_panel == rework_item.processing_panel and m1.routing_type == 'CNC加工')
|
||||
'pending'] and m1.processing_panel == rework_item.processing_panel and m1.routing_type in ['CNC加工', '人工线下加工'])
|
||||
if not pending_workorder.cnc_ids:
|
||||
production.get_new_program(rework_item.processing_panel)
|
||||
# production.write({'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||
@@ -1302,6 +1307,7 @@ class MrpProduction(models.Model):
|
||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions_not_delivered}')
|
||||
productions = productions.filtered(lambda p: p.production_type == '自动化产线加工')
|
||||
productions.production_cnc_tool_checkout()
|
||||
except Exception as e:
|
||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||
@@ -1334,7 +1340,7 @@ class MrpProduction(models.Model):
|
||||
if productions:
|
||||
for production in productions:
|
||||
panel_workorder = production.workorder_ids.filtered(lambda
|
||||
pw: pw.processing_panel == processing_panel and pw.routing_type == 'CNC加工' and pw.state not in (
|
||||
pw: pw.processing_panel == processing_panel and pw.routing_type in ['CNC加工', '人工线下加工'] and pw.state not in (
|
||||
'rework', 'done'))
|
||||
if panel_workorder:
|
||||
if panel_workorder.cmm_ids:
|
||||
@@ -1360,7 +1366,7 @@ class MrpProduction(models.Model):
|
||||
'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
logging.info('len(cnc_worksheet):%s' % len(panel_workorder.cnc_worksheet))
|
||||
pre_workorder = production.workorder_ids.filtered(lambda
|
||||
ap: ap.routing_type == '装夹预调' and ap.processing_panel == processing_panel and ap.state not in (
|
||||
ap: ap.routing_type in ['装夹预调', '人工线下加工'] and ap.processing_panel == processing_panel and ap.state not in (
|
||||
'rework', 'done'))
|
||||
if pre_workorder:
|
||||
pre_workorder.write(
|
||||
|
||||
@@ -455,6 +455,32 @@ class ResMrpWorkOrder(models.Model):
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
is_rework = fields.Boolean(string='是否返工', default=False)
|
||||
# rework_flag = fields.Boolean(string='返工标志', compute='_compute_rework_flag')
|
||||
#
|
||||
# @api.depends('state', 'production_line_state')
|
||||
# def _compute_rework_flag(self):
|
||||
# for record in self:
|
||||
# if record.state == 'done' and record.routing_type == '装夹预调':
|
||||
# next_workorder = record.production_id.workorder_ids.filtered(
|
||||
# lambda w: w.sequence == record.sequence + 1)
|
||||
# if next_workorder and next_workorder.routing_type == 'CNC加工' and next_workorder.state in ['ready',
|
||||
# 'waiting',
|
||||
# 'pending'] and next_workorder.production_line_state == '待上产线':
|
||||
# record.rework_flag = False
|
||||
# elif next_workorder and next_workorder.routing_type == '表面工艺' and next_workorder.state in ['ready',
|
||||
# 'waiting',
|
||||
# 'pending']:
|
||||
# record.rework_flag = False
|
||||
# else:
|
||||
# record.rework_flag = True
|
||||
# else:
|
||||
# record.rework_flag = True
|
||||
#
|
||||
# def button_rework(self):
|
||||
# for item in self:
|
||||
# item.state = 'progress'
|
||||
# for time_id in item.time_ids:
|
||||
# time_id.write({'date_end': None})
|
||||
|
||||
def button_change_env(self):
|
||||
self.is_test_env = not self.is_test_env
|
||||
|
||||
@@ -180,14 +180,14 @@ class StockRule(models.Model):
|
||||
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
||||
productions_values)
|
||||
# 将这一批制造订单的采购组根据成品设置为不同的采购组
|
||||
product_group_id = {}
|
||||
for index, production in enumerate(productions):
|
||||
if production.product_id.id not in product_group_id.keys():
|
||||
product_group_id[production.product_id.id] = production.procurement_group_id.id
|
||||
else:
|
||||
productions_values[index].update({'name': production.name})
|
||||
procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
|
||||
production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
|
||||
# product_group_id = {}
|
||||
# for index, production in enumerate(productions):
|
||||
# if production.product_id.id not in product_group_id.keys():
|
||||
# product_group_id[production.product_id.id] = production.procurement_group_id.id
|
||||
# else:
|
||||
# productions_values[index].update({'name': production.name})
|
||||
# procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
|
||||
# production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
|
||||
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
@@ -197,7 +197,7 @@ class StockRule(models.Model):
|
||||
'''
|
||||
# productions._create_workorder()
|
||||
#
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
|
||||
(
|
||||
p.move_dest_ids.procure_method != 'make_to_order' and not
|
||||
@@ -289,7 +289,7 @@ class StockRule(models.Model):
|
||||
if production_item.product_id.id in product_id_to_production_names:
|
||||
# 同一个产品多个制造订单对应一个编程单和模型库
|
||||
# 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
|
||||
if not production_item.programming_no and production_item.production_type == '自动化产线加工':
|
||||
if not production_item.programming_no and production_item.production_type in ['自动化产线加工', '人工线下加工']:
|
||||
if not production_programming.programming_no:
|
||||
production_item.fetchCNC(
|
||||
', '.join(product_id_to_production_names[production_item.product_id.id]))
|
||||
@@ -314,6 +314,11 @@ class StockRule(models.Model):
|
||||
i += 1
|
||||
technology_design_values.append(
|
||||
self.env['sf.technology.design'].json_technology_design_str(k, route, i, False))
|
||||
elif production_item.production_type == '人工线下加工':
|
||||
for route in product_routing_workcenter:
|
||||
i += 1
|
||||
technology_design_values.append(
|
||||
self.env['sf.technology.design'].json_technology_design_str('ZM', route, i, False))
|
||||
else:
|
||||
for route in product_routing_workcenter:
|
||||
i += 1
|
||||
|
||||
@@ -117,11 +117,11 @@
|
||||
<xpath expr="//sheet//group//group//div[3]" position="after">
|
||||
<field name="production_type" readonly="1"/>
|
||||
<field name="manual_quotation" readonly="1"
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/>
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
|
||||
<field name="programming_no" readonly="1"
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/>
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
|
||||
<field name="programming_state" readonly="1"
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"
|
||||
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"
|
||||
decoration-success="programming_state == '已编程'"
|
||||
decoration-warning="programming_state =='编程中'"
|
||||
decoration-danger="programming_state =='已编程未下发'"/>
|
||||
@@ -632,6 +632,8 @@
|
||||
<field name="state" icon="fa-filter" enable_counters="1"/>
|
||||
<field name="delivery_status" icon="fa-filter" enable_counters="1"/>
|
||||
<field name="production_type" icon="fa-filter" enable_counters="1"/>
|
||||
<field name="programming_state" icon="fa-filter" enable_counters="1"/>
|
||||
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
<filter name='todo' position="replace"/>
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
<field name='is_delivery' invisible="1"/>
|
||||
<field name="is_trayed" invisible="1"/>
|
||||
<field name="is_inspect" invisible="1"/>
|
||||
<!-- <field name="rework_flag" invisible="1"/>-->
|
||||
<!-- <field name='is_send_program_again' invisible="1"/>-->
|
||||
<!-- 工单form页面的开始停工按钮等 -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
@@ -211,6 +212,9 @@
|
||||
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
|
||||
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
|
||||
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
|
||||
<!-- <button type="object" class="oe_highlight jikimo_button_confirm" name="button_rework"-->
|
||||
<!-- string="返工"-->
|
||||
<!-- attrs='{"invisible": [("rework_flag","=",True)]}' confirm="是否返工"/>-->
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="开料要求" attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'>
|
||||
@@ -239,7 +243,7 @@
|
||||
invisible="1" sum="real duration"/>
|
||||
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
|
||||
<field name="manual_quotation" readonly="1"
|
||||
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||
attrs="{'invisible': [('routing_type', 'not in', ['CNC加工', '人工线下加工'])]}"/>
|
||||
<field name="processing_panel" readonly="1"
|
||||
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
|
||||
<field name="equipment_id" readonly="1"
|
||||
@@ -489,7 +493,7 @@
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<page string="2D加工图纸" attrs="{'invisible': [('routing_type','!=','装夹预调')]}">
|
||||
<page string="2D加工图纸" attrs='{"invisible": [("routing_type","not in",["装夹预调", "人工线下加工"])]}'>
|
||||
<field name="machining_drawings" widget="adaptive_viewer"/>
|
||||
</page>
|
||||
|
||||
@@ -561,7 +565,7 @@
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
|
||||
<field name="cnc_ids" widget="one2many" string="工作程序" default_order="sequence_number,id"
|
||||
readonly="0">
|
||||
<tree>
|
||||
@@ -585,7 +589,7 @@
|
||||
</field>
|
||||
|
||||
</page>
|
||||
<page string="CMM程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<page string="CMM程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
|
||||
<field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1">
|
||||
<tree>
|
||||
<field name="sequence_number"/>
|
||||
@@ -638,7 +642,7 @@
|
||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form//sheet//group//group[2]" position="replace">
|
||||
<group string="装夹图纸" attrs="{'invisible': [('routing_type', '!=', '装夹预调')]}">
|
||||
<group string="装夹图纸" attrs="{'invisible': [('routing_type', 'not in', ['装夹预调', '人工线下加工'])]}">
|
||||
<!-- 隐藏加工图纸字段名 -->
|
||||
<field name="processing_drawing" widget="pdf_viewer" string="" readonly="1"/>
|
||||
<!-- <field name="production_id" invisible="0"/>-->
|
||||
|
||||
@@ -16,6 +16,7 @@ class SFMessageProduct(models.Model):
|
||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', product_product.id)])
|
||||
production_num = 0
|
||||
routing_type = None
|
||||
for mrp_production_info in mrp_production_list:
|
||||
routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调'
|
||||
mrp_production_ready = mrp_production_info.workorder_ids.filtered(
|
||||
@@ -23,7 +24,7 @@ class SFMessageProduct(models.Model):
|
||||
if mrp_production_ready:
|
||||
production_num += 1
|
||||
if production_num >= 1:
|
||||
url = self.get_request_url()
|
||||
url = self.get_request_url(routing_type)
|
||||
content = content.replace('{{product_id}}', product_product.name).replace(
|
||||
'{{number}}', str(production_num)).replace(
|
||||
'{{request_url}}', url)
|
||||
@@ -42,11 +43,15 @@ class SFMessageProduct(models.Model):
|
||||
contents.append(content)
|
||||
return contents, message_queue_ids
|
||||
|
||||
def get_request_url(self):
|
||||
def get_request_url(self, routing_type):
|
||||
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.ref('mrp.menu_mrp_root').id
|
||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', '工件装夹中心')]).id
|
||||
if routing_type == '人工线下加工':
|
||||
routing_name = '线下工作中心'
|
||||
else:
|
||||
routing_name = '工件装夹中心'
|
||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', routing_name)]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||
'view_type': 'list', 'active_id': active_id}
|
||||
|
||||
@@ -27,7 +27,9 @@ class SFMessageStockPicking(models.Model):
|
||||
for record in self:
|
||||
if (record.state == 'assigned' and record.picking_type_id.sequence_code == 'PC'
|
||||
and record.product_id.categ_id.type == '坯料'):
|
||||
record.add_queue('坯料发料提醒')
|
||||
jikimo_message_queue = record.get_message_queue(record.id)
|
||||
if not jikimo_message_queue:
|
||||
record.add_queue('坯料发料提醒')
|
||||
|
||||
if record.picking_type_id.sequence_code == 'SFP' and record.state == 'done':
|
||||
stock_picking_sfp = record.env['stock.picking'].search(
|
||||
@@ -107,3 +109,14 @@ class SFMessageStockPicking(models.Model):
|
||||
# 拼接URL
|
||||
full_url = url + "/web#" + query_string
|
||||
return full_url
|
||||
|
||||
def get_message_queue(self, res_id):
|
||||
business_node_id = self.env.ref('sf_message.bussiness_material_picking_remind').id
|
||||
message_template = self.env["jikimo.message.template"].sudo().search([
|
||||
("model", "=", self._name),
|
||||
("bussiness_node_id", "=", business_node_id)
|
||||
], limit=1)
|
||||
jikimo_message_queue = self.env['jikimo.message.queue'].sudo().search(
|
||||
[('res_id', '=', res_id), ("message_status", "in", ("pending", "sent")),
|
||||
('message_template_id', '=', message_template.id)])
|
||||
return jikimo_message_queue
|
||||
|
||||
@@ -61,7 +61,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
for panel in ret['processing_panel'].split(','):
|
||||
# 查询状态为进行中且工序类型为CNC加工的工单
|
||||
cnc_workorder_has = production.workorder_ids.filtered(
|
||||
lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done',
|
||||
lambda ach: ach.routing_type in ['CNC加工', '人工线下加工'] and ach.state not in ['progress', 'done',
|
||||
'rework',
|
||||
'cancel'] and ach.processing_panel == panel)
|
||||
if cnc_workorder_has:
|
||||
@@ -76,7 +76,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
for panel in ret['processing_panel'].split(','):
|
||||
# 查询状态为进行中且工序类型为CNC加工的工单
|
||||
cnc_workorder = productions.workorder_ids.filtered(
|
||||
lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework'
|
||||
lambda ac: ac.routing_type in ['CNC加工', '人工线下加工'] and ac.state not in ['progress', 'done', 'rework'
|
||||
'cancel'] and ac.processing_panel == panel)
|
||||
if cnc_workorder:
|
||||
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
||||
@@ -91,19 +91,21 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
logging.info('panel_file_path:%s' % panel_file_path)
|
||||
cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
pre_workorder = productions.workorder_ids.filtered(
|
||||
lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
|
||||
lambda ap: ap.routing_type in ['装夹预调', '人工线下加工'] and ap.state not in ['done', 'rework'
|
||||
'cancel'] and ap.processing_panel == panel)
|
||||
if pre_workorder:
|
||||
pre_workorder.write(
|
||||
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||
productions.filtered(lambda p: p.production_type == '人工线下加工').write({'manual_quotation': True})
|
||||
logging.info('已更新制造订单编程状态:%s' % productions.ids)
|
||||
|
||||
# 对制造订单所有面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions}')
|
||||
re_tool_chekout = False
|
||||
re_tool_chekout = productions.production_cnc_tool_checkout()
|
||||
productions_temp = productions.filtered(lambda p: p.production_type == '自动化产线加工')
|
||||
re_tool_chekout = productions_temp.production_cnc_tool_checkout()
|
||||
if re_tool_chekout:
|
||||
return json.JSONEncoder().encode({'status': -3, 'message': '对cnc工单的程序用刀进行校验失败'})
|
||||
except Exception as e:
|
||||
@@ -200,6 +202,17 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
'send_time': ret['send_time'],
|
||||
})
|
||||
logging.info('已创建无效功能刀具的编程记录:%s' % production.name)
|
||||
elif ret['reprogramming_reason']:
|
||||
production.programming_record_ids.create({
|
||||
'number': len(production.programming_record_ids) + 1,
|
||||
'production_id': production.id,
|
||||
'reason': ret['reprogramming_reason'],
|
||||
'programming_method': ret['programme_way'],
|
||||
'current_programming_count': ret['reprogramming_num'],
|
||||
'target_production_id': productions_reprogram,
|
||||
'apply_time': ret['trigger_time'],
|
||||
'send_time': ret['send_time'],
|
||||
})
|
||||
else:
|
||||
logging.info('无对应状态,不需更新编程记录')
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class ReSaleOrder(models.Model):
|
||||
'name': '%s/%s/%s/%s/%s/%s' % (
|
||||
self.format_float(product.model_long),
|
||||
self.format_float(product.model_width),
|
||||
self.format_float(product.model_height),
|
||||
self.format_float(product.model_height),
|
||||
self.format_float(product.model_volume),
|
||||
machining_accuracy_name,
|
||||
product.materials_id.name),
|
||||
@@ -517,9 +517,10 @@ class ResUserToSale(models.Model):
|
||||
|
||||
@api.model
|
||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
domain = []
|
||||
if self._context.get('is_sale'):
|
||||
if self.env.user.has_group('sf_base.group_sale_director'):
|
||||
domain = []
|
||||
pass
|
||||
elif self.env.user.has_group('sf_base.group_sale_salemanager'):
|
||||
if self.id != self.env.user.id:
|
||||
domain = [('id', '=', self.id)]
|
||||
@@ -528,7 +529,7 @@ class ResUserToSale(models.Model):
|
||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||
elif self._context.get('supplier_rank'):
|
||||
if self.env.user.has_group('sf_base.group_purchase_director'):
|
||||
domain = []
|
||||
pass
|
||||
elif self.env.user.has_group('sf_base.group_purchase'):
|
||||
if self.id != self.env.user.id:
|
||||
domain = [('id', '=', self.id)]
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</field>
|
||||
<xpath expr="//field[@name='date_order']" position="after">
|
||||
<field name="payment_term_id" attrs="{'readonly': ['|', ('invoice_status','=', 'invoiced'), ('state', '=', 'done')]}" options="{'no_create': True}"/>
|
||||
<field name="contract_summary"/>
|
||||
<!-- <field name="contract_summary"/>-->
|
||||
</xpath>
|
||||
<field name="partner_ref" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
|
||||
Reference in New Issue
Block a user