1、新增sf_oca模块
This commit is contained in:
1
sf_oca/__init__.py
Normal file
1
sf_oca/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
23
sf_oca/__manifest__.py
Normal file
23
sf_oca/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
{
|
||||||
|
"name": "sf_oca",
|
||||||
|
"version": "1.0",
|
||||||
|
'summary': '智能工厂oca模块',
|
||||||
|
'sequence': 1,
|
||||||
|
'description': """
|
||||||
|
在本模块,进行流程的审核
|
||||||
|
""",
|
||||||
|
'category': 'sf',
|
||||||
|
'website': 'https://www.sf.jikimo.com',
|
||||||
|
"depends": ["base_tier_validation_forward"],
|
||||||
|
"data": [
|
||||||
|
"security/ir.model.access.csv",
|
||||||
|
"templates/tier_validation_templates.xml",
|
||||||
|
],
|
||||||
|
"assets": {},
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'installable': True,
|
||||||
|
'application': False,
|
||||||
|
'auto_install': False,
|
||||||
|
}
|
||||||
1
sf_oca/models/__init__.py
Normal file
1
sf_oca/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import tier_validation
|
||||||
18
sf_oca/models/tier_validation.py
Normal file
18
sf_oca/models/tier_validation.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# 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):
|
||||||
|
_inherit = "tier.validation"
|
||||||
|
|
||||||
|
def _notify_restarted_review_body(self):
|
||||||
|
return _("%s 取消审批请求.") % (self.env.user.name)
|
||||||
|
|
||||||
1
sf_oca/security/ir.model.access.csv
Normal file
1
sf_oca/security/ir.model.access.csv
Normal file
@@ -0,0 +1 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
122
sf_oca/templates/tier_validation_templates.xml
Normal file
122
sf_oca/templates/tier_validation_templates.xml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?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>
|
||||||
|
<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;"
|
||||||
|
>
|
||||||
|
<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" />
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user