-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] business_requirement_deliverable_sale: New module in 11.0
- Loading branch information
Victor Martin
committed
Jul 7, 2019
1 parent
1758525
commit 0c6c353
Showing
14 changed files
with
917 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
===================================== | ||
Business Requirement Deliverable Sale | ||
===================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |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/11.0/business_requirement_deliverable_sale | ||
: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-11-0/business-requirement-11-0-business_requirement_deliverable_sale | ||
: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/11.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module extends the functionality of Business Requirement Deliverable | ||
and to allow you to convert Requirement in new Sale Orders | ||
|
||
**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_deliverable_sale%0Aversion:%2011.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 | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Alexandre Diaz | ||
* Pedro M. Baeza | ||
* Victor M.M. Torres | ||
|
||
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. | ||
|
||
.. |maintainer-your-github-login| image:: https://github.com/your-github-login.png?size=40px | ||
:target: https://github.com/your-github-login | ||
:alt: your-github-login | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-your-github-login| | ||
|
||
This module is part of the `OCA/business-requirement <https://github.com/OCA/business-requirement/tree/11.0/business_requirement_deliverable_sale>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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,5 @@ | ||
# Copyright 2019 Tecnativa Victor M.M. Torres> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import wizard |
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,26 @@ | ||
# Copyright 2019 Tecnativa Victor M.M. Torres> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Business Requirement Deliverable Sale", | ||
'category': 'Business Requirements Management', | ||
'summary': 'Convert Business Requirement into \ | ||
Sale Orders', | ||
"version": "11.0.1.0.0", | ||
"development_status": "Alpha", | ||
"website": "https://github.com/OCA/business-requirement", | ||
"author": "Tecnativa, " | ||
"Odoo Community Association (OCA)", | ||
"maintainers": ["your-github-login"], | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"business_requirement_deliverable", | ||
"sale_management", | ||
], | ||
"data": [ | ||
'wizard/convert_requirement_sale.xml', | ||
'views/sale_order_views.xml', | ||
'views/business_requirement_views.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,5 @@ | ||
# Copyright 2019 Tecnativa Victor M.M. Torres> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import business | ||
from . import sale_order |
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,81 @@ | ||
# Copyright 2019 Tecnativa Victor M.M. Torres> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models, _ | ||
|
||
|
||
class BusinessRequirement(models.Model): | ||
_inherit = 'business.requirement' | ||
|
||
sale_order_ids = fields.One2many( | ||
comodel_name='sale.order', | ||
inverse_name='business_requirement_id', | ||
string='Orders', | ||
) | ||
order_count = fields.Integer( | ||
string='Count', | ||
compute='_compute_order_count', | ||
) | ||
detailed_order = fields.Boolean( | ||
help='Check this if need generated a detailed order' | ||
) | ||
|
||
@api.multi | ||
@api.depends('sale_order_ids') | ||
def _compute_order_count(self): | ||
for order in self: | ||
order.order_count = len(order.sale_order_ids) | ||
|
||
@api.multi | ||
def convert_requirement_sale(self): | ||
vals = { | ||
'br_id': self.id, | ||
'brd_ids': [(6, 0, self.deliverable_lines.ids)] | ||
} | ||
wizard_obj = self.env['convert.requirement.sale'] | ||
wizard = wizard_obj.create(vals) | ||
action = wizard.wizard_view() | ||
return action | ||
|
||
@api.multi | ||
def launch_convert_wizard(self): | ||
vals = { | ||
'br_id': self.id, | ||
'brd_ids': [(6, 0, self.deliverable_lines.ids)], | ||
} | ||
wizard_obj = self.env['convert.requirement.sale'] | ||
wizard = wizard_obj.create(vals) | ||
action = wizard.wizard_view() | ||
return action | ||
|
||
@api.multi | ||
def open_orders(self): | ||
for self in self: | ||
domain = [('business_requirement_id', '=', self.id)] | ||
br_id = 0 | ||
if self.state in ('draft', 'confirmed'): | ||
br_id = self.id | ||
return { | ||
'name': _('Sale Orders'), | ||
'type': 'ir.actions.act_window', | ||
'view_type': 'form', | ||
'view_mode': 'tree,form,graph', | ||
'res_model': 'sale.order', | ||
'target': 'current', | ||
'domain': domain, | ||
'context': { | ||
'tree_view_ref': 'sale_order.' + | ||
'view_sale_order_tree', | ||
'form_view_ref': 'sale_order.' + | ||
'view_sale_order_form', | ||
'default_sale_order_id': br_id | ||
}} | ||
|
||
|
||
class BusinessRequirementDeliverable(models.Model): | ||
_inherit = 'business.requirement.deliverable' | ||
|
||
sale_order_line_id = fields.Many2one( | ||
comodel_name='sale.order.line', | ||
string='Order Line', | ||
track_visibility='onchange',) |
25 changes: 25 additions & 0 deletions
25
business_requirement_deliverable_sale/models/sale_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,25 @@ | ||
# Copyright 2019 Tecnativa Victor M.M. Torres> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = 'sale.order' | ||
|
||
business_requirement_id = fields.Many2one( | ||
comodel_name='business.requirement', | ||
string='Business requirement', | ||
track_visibility='onchange', | ||
) | ||
|
||
class SaleOrderLine(models.Model): | ||
_inherit = 'sale.order.line' | ||
|
||
business_requirement_deliverable_section_id = fields.Many2one( | ||
comodel_name='business.requirement.deliverable.section', | ||
string='Section') | ||
|
||
business_requirement_deliverable_id = fields.Many2one( | ||
comodel_name='business.requirement.deliverable', | ||
string='Deliverable') |
5 changes: 5 additions & 0 deletions
5
business_requirement_deliverable_sale/readme/CONTRIBUTORS.rst
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,5 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Alexandre Diaz | ||
* Pedro M. Baeza | ||
* Victor M.M. Torres |
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,2 @@ | ||
This module extends the functionality of Business Requirement Deliverable | ||
and to allow you to convert Requirement in new Sale Orders |
Oops, something went wrong.