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"> <template id="favicon_icon" inherit_id="web.layout" name="Web layout">
<!-- change the title with reliance partner --> <!-- change the title with reliance partner -->
<xpath expr="//head//title" position="before"> <!-- <xpath expr="//head//title" position="before">
<title t-esc="'JIKIMO'"/> <title t-esc="'JIKIMO'"/>
</xpath> </xpath> -->
<!-- change the default favicon icon with --> <!-- change the default favicon icon with -->
<xpath expr="//head//link[@rel='shortcut icon']" position="replace"> <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"/> <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)') neck_length = fields.Float('颈部长度(mm)')
handle_diameter = fields.Float('柄部直径(mm)') handle_diameter = fields.Float('柄部直径(mm)')
handle_length = 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) blade_tip_working_size = fields.Char('刀尖倒角度(°)', size=20)
tip_r_size = fields.Float('刀尖R角(mm)') tip_r_size = fields.Float('刀尖R角(mm)')
blade_tip_taper = fields.Integer('刀尖锥度(°)') 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 odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model): 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_diameter = self.specification_id.blade_tip_diameter
self.cutting_tool_blade_tip_taper = self.specification_id.blade_tip_taper 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_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_working_size = self.specification_id.blade_tip_working_size
self.cutting_tool_blade_tip_r_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_pitch = self.specification_id.pitch
self.cutting_tool_blade_width = self.specification_id.blade_width self.cutting_tool_blade_width = self.specification_id.blade_width
self.cutting_tool_blade_depth = self.specification_id.blade_depth 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(): for product_id, all_production in grouped_product_ids.items():
# 为同一个product_id创建一个生产订单名称列表 # 为同一个product_id创建一个生产订单名称列表
product_id_to_production_names[product_id] = [production.name for production in all_production] product_id_to_production_names[product_id] = [production.name for production in all_production]
# for production_item in productions: for production_item in productions:
#
# production_programming = self.env['mrp.production'].search( production_programming = self.env['mrp.production'].search(
# [('product_id.id', '=', production_item.product_id.id), [('product_id.id', '=', production_item.product_id.id),
# ('origin', '=', production_item.origin)], ('origin', '=', production_item.origin)],
# limit=1, order='id asc') limit=1, order='id asc')
# if production_item.product_id.id in product_id_to_production_names: if production_item.product_id.id in product_id_to_production_names:
# if not production_programming.programming_no: if not production_programming.programming_no:
# if production_item.product_id.model_process_parameters_ids: if production_item.product_id.model_process_parameters_ids:
# is_purchase = False is_purchase = False
# sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids, sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids,
# key=lambda w: w.id) key=lambda w: w.id)
#
# consecutive_process_parameters = [] consecutive_process_parameters = []
# m = 0 m = 0
# for i in range(len(sorted_process_parameters) - 1): for i in range(len(sorted_process_parameters) - 1):
# if m == 0: if m == 0:
# is_purchase = False is_purchase = False
# if self.env['product.template']._get_process_parameters_product( if self.env['product.template']._get_process_parameters_product(
# sorted_process_parameters[i]).partner_id == self.env[ sorted_process_parameters[i]).partner_id == self.env[
# 'product.template']._get_process_parameters_product(sorted_process_parameters[ 'product.template']._get_process_parameters_product(sorted_process_parameters[
# i + 1]).partner_id and \ i + 1]).partner_id and \
# sorted_process_parameters[i].gain_way == '外协': sorted_process_parameters[i].gain_way == '外协':
# if sorted_process_parameters[i] not in consecutive_process_parameters: 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])
# consecutive_process_parameters.append(sorted_process_parameters[i + 1]) consecutive_process_parameters.append(sorted_process_parameters[i + 1])
# m += 1 m += 1
# continue continue
# else: else:
# if m == len(consecutive_process_parameters) - 1 and m != 0: if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters, self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# if sorted_process_parameters[i] in consecutive_process_parameters: if sorted_process_parameters[i] in consecutive_process_parameters:
# is_purchase = True is_purchase = True
# consecutive_process_parameters = [] consecutive_process_parameters = []
# m = 0 m = 0
# # 当前面的连续外协采购单生成再生成当前外协采购单 # 当前面的连续外协采购单生成再生成当前外协采购单
# if is_purchase is False: if is_purchase is False:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters, self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# if m == len(consecutive_process_parameters) - 1 and m != 0: if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters, self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# if sorted_process_parameters[i] in consecutive_process_parameters: if sorted_process_parameters[i] in consecutive_process_parameters:
# is_purchase = True is_purchase = True
# consecutive_process_parameters = [] consecutive_process_parameters = []
# m = 0 m = 0
# if m == len(consecutive_process_parameters) - 1 and m != 0: if m == len(consecutive_process_parameters) - 1 and m != 0:
# self.env['purchase.order'].get_purchase_order(consecutive_process_parameters, self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# if is_purchase is False and m == 0: if is_purchase is False and m == 0:
# if len(sorted_process_parameters) == 1: if len(sorted_process_parameters) == 1:
# self.env['purchase.order'].get_purchase_order(sorted_process_parameters, self.env['purchase.order'].get_purchase_order(sorted_process_parameters,
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# else: else:
# self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i], self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i],
# production_item, production_item,
# product_id_to_production_names) product_id_to_production_names)
# # # 同一个产品多个制造订单对应一个编程单和模型库 # # 同一个产品多个制造订单对应一个编程单和模型库
# # # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递 # # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
# if not production_item.programming_no: if not production_item.programming_no:
# if not production_programming.programming_no: if not production_programming.programming_no:
# production_item.fetchCNC( production_item.fetchCNC(
# ', '.join(product_id_to_production_names[production_item.product_id.id])) ', '.join(product_id_to_production_names[production_item.product_id.id]))
# else: else:
# production_item.write({'programming_no': production_programming.programming_no, production_item.write({'programming_no': production_programming.programming_no,
# 'programming_state': '编程中'}) 'programming_state': '编程中'})
return True return True

View File

@@ -27,6 +27,7 @@ class SFMessageSale(models.Model):
# 继承并重写jikimo.message.dispatch的_get_message() # 继承并重写jikimo.message.dispatch的_get_message()
def _get_message(self, message_queue_ids): 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 == '确认接单': 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 = 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))]) 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 product = sale_order_line[0].product_id.name
elif len(sale_order_line) > 1: elif len(sale_order_line) > 1:
product = '%s...' % sale_order_line[0].product_id.name product = '%s...' % sale_order_line[0].product_id.name
res = super(SFMessageSale, self)._get_message(message_queue_ids) res[0] = res[0].replace('{{product_id}}', product)
if res:
try:
res.add_queue('待排程')
except Exception as e:
logging.info('_get_message error:%s' % e)
return res return res

View File

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

View File

@@ -6,8 +6,8 @@ import os
from datetime import datetime from datetime import datetime
from stl import mesh from stl import mesh
# from OCC.Core.GProp import GProp_GProps # from OCC.Core.GProp import GProp_GProps
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api from odoo import models, fields, api
from odoo.modules import get_resource_path 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 { &:hover {
.title { .title {
background-color: rgba(0, 0, 0, 0.08); background-color: rgba(0, 0, 0, 0.08);

View File

@@ -1,16 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<templates> <templates>
<t t-name="theme_systray"> <t t-name="theme_systray">
<li class="new_icon"> <li class="new_icon">
<label class="theme_vista" style="margin-bottom:0px;" title="Change backend theme"> <label class="theme_vista" style="margin-bottom:0px;" title="Change backend theme">
<t t-if="widget.is_admin"> <t t-if="widget.is_admin">
<div class="icon_div"> <div class="icon_div">
<div class="toggle-icon" role="button"> <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"
</div> height="22"/>
</div> </div>
</t> </div>
</label> </t>
</li> </label>
</t> </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> </templates>

View File

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