Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/销售和排程添加消息推送

This commit is contained in:
liaodanlong
2024-09-23 13:31:27 +08:00
10 changed files with 149 additions and 118 deletions

View File

@@ -5,9 +5,9 @@
<!-- 修改页面头部图标及文字 -->
<template id="favicon_icon" inherit_id="web.layout" name="Web layout">
<!-- change the title with reliance partner -->
<xpath expr="//head//title" position="before">
<!-- <xpath expr="//head//title" position="before">
<title t-esc="'JIKIMO'"/>
</xpath>
</xpath> -->
<!-- change the default favicon icon with -->
<xpath expr="//head//link[@rel='shortcut icon']" position="replace">
<link type="image/x-icon" rel="shortcut icon" href="/jikimo_frontend/static/src/img/jikimo-logo.ico"/>

View File

@@ -21,7 +21,7 @@ class ToolMaterialsBasicParameters(models.Model):
neck_length = fields.Float('颈部长度(mm)')
handle_diameter = fields.Float('柄部直径(mm)')
handle_length = fields.Float('柄部长度(mm)')
blade_tip_diameter = fields.Integer('刀尖直径(mm)')
blade_tip_diameter = fields.Float('刀尖直径(mm)')
blade_tip_working_size = fields.Char('刀尖倒角度(°)', size=20)
tip_r_size = fields.Float('刀尖R角(mm)')
blade_tip_taper = fields.Integer('刀尖锥度(°)')

View File

@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
from odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):
@@ -237,8 +237,8 @@ class ResProductMo(models.Model):
self.cutting_tool_blade_tip_diameter = self.specification_id.blade_tip_diameter
self.cutting_tool_blade_tip_taper = self.specification_id.blade_tip_taper
self.cutting_tool_blade_helix_angle = self.specification_id.blade_helix_angle
self.cutting_tool_blade_tip_working_size = self.specification_id.tip_r_size
self.cutting_tool_blade_tip_r_size = self.specification_id.blade_tip_working_size
self.cutting_tool_blade_tip_working_size = self.specification_id.blade_tip_working_size
self.cutting_tool_blade_tip_r_size = self.specification_id.tip_r_size
self.cutting_tool_pitch = self.specification_id.pitch
self.cutting_tool_blade_width = self.specification_id.blade_width
self.cutting_tool_blade_depth = self.specification_id.blade_depth

View File

@@ -292,78 +292,78 @@ class StockRule(models.Model):
for product_id, all_production in grouped_product_ids.items():
# 为同一个product_id创建一个生产订单名称列表
product_id_to_production_names[product_id] = [production.name for production in all_production]
# for production_item in productions:
#
# production_programming = self.env['mrp.production'].search(
# [('product_id.id', '=', production_item.product_id.id),
# ('origin', '=', production_item.origin)],
# limit=1, order='id asc')
# if production_item.product_id.id in product_id_to_production_names:
# if not production_programming.programming_no:
# if production_item.product_id.model_process_parameters_ids:
# is_purchase = False
# sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids,
# key=lambda w: w.id)
#
# consecutive_process_parameters = []
# m = 0
# for i in range(len(sorted_process_parameters) - 1):
# if m == 0:
# is_purchase = False
# if self.env['product.template']._get_process_parameters_product(
# sorted_process_parameters[i]).partner_id == self.env[
# 'product.template']._get_process_parameters_product(sorted_process_parameters[
# i + 1]).partner_id and \
# sorted_process_parameters[i].gain_way == '外协':
# if sorted_process_parameters[i] not in consecutive_process_parameters:
# consecutive_process_parameters.append(sorted_process_parameters[i])
# consecutive_process_parameters.append(sorted_process_parameters[i + 1])
# m += 1
# continue
# else:
# if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item,
# product_id_to_production_names)
# if sorted_process_parameters[i] in consecutive_process_parameters:
# is_purchase = True
# consecutive_process_parameters = []
# m = 0
# # 当前面的连续外协采购单生成再生成当前外协采购单
# if is_purchase is False:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item,
# product_id_to_production_names)
# if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item,
# product_id_to_production_names)
# if sorted_process_parameters[i] in consecutive_process_parameters:
# is_purchase = True
# consecutive_process_parameters = []
# m = 0
# if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item,
# product_id_to_production_names)
# if is_purchase is False and m == 0:
# if len(sorted_process_parameters) == 1:
# self.env['purchase.order'].get_purchase_order(sorted_process_parameters,
# production_item,
# product_id_to_production_names)
# else:
# self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i],
# production_item,
# product_id_to_production_names)
# # # 同一个产品多个制造订单对应一个编程单和模型库
# # # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
# if not production_item.programming_no:
# if not production_programming.programming_no:
# production_item.fetchCNC(
# ', '.join(product_id_to_production_names[production_item.product_id.id]))
# else:
# production_item.write({'programming_no': production_programming.programming_no,
# 'programming_state': '编程中'})
for production_item in productions:
production_programming = self.env['mrp.production'].search(
[('product_id.id', '=', production_item.product_id.id),
('origin', '=', production_item.origin)],
limit=1, order='id asc')
if production_item.product_id.id in product_id_to_production_names:
if not production_programming.programming_no:
if production_item.product_id.model_process_parameters_ids:
is_purchase = False
sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids,
key=lambda w: w.id)
consecutive_process_parameters = []
m = 0
for i in range(len(sorted_process_parameters) - 1):
if m == 0:
is_purchase = False
if self.env['product.template']._get_process_parameters_product(
sorted_process_parameters[i]).partner_id == self.env[
'product.template']._get_process_parameters_product(sorted_process_parameters[
i + 1]).partner_id and \
sorted_process_parameters[i].gain_way == '外协':
if sorted_process_parameters[i] not in consecutive_process_parameters:
consecutive_process_parameters.append(sorted_process_parameters[i])
consecutive_process_parameters.append(sorted_process_parameters[i + 1])
m += 1
continue
else:
if m == len(consecutive_process_parameters) - 1 and m != 0:
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
production_item,
product_id_to_production_names)
if sorted_process_parameters[i] in consecutive_process_parameters:
is_purchase = True
consecutive_process_parameters = []
m = 0
# 当前面的连续外协采购单生成再生成当前外协采购单
if is_purchase is False:
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
production_item,
product_id_to_production_names)
if m == len(consecutive_process_parameters) - 1 and m != 0:
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
production_item,
product_id_to_production_names)
if sorted_process_parameters[i] in consecutive_process_parameters:
is_purchase = True
consecutive_process_parameters = []
m = 0
if m == len(consecutive_process_parameters) - 1 and m != 0:
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
production_item,
product_id_to_production_names)
if is_purchase is False and m == 0:
if len(sorted_process_parameters) == 1:
self.env['purchase.order'].get_purchase_order(sorted_process_parameters,
production_item,
product_id_to_production_names)
else:
self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i],
production_item,
product_id_to_production_names)
# # 同一个产品多个制造订单对应一个编程单和模型库
# # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
if not production_item.programming_no:
if not production_programming.programming_no:
production_item.fetchCNC(
', '.join(product_id_to_production_names[production_item.product_id.id]))
else:
production_item.write({'programming_no': production_programming.programming_no,
'programming_state': '编程中'})
return True

View File

@@ -27,6 +27,7 @@ class SFMessageSale(models.Model):
# 继承并重写jikimo.message.dispatch的_get_message()
def _get_message(self, message_queue_ids):
res = super(SFMessageSale, self)._get_message(message_queue_ids)
if message_queue_ids.message_template_id.bussiness_node_id.name == '确认接单':
# sale_order = self.env['sale.order'].search([('id', '=', message_queue_ids.model.res_id)])
sale_order_line = self.env['sale.order.line'].search([('order_id', '=', int(message_queue_ids.res_id))])
@@ -34,10 +35,5 @@ class SFMessageSale(models.Model):
product = sale_order_line[0].product_id.name
elif len(sale_order_line) > 1:
product = '%s...' % sale_order_line[0].product_id.name
res = super(SFMessageSale, self)._get_message(message_queue_ids)
if res:
try:
res.add_queue('待排程')
except Exception as e:
logging.info('_get_message error:%s' % e)
res[0] = res[0].replace('{{product_id}}', product)
return res

View File

@@ -8,8 +8,8 @@ from datetime import datetime
import requests
from odoo import http
from odoo.http import request
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError

View File

@@ -6,8 +6,8 @@ import os
from datetime import datetime
from stl import mesh
# from OCC.Core.GProp import GProp_GProps
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api
from odoo.modules import get_resource_path

View File

@@ -1077,6 +1077,13 @@ div.dropdown-menu.bootstrap-datetimepicker-widget {
}
}
}
.subtitle {
margin: 5px 0 0px;
padding: 5px 0;
text-indent: 5px;
background: rgba(0, 0, 0, 0.1);
font-size: 14px;
}
&:hover {
.title {
background-color: rgba(0, 0, 0, 0.08);

View File

@@ -6,11 +6,32 @@
<t t-if="widget.is_admin">
<div class="icon_div">
<div class="toggle-icon" role="button">
<i id='theme_vista' class="fa fa-paint-brush" role="img" aria-label="Theme" width="22" height="22"/>
<i id='theme_vista' class="fa fa-paint-brush" role="img" aria-label="Theme" width="22"
height="22"/>
</div>
</div>
</t>
</label>
</li>
</t>
<t t-name="customDropdownChild" owl="1">
<t t-foreach="children" t-as="child" t-key="child.id">
<t t-if="!child.childrenTree.length">
<a class="t2" t-attf-href="{{getMenuItemHref(child)}}">
<t t-esc="child.name"></t>
</a>
</t>
<div t-if="child.childrenTree.length">
<p class="subtitle">
<t t-esc="child.name"></t>
</p>
<t t-call="customDropdownChild">
<t t-set="children" t-value="child.childrenTree"/>
</t>
</div>
</t>
</t>
</templates>

View File

@@ -24,7 +24,6 @@
</div>
<!-- Current App Sections -->
<div class="d-none d-md-block o_menu_sections_fix ">
<!-- <t t-if="currentAppSections.length"-->
<!-- t-call="web.NavBar.SectionsMenu">-->
@@ -36,11 +35,19 @@
<t t-if="menu.childrenTree.length" >
<p class="title"><t t-esc="menu.name"></t> </p>
<div class="custom_dropdown_fixed">
<t t-foreach="menu.childrenTree" t-as="child" t-key="child.id">
<a t-attf-href="{{getMenuItemHref(child)}}"> <t t-esc="child.name"></t></a>
<t t-call="customDropdownChild">
<t t-set="children" t-value="menu.childrenTree"/>
</t>
</div>
</t>
<!-- <t t-if="menu.childrenTree.length">-->
<!-- <p class="title"><t t-esc="menu.name"></t> </p>-->
<!-- <div class="custom_dropdown_fixed">-->
<!-- <t t-foreach="menu.childrenTree" t-as="child" t-key="child.id">-->
<!-- <a t-attf-href="{{getMenuItemHref(child, 123)}}"> <t t-esc="child.name"></t></a>-->
<!-- </t>-->
<!-- </div>-->
<!-- </t>-->
<t t-if="!menu.childrenTree.length">
<a class="title" t-attf-href="{{getMenuItemHref(menu)}}"> <t t-esc="menu.name"></t></a>
</t>