Accept Merge Request #1020: (feature/oca审批修改 -> develop)
Merge Request: 1、优化组装流程;2、添加权限;3、oca审批优化 Created By: @禹翔辉 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1020?initial=true
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -11,6 +11,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
_description = '功能刀具列表'
|
||||
|
||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具组装单', readonly=True)
|
||||
|
||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||
code = fields.Char('编码')
|
||||
rfid = fields.Char('Rfid', readonly=True)
|
||||
@@ -469,10 +470,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
"""
|
||||
# 根据功能刀具名称、刀具组、直径或尖刀R角、粗/中/精查询该功能刀具是否已经存在
|
||||
record = self.env['sf.real.time.distribution.of.functional.tools'].search(
|
||||
[('functional_name_id', '=', vals['functional_name_id']),
|
||||
('sf_cutting_tool_type_id', '=', vals['sf_cutting_tool_type_id']),
|
||||
('diameter', '=', vals['diameter']), ('knife_tip_r_angle', '=', vals['knife_tip_r_angle']),
|
||||
('coarse_middle_thin', '=', vals['coarse_middle_thin']), ('tool_groups_id', '=', vals['tool_groups_id'])])
|
||||
[('functional_name_id', '=', vals['functional_name_id'])])
|
||||
if len(record) > 0:
|
||||
for obj in record:
|
||||
obj.write({'sf_functional_cutting_tool_entity_ids': [(4, sf_functional_cutting_tool_entity_ids.id)]})
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,base.group_user,1,1,1,0
|
||||
access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_cutting_tool_entity_group_plan_dispatch,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_functional_cutting_tool_entity_group_sf_order_user,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_sf_order_user,1,0,0,0
|
||||
@@ -21,9 +22,9 @@ access_sf_tool_change_requirement_information_group_plan_dispatch,sf.tool.change
|
||||
access_sf_tool_transfer_request_information,sf.tool.transfer.request.information,model_sf_tool_transfer_request_information,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_tool_transfer_request_information_group_plan_dispatch,sf.tool.transfer.request.information,model_sf_tool_transfer_request_information,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
access_sf_functional_tool_assembly,sf.functional.tool.assembly,model_sf_functional_tool_assembly,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_tool_assembly_group_sf_tool_user,sf.functional.tool.assembly_group_sf_tool_user,model_sf_functional_tool_assembly,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_tool_assembly_group_user,sf.functional.tool.assembly_group_user,model_sf_functional_tool_assembly,base.group_user,1,0,0,0
|
||||
access_sf_functional_tool_assembly_group_plan_dispatch,sf.functional.tool.assembly,model_sf_functional_tool_assembly,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
access_sf_functional_tool_assembly_order,sf.functional.tool.assembly.order,model_sf_functional_tool_assembly_order,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_tool_assembly_order_group_plan_dispatch,sf.functional.tool.assembly.order,model_sf_functional_tool_assembly_order,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
@@ -34,5 +35,6 @@ access_sf_fixture_material_search,sf.fixture.material.search,model_sf_fixture_ma
|
||||
access_sf_fixture_material_search_group_plan_dispatch,sf.fixture.material.search,model_sf_fixture_material_search,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
||||
access_sf_functional_tool_dismantle_group_sf_tool_user,sf.functional.tool.dismantle,model_sf_functional_tool_dismantle,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_tool_dismantle_group_plan_dispatch,sf.functional.tool.dismantle,model_sf_functional_tool_dismantle,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_functional_tool_dismantle,sf.functional.tool.dismantle,model_sf_functional_tool_dismantle,base.group_user,1,1,1,0
|
||||
access_sf_functional_tool_dismantle_group_sf_tool_user,sf.functional.tool.dismantle_group_sf_tool_user,model_sf_functional_tool_dismantle,sf_base.group_sf_tool_user,1,1,1,0
|
||||
access_sf_functional_tool_dismantle_group_plan_dispatch,sf.functional.tool.dismantle_group_plan_dispatch,model_sf_functional_tool_dismantle,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
@@ -400,6 +400,9 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="组装单">
|
||||
<field name="sf_functional_tool_assembly_ids" domain="[('assemble_status', '=', 0)]"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
|
||||
@@ -634,12 +634,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
||||
# 创建安全库存信息
|
||||
self.env['sf.real.time.distribution.of.functional.tools'].create_or_edit_safety_stock({
|
||||
'functional_name_id': self.after_name_id.id,
|
||||
'sf_cutting_tool_type_id': self.after_assembly_functional_tool_type_id.id,
|
||||
'tool_groups_id': self.after_tool_groups_id.id,
|
||||
'diameter': self.after_assembly_functional_tool_diameter,
|
||||
'knife_tip_r_angle': self.after_assembly_knife_tip_r_angle,
|
||||
'coarse_middle_thin': self.after_assembly_coarse_middle_thin,
|
||||
'functional_name_id': self.after_name_id.id
|
||||
}, record_1)
|
||||
|
||||
# =====================修改功能刀具组装单、机床换刀申请、CAM工单程序用刀计划的状态==============
|
||||
@@ -820,7 +815,7 @@ class ProductProduct(models.Model):
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
|
||||
self.assembly_order_code, obj, obj.after_tool_groups_id)
|
||||
obj.assembly_order_code, obj, obj.after_tool_groups_id)
|
||||
|
||||
return stock_lot
|
||||
|
||||
|
||||
Reference in New Issue
Block a user