Skip to content

Commit

Permalink
[IMP] sale_tier_validation: black, isort
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel authored and aphon61bank committed Feb 10, 2021
1 parent 860da40 commit 397dae3
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 59 deletions.
11 changes: 3 additions & 8 deletions sale_tier_validation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
{
"name": "Sale Tier Validation",
"summary": "Extends the functionality of Sale Orders to "
"support a tier validation process.",
"support a tier validation process.",
"version": "12.0.1.0.0",
"category": "Sale",
"website": "https://github.com/OCA/sale-workflow",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale",
"base_tier_validation",
],
"data": [
"views/sale_order_view.xml",
],
"depends": ["sale", "base_tier_validation",],
"data": ["views/sale_order_view.xml",],
}
6 changes: 3 additions & 3 deletions sale_tier_validation/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

class SaleOrder(models.Model):
_name = "sale.order"
_inherit = ['sale.order', 'tier.validation']
_state_from = ['draft', 'sent', 'to approve']
_state_to = ['sale', 'approved']
_inherit = ["sale.order", "tier.validation"]
_state_from = ["draft", "sent", "to approve"]
_state_to = ["sale", "approved"]
119 changes: 71 additions & 48 deletions sale_tier_validation/views/sale_order_view.xml
Original file line number Diff line number Diff line change
@@ -1,83 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Open Source Integrators
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="sale_order_form_tier" model="ir.ui.view">
<field name="name">sale.order.form - test</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<button name="action_confirm" position="before">
<button name="request_validation"
<button
name="request_validation"
string="Request Validation"
attrs="{'invisible': ['|','|',('need_validation', '!=', True),('rejected','=',True),('state','not in',['draft','sent','to approve'])]}"
type="object"/>
<button name="restart_validation"
type="object"
/>
<button
name="restart_validation"
string="Restart Validation"
attrs="{'invisible': ['|',('review_ids', '=', []),('state','not in',['draft','sent','to approve'])]}"
type="object"/>
type="object"
/>
</button>
<header position="after">
<field name="need_validation" invisible="1"/>
<field name="validated" invisible="1"/>
<field name="rejected" invisible="1"/>
<div class="alert alert-warning"
role="alert"
attrs="{'invisible': ['|', '|', '|',
<field name="need_validation" invisible="1" />
<field name="validated" invisible="1" />
<field name="rejected" invisible="1" />
<div
class="alert alert-warning"
role="alert"
attrs="{'invisible': ['|', '|', '|',
('validated', '=', True), ('state', 'not in', ['draft','sent','to approve']),
('rejected', '=', True), ('review_ids', '=', [])]}"
style="margin-bottom:0px;">
<p><i class="fa fa-info-circle"/>This SO needs to be
style="margin-bottom:0px;"
>
<p><i class="fa fa-info-circle" />This SO needs to be
validated.
<field name="can_review" invisible="1"/>
<button name="validate_tier"
string="Validate"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="oe_inline oe_button btn-success"
icon="fa-thumbs-up"/>
<button name="reject_tier"
string="Reject"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="btn-icon btn-danger"
icon="fa-thumbs-down"/>
<field name="can_review" invisible="1" />
<button
name="validate_tier"
string="Validate"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="oe_inline oe_button btn-success"
icon="fa-thumbs-up"
/>
<button
name="reject_tier"
string="Reject"
attrs="{'invisible': [('can_review', '=', False)]}"
type="object"
class="btn-icon btn-danger"
icon="fa-thumbs-down"
/>
</p>
</div>
<div class="alert alert-success"
role="alert"
attrs="{'invisible': ['|', '|', ('validated', '!=', True), ('state', 'not in', ['draft','sent','to approve']), ('review_ids', '=', [])]}"
style="margin-bottom:0px;">
<p><i class="fa fa-thumbs-up"/> Operation has been <b>validated</b>!</p>
<div
class="alert alert-success"
role="alert"
attrs="{'invisible': ['|', '|', ('validated', '!=', True), ('state', 'not in', ['draft','sent','to approve']), ('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"
attrs="{'invisible': ['|', '|', ('rejected', '!=', True), ('state', 'not in', ['draft','sent','to approve']), ('review_ids', '=', [])]}"
style="margin-bottom:0px;">
<p><i class="fa fa-thumbs-down"/> Operation has been <b>rejected</b>.</p>
<div
class="alert alert-danger"
role="alert"
attrs="{'invisible': ['|', '|', ('rejected', '!=', True), ('state', 'not in', ['draft','sent','to approve']), ('review_ids', '=', [])]}"
style="margin-bottom:0px;"
>
<p><i class="fa fa-thumbs-down" /> Operation has been <b
>rejected</b>.</p>
</div>
</header>
<xpath expr="//form/div[hasclass('oe_chatter')]" position="before">
<field name="review_ids" widget="tier_validation" attrs="{'invisible':[('review_ids', '=', [])]}"/>
<field
name="review_ids"
widget="tier_validation"
attrs="{'invisible':[('review_ids', '=', [])]}"
/>
</xpath>
</field>
</record>

<record id="view_sale_order_filter" model="ir.ui.view">
<field name="name">sale.order.select - sale_tier_validation</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="inherit_id" ref="sale.view_sales_order_filter" />
<field name="arch" type="xml">
<filter name="my_sale_orders_filter" position="after">
<filter name="needs_review" string="Needs my Review"
domain="[('reviewer_ids','in',uid), ('state', 'not in', ['done', 'cancel','to approve'])]"
help="My Sales to review"/>
<filter name="tier_validated" string="Validated"
domain="[('validated', '=', True)]"
help="SOs validated and ready to be confirmed"/>
<filter
name="needs_review"
string="Needs my Review"
domain="[('reviewer_ids','in',uid), ('state', 'not in', ['done', 'cancel','to approve'])]"
help="My Sales to review"
/>
<filter
name="tier_validated"
string="Validated"
domain="[('validated', '=', True)]"
help="SOs validated and ready to be confirmed"
/>
</filter>
</field>
</record>

</odoo>

0 comments on commit 397dae3

Please sign in to comment.