Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0] [MIG] business requirement: Migration to 18.0 #390

Open
wants to merge 3 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions business_requirement/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
====================
Business Requirement
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:97aa0457b2ff0235d83c4f652d2d23fbd40249bf377e27f8d6dce197e0725f19
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/16.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-16-0/business-requirement-16-0-business_requirement
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/business-requirement&target_branch=16.0
:alt: Try me on Runboat

|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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/business-requirement/issues/new?body=module:%20business_requirement%0Aversion:%2016.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 <[email protected]>
- Alex Duan <[email protected]>
- Xie XiaoPeng <[email protected]>
- Victor M. Martin <[email protected]>
- Evan Li <[email protected]>
- Reinhard Sheng <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Alexandre Diaz
- Pedro M. Baeza
- Victor M.M. Torres
- Víctor Martínez

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/16.0/business_requirement>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions business_requirement/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 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 controllers
46 changes: 46 additions & 0 deletions business_requirement/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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": "18.0.1.0.0",
"website": "https://github.com/OCA/business-requirement",
"author": "Apulia Software, 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",
],
"assets": {
"web.assets_tests": [
"/business_requirement/static/src/js/business_requirement_portal_tour.js",
],
},
"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
155 changes: 155 additions & 0 deletions business_requirement/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Copyright 2019 Tecnativa - Alexandre Díaz
# Copyright 2022 Tecnativa - Víctor Martínez
from odoo import _, http
from odoo.exceptions import AccessError
from odoo.http import request

from odoo.addons.portal.controllers.portal import (
CustomerPortal,
get_records_pager,
)
from odoo.addons.portal.controllers.portal import (
pager as portal_pager,
)


class CustomerPortal(CustomerPortal):
def _prepare_home_portal_values(self, counters):
values = super()._prepare_home_portal_values(counters)
if "business_requirement_count" in counters:
br_model = request.env["business.requirement"]
br_count = (
br_model.search_count(self._prepare_br_base_domain())
if br_model.check_access("read")
else 0
)
values["business_requirement_count"] = br_count
return values

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

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"]
# Avoid error if the user does not have access.
if not BRObj.check_access("read"):
return request.redirect("/my")

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()

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,
"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._document_check_access(
"business.requirement", 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._document_check_access(
"business.requirement", br_id, access_token=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)
15 changes: 15 additions & 0 deletions business_requirement/data/business_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo 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 name="sequence">9</field>
</record>
</odoo>
Loading
Loading