1、采购审批流程中的英文提示信息改为中文提示;当审批完成后隐藏取消审批按键;2、刀具注册接口添加调用接口提示;

This commit is contained in:
yuxianghui
2024-05-17 14:56:15 +08:00
parent eb83114e54
commit 1a0e96bbdd
3 changed files with 38 additions and 120 deletions

View File

@@ -1,13 +1,7 @@
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from ast import literal_eval
from lxml import etree
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools.misc import frozendict
class TierValidation(models.AbstractModel):

View File

@@ -1,122 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="tier_validation_buttons">
<div>
<button
name="request_validation"
string="发起审批"
t-attf-attrs="{'invisible': ['|','|',('need_validation', '!=', True),('rejected','=',True),('#{state_field}', '#{state_operator}', #{state_value})]}"
type="object"
/>
<button
name="restart_validation"
string="取消审批"
t-attf-attrs="{'invisible': ['|',('review_ids', '=', []),('#{state_field}', '#{state_operator}', #{state_value})]}"
type="object"
/>
</div>
<template id="tier_validation_buttons_sf"
inherit_id="base_tier_validation.tier_validation_buttons">
<xpath expr="//button[@name='request_validation']" position="attributes">
<attribute name="string">发起审批</attribute>
</xpath>
<xpath expr="//button[@name='restart_validation']" position="attributes">
<attribute name="string">取消审批</attribute>
<attribute name="t-attf-attrs">{'invisible': ['|','|',('review_ids', '=', []),('#{state_field}',
'#{state_operator}', #{state_value}), ('validated', '=', True)]}
</attribute>
</xpath>
</template>
<template id="tier_validation_label">
<div>
<field name="need_validation" invisible="1" />
<field name="validated" invisible="1" />
<field name="rejected" invisible="1" />
<div
class="alert alert-warning"
role="alert"
t-attf-attrs="{'invisible': ['|', '|', '|',
('validated', '=', True), ('#{state_field}', '#{state_operator}', #{state_value}),
('rejected', '=', True), ('review_ids', '=', [])]}"
style="margin-bottom:0px;"
>
<template id="tier_validation_label_sf"
inherit_id="base_tier_validation_forward.tier_validation_label_forward">
<xpath expr="//p/i[@class='fa fa-info-circle']" position="replace">
<i class="fa fa-info-circle"/>
这个单据需要验证.
</xpath>
<xpath expr="//div[@class='alert alert-success'][@role='alert']/p" position="replace">
<p>
<i class="fa fa-info-circle" />
这个单据需要验证.
<field name="can_review" invisible="1" />
<button
name="validate_tier"
string="验证"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="oe_inline oe_button btn-success"
icon="fa-thumbs-up"
/>
<button
name="reject_tier"
string="拒绝"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="btn-icon btn-danger"
icon="fa-thumbs-down"
/>
<br /><field name="next_review" readonly="1" />
<i class="fa fa-thumbs-up"/>
审批已通过.
</p>
</div>
<div
class="alert alert-success"
role="alert"
t-attf-attrs="{'invisible': ['|', '|', ('validated', '!=', True), ('#{state_field}', '#{state_operator}', #{state_value}), ('review_ids', '=', [])]}"
style="margin-bottom:0px;"
>
<p>
<i class="fa fa-thumbs-up" />
Operation has been
<b>validated</b>
!
</p>
</div>
<div
class="alert alert-danger"
role="alert"
t-attf-attrs="{'invisible': ['|', '|', ('rejected', '!=', True), ('#{state_field}', '#{state_operator}', #{state_value}), ('review_ids', '=', [])]}"
style="margin-bottom:0px;"
>
<p>
<i class="fa fa-thumbs-down" />
Operation has been
<b>rejected</b>
.
</p>
</div>
</div>
</template>
<template id="tier_validation_reviews">
<field
name="review_ids"
widget="tier_validation"
attrs="{'invisible':[('review_ids', '=', [])]}"
style="width:100%%; margin-top: 10px;"
>
<tree>
<field name="id" />
<field name="name" />
<field name="sequence" />
<field name="requested_by" />
<field name="status" />
<field name="todo_by" />
<field name="done_by" />
<field name="reviewed_date" />
<field name="reviewed_formated_date" />
<field name="comment" />
</tree>
</field>
</template>
<template
id="tier_validation_label_forward"
inherit_id="sf_oca.tier_validation_label"
>
<xpath expr="//button[@name='reject_tier']" position="after">
<field name="can_forward" invisible="1" />
<button
name="forward_tier"
string="Forward"
attrs="{'invisible': [('can_forward', '=', False)]}"
type="object"
class="oe_inline oe_button btn-warning"
icon="fa-arrow-circle-right"
/>
</xpath>
<xpath expr="//button[@name='validate_tier']" position="attributes">
<attribute name="string">验证</attribute>
</xpath>
<xpath expr="//button[@name='reject_tier']" position="attributes">
<attribute name="string">拒绝</attribute>
</xpath>
</template>
</odoo>

View File

@@ -60,6 +60,7 @@ class StockLot(models.Model):
_description = '刀具物料序列号注册'
def enroll_tool_material_stock(self):
logging.info('调用刀具物料序列号注册接口: enroll_tool_material_stock()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -69,6 +70,7 @@ class StockLot(models.Model):
self._get_sync_stock_lot(objs_all, str_url, token, headers)
def sync_enroll_tool_material_stock_all(self):
logging.info('调用刀具物料序列号注册接口: sync_enroll_tool_material_stock_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -104,6 +106,7 @@ class ToolMaterial(models.Model):
crea_url = '/api/tool_material/create'
def enroll_tool_material(self):
logging.info('调用刀具物料注册接口: enroll_tool_material()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -113,6 +116,7 @@ class ToolMaterial(models.Model):
self._get_sync_tool_material_search(objs_all, str_url, token, headers)
def sync_enroll_tool_material_all(self):
logging.info('调用刀具物料注册接口: sync_enroll_tool_material_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -163,6 +167,7 @@ class FunctionalCuttingToolEntity(models.Model):
# 注册同步功能刀具列表
def enroll_functional_tool_entity(self):
logging.info('调用功能刀具列表注册接口: enroll_functional_tool_entity()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -172,6 +177,7 @@ class FunctionalCuttingToolEntity(models.Model):
self._get_sync_functional_cutting_tool_entity(objs_all, str_url, token, headers)
def esync_enroll_functional_tool_entity_all(self):
logging.info('调用功能刀具列表注册接口: esync_enroll_functional_tool_entity_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -256,6 +262,7 @@ class FunctionalToolWarning(models.Model):
# 注册同步功能刀具预警
def enroll_functional_tool_warning(self):
logging.info('调用功能刀具预警注册接口: enroll_functional_tool_warning()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -265,6 +272,7 @@ class FunctionalToolWarning(models.Model):
self.get_sync_functional_tool_warning(objs_all, str_url, token, headers)
def sync_enroll_functional_tool_warning_all(self):
logging.info('调用功能刀具预警注册接口: sync_enroll_functional_tool_warning_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -329,6 +337,7 @@ class StockMoveLine(models.Model):
# 注册同步功能刀具出入库记录
def enroll_functional_tool_move(self):
logging.info('调用功能刀具出入库记录注册接口: enroll_functional_tool_move()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -338,6 +347,7 @@ class StockMoveLine(models.Model):
self.get_sync_stock_move_line(objs_all, str_url, token, headers)
def sync_enroll_functional_tool_move_all(self):
logging.info('调用功能刀具出入库记录注册接口: sync_enroll_functional_tool_move_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -393,6 +403,7 @@ class RealTimeDistributionFunctionalTools(models.Model):
# 注册同步功能刀具预警
def enroll_functional_tool_real_time_distribution(self):
logging.info('调用功能刀具安全库存注册接口: enroll_functional_tool_real_time_distribution()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -402,6 +413,7 @@ class RealTimeDistributionFunctionalTools(models.Model):
self.get_sync_real_time_distribution_functional_tools(objs_all, str_url, token, headers)
def sync_enroll_functional_tool_real_time_distribution_all(self):
logging.info('调用功能刀具安全库存注册接口: sync_enroll_functional_tool_real_time_distribution_all()')
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']