-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG]Migrated Business Requirement Deliverable Resource Template from…
… 8.0 to 10.0. (#236) * [MIG]Migrated Business Requirement Deliverable Resource Template from 8.0 to 10.0. * [IMP]Added Test-cases and Improved test-cases code * [IMP]Improved code for demo data * [IMP]Removed unused import statement * [REM/ADD]Moved demo data files from data folder to demo folder
- Loading branch information
1 parent
016c084
commit 4793547
Showing
9 changed files
with
123 additions
and
64 deletions.
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
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
2 changes: 1 addition & 1 deletion
2
business_requirement_deliverable_resource_template/models/product_template.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
3 changes: 2 additions & 1 deletion
3
business_requirement_deliverable_resource_template/tests/__init__.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Elico Corp (https://www.elico-corp.com). | ||
# © 2017 Elico Corp (https://www.elico-corp.com). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import test_br_resource_template | ||
from . import test_br_deliverable |
57 changes: 57 additions & 0 deletions
57
business_requirement_deliverable_resource_template/tests/test_br_deliverable.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,57 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Elico Corp (https://www.elico-corp.com). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo.tests import common | ||
|
||
|
||
class BusinessRequirementDeliverable(common.TransactionCase): | ||
def setUp(self): | ||
super(BusinessRequirementDeliverable, self).setUp() | ||
self.categ_wtime = self.env.ref('product.uom_categ_wtime') | ||
self.categ_kgm = self.env.ref('product.product_uom_categ_kgm') | ||
|
||
self.UomObj = self.env['product.uom'] | ||
self.uom_hours = self.UomObj.create({ | ||
'name': 'Test-Hours', | ||
'category_id': self.categ_wtime.id, | ||
'factor': 8, | ||
'uom_type': 'smaller'}) | ||
self.uom_kg = self.UomObj.create({ | ||
'name': 'Test-KG', | ||
'category_id': self.categ_kgm.id, | ||
'factor_inv': 1, | ||
'factor': 1, | ||
'uom_type': 'reference', | ||
'rounding': 0.000001}) | ||
self.ProductS = self.env.ref('product.service_order_01') | ||
vals = { | ||
'description': ' test', | ||
'deliverable_lines': [ | ||
(0, 0, {'name': 'deliverable line1', 'qty': 1.0, | ||
'product_id': self.ProductS.id, | ||
'sale_price_unit': 900, 'uom_id': 1}), | ||
(0, 0, {'name': 'deliverable line2', 'qty': 1.0, | ||
'sale_price_unit': 1100, 'uom_id': 1}), | ||
(0, 0, {'name': 'deliverable line3', 'qty': 1.0, | ||
'sale_price_unit': 1300, 'uom_id': 1}), | ||
(0, 0, {'name': 'deliverable line4', 'qty': 1.0, | ||
'sale_price_unit': 1500, 'uom_id': 1, | ||
}), | ||
] | ||
} | ||
self.br = self.env['business.requirement'].create(vals) | ||
self.BRTemplate = self.env['business.requirement.resource.template'] | ||
|
||
def test_product_id_change(self): | ||
for dl in self.br.deliverable_lines: | ||
dl.product_id_change() | ||
|
||
def test_prepare_resource_lines(self): | ||
self.BRT = self.BRTemplate.create({ | ||
'name': 'BR Template', | ||
'product_template_id': self.ProductS.product_tmpl_id.id, | ||
'uom_id': self.uom_hours.id, | ||
'resource_type': 'task' | ||
}) | ||
for dl in self.br.deliverable_lines: | ||
dl._prepare_resource_lines() |
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
50 changes: 25 additions & 25 deletions
50
...uirement_deliverable_resource_template/views/business_requirement_deliverable_default.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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="product_template_only_form_view" model="ir.ui.view"> | ||
<field name="name">product.template.form</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_only_form_view"/> | ||
<field name="arch" type="xml"> | ||
<page name="variants" position='after'> | ||
<page name="resources" | ||
string="Default Resource Template Lines"> | ||
<field name="resource_lines"> | ||
<tree editable="top" default_order="sequence"> | ||
<field name="sequence" widget="handle"/> | ||
<field name="resource_type"/> | ||
<field name="product_id"/> | ||
<field name="name"/> | ||
<field name="qty"/> | ||
<field name="uom_id"/> | ||
</tree> | ||
</field> | ||
</page> | ||
<odoo> | ||
|
||
<record id="product_template_only_form_view" model="ir.ui.view"> | ||
<field name="name">product.template.form</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_only_form_view"/> | ||
<field name="arch" type="xml"> | ||
<page name="variants" position='after'> | ||
<page name="resources" | ||
string="Default Resource Template Lines"> | ||
<field name="resource_lines"> | ||
<tree editable="top" default_order="sequence"> | ||
<field name="sequence" widget="handle"/> | ||
<field name="resource_type"/> | ||
<field name="product_id"/> | ||
<field name="name"/> | ||
<field name="qty"/> | ||
<field name="uom_id"/> | ||
</tree> | ||
</field> | ||
</page> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> | ||
</page> | ||
</field> | ||
</record> | ||
|
||
</odoo> |