Skip to content

Commit

Permalink
Merge PR #318 into 11.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jul 20, 2019
2 parents 4632166 + eff782d commit fd562c9
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 21 deletions.
1 change: 1 addition & 0 deletions business_requirement_deliverable/README.rst
Expand Up @@ -121,6 +121,7 @@ Authors
~~~~~~~

* Elico Corp
* Tecnativa

Contributors
~~~~~~~~~~~~
Expand Down
8 changes: 5 additions & 3 deletions business_requirement_deliverable/__manifest__.py
Expand Up @@ -8,9 +8,11 @@
'category': 'Business Requirements Management',
'summary': 'Manage the Business Requirement Deliverables \
for your customers',
'version': '11.0.1.2.0',
'website': 'https://www.elico-corp.com/',
"author": "Elico Corp, Odoo Community Association (OCA)",
'version': '11.0.1.3.0',
'website': 'https://github.com/OCA/business-requirement',
"author": "Elico Corp, "
"Tecnativa, "
"Odoo Community Association (OCA)",
'depends': [
'account',
'business_requirement',
Expand Down
Expand Up @@ -108,6 +108,14 @@
<field name="default_code">OD01</field>
</record>

<record id="business_requirement_deliverable_section_mandatory" model="business.requirement.deliverable.section">
<field name="name">Mandatory</field>
</record>

<record id="business_requirement_deliverable_section_optional" model="business.requirement.deliverable.section">
<field name="name">Optional</field>
</record>

<record id="business_requirement_deliverable_1"
model="business.requirement.deliverable">
<field name="business_requirement_id"
Expand All @@ -119,6 +127,8 @@
<field name="name">Website Design</field>
<field name="user_case">Need a Website</field>
<field name="proposed_solution">Responsive desing</field>
<field name="sequence" eval="1"/>
<field name="section_id" ref="business_requirement_deliverable_section_mandatory"/>
</record>
<record id="business_requirement_deliverable_2"
model="business.requirement.deliverable">
Expand All @@ -132,7 +142,8 @@
<field name="name">Odoo Quick Start Package</field>
<field name="user_case">Need a Website</field>
<field name="proposed_solution">Responsive desing</field>

<field name="sequence" eval="1"/>
<field name="section_id" ref="business_requirement_deliverable_section_mandatory"/>
</record>
<record id="business_requirement_deliverable_3"
model="business.requirement.deliverable">
Expand All @@ -146,6 +157,7 @@
<field name="proposed_solution">Responsive desing</field>
<field name="sale_price_unit">35.0</field>
<field name="uom_id" ref="product.product_uom_hour"/>
<field name="sequence" eval="1"/>
</record>
<record id="business_requirement_deliverable_4_1"
model="business.requirement.deliverable">
Expand All @@ -159,6 +171,8 @@
<field name="proposed_solution">Responsive desing</field>
<field name="uom_id" ref="product.product_uom_hour"/>
<field name="sale_price_unit">50.0</field>
<field name="sequence" eval="1"/>
<field name="section_id" ref="business_requirement_deliverable_section_mandatory"/>
</record>
<record id="business_requirement_deliverable_4_2"
model="business.requirement.deliverable">
Expand All @@ -172,6 +186,8 @@
<field name="proposed_solution">Responsive desing</field>
<field name="uom_id" ref="product.product_uom_hour"/>
<field name="sale_price_unit">45.0</field>
<field name="sequence" eval="2"/>
<field name="section_id" ref="business_requirement_deliverable_section_optional"/>
</record>
<record id="business_requirement_deliverable_5_1"
model="business.requirement.deliverable">
Expand All @@ -185,6 +201,8 @@
<field name="proposed_solution">Responsive desing</field>
<field name="uom_id" ref="product.product_uom_hour"/>
<field name="sale_price_unit">50.0</field>
<field name="sequence" eval="1"/>
<field name="section_id" ref="business_requirement_deliverable_section_mandatory"/>
</record>
<record id="business_requirement_deliverable_5_2"
model="business.requirement.deliverable">
Expand All @@ -198,6 +216,8 @@
<field name="proposed_solution">Responsive desing</field>
<field name="uom_id" ref="product.product_uom_hour"/>
<field name="sale_price_unit">35.0</field>
<field name="sequence" eval="2"/>
<field name="section_id" ref="business_requirement_deliverable_section_optional"/>
</record>

</data>
Expand Down
Expand Up @@ -453,6 +453,7 @@ <h2>Credits</h2>
<h3>Authors</h3>
<ul class="simple">
<li>Elico Corp</li>
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
Expand Down
31 changes: 31 additions & 0 deletions business_requirement_sale/README.rst
Expand Up @@ -33,6 +33,37 @@ create from them Sales Orders, taking deliverables as sales order lines.
.. contents::
:local:

Usage
=====

#. Go to *Business Requirement > Business Requirement*.
#. Open the business requirement you want to quote.
#. Click on "Create Quotation" button.
#. On the wizard popup, mark the sections you want to quote, and the
deliverables belonging to that section will be marked, or directly mark
individual ones.
#. There will be a special "Undefined section" checkbox at the end of the
"Sections" group for marking/unmarking deliverables without section.
#. Click on "Create" for generating the quotation.
#. You will be redirected to the newly created draft sales order (quotation).

You can navigate since this moment to all the created quotations:

#. Go to *Business Requirement > Business Requirement*.
#. Open the business requirement that has been quoted.
#. Look for the smart-button "Sales" on the upper-right part of the form.
#. Click on it for going to the quotation/sales order list.

Known issues / Roadmap
======================

* The widget many2many_checkboxes has a bug that avoids to refresh contents
when checkboxes are unmarked programatically, so when you remove some
sections on the sales order creation wizard, they won't be reflected in
screen.
* Include an event when checking/unchecking deliverable for updating sections
accordingly.

Bug Tracker
===========

Expand Down
2 changes: 1 addition & 1 deletion business_requirement_sale/__manifest__.py
Expand Up @@ -4,7 +4,7 @@
"name": "Business Requirement Sale",
'category': 'Business Requirements Management',
'summary': 'Convert Business Requirement into Sales Orders',
"version": "11.0.1.0.0",
"version": "11.0.1.1.0",
"website": "https://github.com/OCA/business-requirement",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
Expand Down
6 changes: 6 additions & 0 deletions business_requirement_sale/readme/ROADMAP.rst
@@ -0,0 +1,6 @@
* The widget many2many_checkboxes has a bug that avoids to refresh contents
when checkboxes are unmarked programatically, so when you remove some
sections on the sales order creation wizard, they won't be reflected in
screen.
* Include an event when checking/unchecking deliverable for updating sections
accordingly.
17 changes: 17 additions & 0 deletions business_requirement_sale/readme/USAGE.rst
@@ -0,0 +1,17 @@
#. Go to *Business Requirement > Business Requirement*.
#. Open the business requirement you want to quote.
#. Click on "Create Quotation" button.
#. On the wizard popup, mark the sections you want to quote, and the
deliverables belonging to that section will be marked, or directly mark
individual ones.
#. There will be a special "Undefined section" checkbox at the end of the
"Sections" group for marking/unmarking deliverables without section.
#. Click on "Create" for generating the quotation.
#. You will be redirected to the newly created draft sales order (quotation).

You can navigate since this moment to all the created quotations:

#. Go to *Business Requirement > Business Requirement*.
#. Open the business requirement that has been quoted.
#. Look for the smart-button "Sales" on the upper-right part of the form.
#. Click on it for going to the quotation/sales order list.
55 changes: 45 additions & 10 deletions business_requirement_sale/static/description/index.html
Expand Up @@ -373,33 +373,68 @@ <h1 class="title">Business Requirement Sale</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <em>Business Requirement &gt; Business Requirement</em>.</li>
<li>Open the business requirement you want to quote.</li>
<li>Click on “Create Quotation” button.</li>
<li>On the wizard popup, mark the sections you want to quote, and the
deliverables belonging to that section will be marked, or directly mark
individual ones.</li>
<li>There will be a special “Undefined section” checkbox at the end of the
“Sections” group for marking/unmarking deliverables without section.</li>
<li>Click on “Create” for generating the quotation.</li>
<li>You will be redirected to the newly created draft sales order (quotation).</li>
</ol>
<p>You can navigate since this moment to all the created quotations:</p>
<ol class="arabic simple">
<li>Go to <em>Business Requirement &gt; Business Requirement</em>.</li>
<li>Open the business requirement that has been quoted.</li>
<li>Look for the smart-button “Sales” on the upper-right part of the form.</li>
<li>Click on it for going to the quotation/sales order list.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>The widget many2many_checkboxes has a bug that avoids to refresh contents
when checkboxes are unmarked programatically, so when you remove some
sections on the sales order creation wizard, they won’t be reflected in
screen.</li>
<li>Include an event when checking/unchecking deliverable for updating sections
accordingly.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/business-requirement/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/business-requirement/issues/new?body=module:%20business_requirement_sale%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Alexandre Diaz</li>
Expand All @@ -410,7 +445,7 @@ <h2><a class="toc-backref" href="#id4">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
Expand Down
29 changes: 29 additions & 0 deletions business_requirement_sale/tests/test_business_requirement_sale.py
@@ -1,6 +1,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.tests import common
from odoo import exceptions


class TestBusinessRequirementSale(common.SavepointCase):
Expand Down Expand Up @@ -48,7 +49,24 @@ def setUpClass(cls):
active_id=cls.business_requirement.id,
).create({})

def test_no_deliverables_selected(self):
with self.assertRaises(exceptions.UserError):
self.wizard.button_create()

def test_full_flow(self):
self.assertEqual(
self.wizard.business_requirement_id, self.business_requirement,
)
self.assertTrue(self.wizard.has_undefined_section)
self.assertEqual(len(self.wizard.applicable_section_ids), 1)
self.assertFalse(self.wizard.deliverable_ids)
self.wizard.section_ids = self.wizard.applicable_section_ids
self.wizard._onchange_section_ids()
self.assertEqual(len(self.wizard.deliverable_ids), 1)
self.wizard.undefined_section = True
self.wizard._onchange_undefined_section()
self.assertEqual(len(self.wizard.deliverable_ids), 2)
self.assertTrue(self.wizard.has_undefined_section)
action = self.wizard.button_create()
# Sales order
self.assertTrue(action['res_id'])
Expand Down Expand Up @@ -101,3 +119,14 @@ def test_flow_one_line_non_totaled(self):
self.assertEqual(len(order.order_line), 1)
self.assertAlmostEqual(order.order_line.product_uom_qty, 3)
self.assertAlmostEqual(order.order_line.price_unit, 80)

def test_no_deliverables_in_br(self):
br = self.br_model.create({
'name': 'Test BR no deliverables',
'description': 'Test BR',
'partner_id': self.partner.id,
})
with self.assertRaises(exceptions.UserError):
self.env['business.requirement.create.sale'].with_context(
active_model=br._name, active_id=br.id,
).create({})

0 comments on commit fd562c9

Please sign in to comment.