Skip to content

Commit

Permalink
Merge pull request #315 from Tecnativa/12.0-mig-business-requirement
Browse files Browse the repository at this point in the history
[MIG] business_requirement: Migration to v12
  • Loading branch information
pedrobaeza committed Jul 23, 2019
2 parents 0894252 + a525304 commit 2098463
Show file tree
Hide file tree
Showing 43 changed files with 6,518 additions and 0 deletions.
125 changes: 125 additions & 0 deletions business_requirement/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
====================
Business Requirement
====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbusiness--requirement-lightgray.png?logo=github
:target: https://github.com/OCA/business-requirement/tree/12.0/business_requirement
:alt: OCA/business-requirement
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/business-requirement-12-0/business-requirement-12-0-business_requirement
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/222/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

A **Business requirement** (BR) is the expression of a business need by a customer
or internal project user.

A BR contains multiple different parts to explain the stakeholder need and how to
meet his/her requirements:

* **Customer Story**: this is the requirement as expressed by the customer
* **Scenario**: How/where the current solution can provide a suitable scenario to
answer the customer story
* **Gap**: For the uncovered part of the scenario, elaborate the gap/need for specific
developments/setup
* **Test case**: A set of conditions under which a tester will determine whether the application, software system or
one of its features is working as it was originally established for it to do.
* **Deliverables** to be provided to the customer/user
* **Resources** necessary to achieve the deliverables
* **Additional** information (approval, cost control etc.)

This set of modules was originally designed for the service/IT industry but the
requirement management design has been kept as generic as possible so that it can
apply to many other cases/industries (customer or internal projects):

* Construction
* Trading (New product development)
* Business Consultancy
* Web or IT development
* R&D projects
* etc.

More information about business requirements management:

* `Wikipedia <https://en.wikipedia.org/wiki/Business_requirements>`_
* `Six Sigma <https://www.isixsigma.com/implementation/project-selection-tracking/business-requirements-document-high-level-review/>`_

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/business-requirement/issues>`_.
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
`feedback <https://github.com/OCA/business-requirement/issues/new?body=module:%20business_requirement%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Elico Corp
* Tecnativa

Contributors
~~~~~~~~~~~~

* Eric Caudal <eric.caudal@elico-corp.com>
* Alex Duan <alex.duan@elico-corp.com>
* Xie XiaoPeng <xie.xiaopeng@elico-corp.com>
* Victor M. Martin <victor.martin@elico-corp.com>
* Evan Li <li.aiwen@elico-corp.com>
* Reinhard Sheng <reinhard.sheng@elico-corp.com>

* `Tecnativa <https://www.tecnativa.com>`_:

* Alexandre Diaz
* Pedro M. Baeza
* Victor M.M. Torres

Other credits
~~~~~~~~~~~~~


* Images:

* `briefcase <https://fontawesome.com/icons/briefcase?style=solid>`__ from `FontAwesome <https://fontawesome.com/license>`__.
* `drafting-compass <https://fontawesome.com/icons/drafting-compass?style=solid>`__ from `FontAwesome <https://fontawesome.com/license>`__.

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/business-requirement <https://github.com/OCA/business-requirement/tree/12.0/business_requirement>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions business_requirement/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2017-2019 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from . import tests
from . import controllers
45 changes: 45 additions & 0 deletions business_requirement/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2017-2019 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Business Requirement",
"category": "Business Requirements Management",
"summary": "Manage the Business Requirements (stories, scenarios, gaps\
and test cases) for your customers",
"version": "12.0.1.0.0",
"website": "https://github.com/OCA/business-requirement",
"author": "Elico Corp, "
"Tecnativa, "
"Odoo Community Association (OCA)",
"depends": [
"product",
"portal",
],
"data": [
"data/business_data.xml",
"security/security.xml",
"security/ir.model.access.csv",
"views/business_view.xml",
"views/br_report.xml",
"views/br_portal_templates.xml",
"report/report.xml"
],
"image": [
"static/description/icon.png",
"static/img/bus_req.png",
"static/img/bus_req_alias.png",
"static/img/bus_req_approved.png",
"static/img/bus_req_cancel.png",
"static/img/bus_req_confirmed.png",
"static/img/bus_req_cust_story.png",
"static/img/bus_req_done.png",
"static/img/bus_req_drop.png",
"static/img/bus_req_tags.png",
"static/img/bus_req_tags2.png",
"static/img/bus_req_tree.png",
"static/img/bus_req_workflow.png"
],
"demo": ["data/business_requirement_demo.xml"],
"license": "AGPL-3",
"installable": True,
"application": True,
}
1 change: 1 addition & 0 deletions business_requirement/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import portal
149 changes: 149 additions & 0 deletions business_requirement/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright 2019 Tecnativa - Alexandre Díaz
from odoo import http, _
from odoo.exceptions import AccessError
from odoo.http import request
from odoo.tools import consteq
from odoo.addons.portal.controllers.portal import (
CustomerPortal,
pager as portal_pager, get_records_pager)


class CustomerPortal(CustomerPortal):

def _prepare_portal_layout_values(self):
values = super()._prepare_portal_layout_values()
br_count = request.env['business.requirement'].search_count(
self._prepare_br_base_domain())
values.update({
'business_requirement_count': br_count,
})
return values

def _prepare_br_base_domain(self):
partner = request.env.user.partner_id
return [
('message_partner_ids', 'child_of', [
partner.commercial_partner_id.id]),
('portal_published', '=', True)
]

def _br_check_access(self, br_id, access_token=None):
br = request.env['business.requirement'].browse([br_id])
br_sudo = br.sudo()
try:
br.check_access_rights('read')
br.check_access_rule('read')
except AccessError:
if not access_token or not consteq(br_sudo.access_token,
access_token):
raise
return br_sudo

def _br_get_page_view_values(self, br, access_token, **kwargs):
values = {
'business_requirement': br,
'page_name': 'business_requirement',
}
if access_token:
values['no_breadcrumbs'] = True
values['access_token'] = access_token
values['portal_confirmation'] = br.get_portal_confirmation_action()

if kwargs.get('error'):
values['error'] = kwargs['error']
if kwargs.get('warning'):
values['warning'] = kwargs['warning']
if kwargs.get('success'):
values['success'] = kwargs['success']

history = request.session.get('my_br_history', [])
values.update(get_records_pager(history, br))

return values

@http.route(['/my/business_requirements',
'/my/business_requirements/page/<int:page>'],
type='http', auth="user", website=True)
def portal_my_br(self, page=1, date_begin=None, date_end=None,
sortby=None, **kw):
values = self._prepare_portal_layout_values()
BRObj = request.env['business.requirement']

searchbar_sortings = {
'date': {'label': _('Date'), 'order': 'date desc'},
'sequence': {'label': _('Sequence'), 'order': 'sequence'},
}
# default sortby br
if not sortby:
sortby = 'sequence'
sort_br = searchbar_sortings[sortby]['order']

domain = self._prepare_br_base_domain()

archive_groups = self._get_archive_groups('business.requirement',
domain)
if date_begin and date_end:
domain += [('date', '>', date_begin),
('date', '<=', date_end)]

# count for pager
br_count = BRObj.search_count(domain)
# pager
pager = portal_pager(
url="/my/business_requirements",
url_args={'date_begin': date_begin,
'date_end': date_end,
'sortby': sortby},
total=br_count,
page=page,
step=self._items_per_page
)
# content according to pager and archive selected
business_requirements = BRObj.search(domain, order=sort_br,
limit=self._items_per_page,
offset=pager['offset'])
request.session['my_br_history'] = business_requirements.ids[:100]

values.update({
'date': date_begin,
'business_requirements': business_requirements.sudo(),
'page_name': 'business_requirement',
'pager': pager,
'archive_groups': archive_groups,
'default_url': '/my/business_requirements',
'searchbar_sortings': searchbar_sortings,
'sortby': sortby,
})
return request.render("business_requirement.portal_my_br", values)

@http.route(['/my/business_requirement/<int:br_id>'],
type='http', auth="public", website=True)
def portal_br_page(self, br_id=None, access_token=None, **kw):
try:
br_sudo = self._br_check_access(br_id, access_token=access_token)
except AccessError:
return request.redirect('/my')

values = self._br_get_page_view_values(br_sudo, access_token, **kw)
return request.render("business_requirement.portal_br_page", values)

def _get_br_report_name(self):
return ('business_requirement.'
'business_requirement_report')

@http.route(['/my/business_requirement/pdf/<int:br_id>'],
type='http', auth="public", website=True)
def portal_br_report(self, br_id, access_token=None, **kw):
try:
br_sudo = self._br_check_access(br_id, access_token)
except AccessError:
return request.redirect('/my')

# print report as sudo
pdf = request.env.ref(self._get_br_report_name())\
.sudo().render_qweb_pdf([br_sudo.id])[0]
pdfhttpheaders = [
('Content-Type', 'application/pdf'),
('Content-Length', len(pdf)),
]
return request.make_response(pdf, headers=pdfhttpheaders)
20 changes: 20 additions & 0 deletions business_requirement/data/business_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">

<record id="seq_business_requirement" model="ir.sequence">
<field name="name">Business Requirement</field>
<field name="code">business.requirement</field>
<field name="prefix">BR</field>
<field name="padding">6</field>
<field name="company_id" eval="False"/>
</record>

<record model="ir.module.category" id="module_category_business_requirement">
<field name="name">Business Requirement</field>
<field name="description"></field>
<field name="sequence">9</field>
</record>

</data>
</odoo>
Loading

0 comments on commit 2098463

Please sign in to comment.