-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ao_purchase_request: Custom Purchase Request Product Usage
- Loading branch information
1 parent
b265807
commit 06e0051
Showing
9 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import stock_rule | ||
from . import purchase_request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2019 Eficent Business and IT Consulting Services S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class PurchaseRequestLine(models.Model): | ||
_inherit = "purchase.request.line" | ||
|
||
product_type = fields.Selection(related='product_id.type', readonly=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0"?> | ||
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L. | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0) --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="view_purchase_request_form"> | ||
<field name="name">purchase.request.form</field> | ||
<field name="model">purchase.request</field> | ||
<field name="inherit_id" ref="purchase_request_product_usage.view_purchase_request_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='line_ids']/tree/field[@name='usage_id']" | ||
position="before"> | ||
<field name="product_type" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//field[@name='line_ids']/tree/field[@name='usage_id']" | ||
position="attributes"> | ||
<attribute name="attrs">{'required': ['|', ('product_id','=', False), ('product_type', 'in', ['consu', 'service'])]}</attribute> | ||
<attribute name="groups"/> | ||
</xpath> | ||
<xpath expr="//field[@name='line_ids']/form/sheet/group/group/field[@name='usage_id']" | ||
position="before"> | ||
<field name="product_type" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//field[@name='line_ids']/form/sheet/group/group/field[@name='usage_id']" | ||
position="attributes"> | ||
<attribute name="attrs">{'required': ['|', ('product_id','=', False), ('product_type', 'in', ['consu', 'service'])]}</attribute> | ||
<attribute name="groups"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="purchase_request_line_form"> | ||
<field name="name">purchase.request.line.form</field> | ||
<field name="model">purchase.request.line</field> | ||
<field name="inherit_id" ref="purchase_request_product_usage.purchase_request_line_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//sheet/group/group/field[@name='usage_id']" position="before"> | ||
<field name="product_type" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//sheet/group/group/field[@name='usage_id']" position="attributes"> | ||
<attribute name="attrs">{'required': ['|', ('product_id','=', False), ('product_type', 'in', ['consu', 'service'])]}</attribute> | ||
<attribute name="groups"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="purchase_request_line_search" model="ir.ui.view"> | ||
<field name="name">purchase.request.line.search</field> | ||
<field name="model">purchase.request.line</field> | ||
<field name="inherit_id" ref="purchase_request_product_usage.purchase_request_line_search"/> | ||
<field name="arch" type="xml"> | ||
<field name="usage_id" position="replace"> | ||
<field name="product_type" invisible="1"/> | ||
<field name="usage_id" attrs="{'required': ['|', ('product_id','=', False), ('product_type', 'in', ['consu', 'service'])]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import purchase_request_line_make_purchase_order |
9 changes: 9 additions & 0 deletions
9
ao_purchase_request/wizards/purchase_request_line_make_purchase_order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2019 Eficent Business and IT Consulting Services S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0). | ||
from odoo import fields, models | ||
|
||
|
||
class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel): | ||
_inherit = "purchase.request.line.make.purchase.order.item" | ||
|
||
product_type = fields.Selection(related='product_id.type', readonly=True) |
19 changes: 19 additions & 0 deletions
19
ao_purchase_request/wizards/purchase_request_line_make_purchase_order_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L. | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0) --> | ||
<odoo> | ||
|
||
<record id="view_purchase_request_line_make_purchase_order" model="ir.ui.view"> | ||
<field name="name">Purchase Request Line Make Purchase Order</field> | ||
<field name="model">purchase.request.line.make.purchase.order</field> | ||
<field name="inherit_id" ref="purchase_request_product_usage.view_purchase_request_line_make_purchase_order"/> | ||
<field name="arch" type="xml"> | ||
<field name="usage_id" position="replace"> | ||
<field name="product_type" invisible="1"/> | ||
<field name="usage_id" attrs="{'required': ['|', ('product_id','=', False), ('product_type', 'in', ['consu', 'service'])]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> | ||
|