Skip to content

Commit

Permalink
[IMP]Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
YogeshMahera-SerpentCS committed Sep 11, 2017
1 parent 668370d commit 31c6b94
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 33 deletions.
6 changes: 3 additions & 3 deletions business_requirement_deliverable/README.rst
Expand Up @@ -9,7 +9,7 @@ Business Requirement Deliverable
Introduction
============

This module is part of a set of modules (`Business Requirements <https://github.com/OCA/business-requirement/blob/8.0/README.md>`_)
This module is part of a set of modules (`Business Requirements <https://github.com/OCA/business-requirement/blob/10.0/README.md>`_)

Two new concepts complement the main business requirements model:

Expand Down Expand Up @@ -147,7 +147,7 @@ Usage

.. figure:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/222/8.0
:target: https://runbot.odoo-community.org/runbot/222/10.0

Bug Tracker
===========
Expand All @@ -158,7 +158,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Known issues / Roadmap
======================
* As of version 8.0.5.0.0, the estimation pricelist has been moved from Project to
* As of version 10.0.1.0.0, the estimation pricelist has been moved from Project to
Partner object. There is no migration script for the change and the data will
have to be migrated manually.
Credits
Expand Down
2 changes: 1 addition & 1 deletion business_requirement_deliverable/__init__.py
@@ -1,5 +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 models
from . import report
Expand Down
16 changes: 12 additions & 4 deletions business_requirement_deliverable/__manifest__.py
@@ -1,12 +1,12 @@
# -*- 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).
{
'name': 'Business Requirement Deliverable',
'category': 'Business Requirements Management',
'summary': 'Manage the Business Requirement Deliverables and \
Resources for your customers',
'version': '8.0.5.0.1',
'version': '10.0.1.0.0',
'website': 'https://www.elico-corp.com/',
"author": "Elico Corp, Odoo Community Association (OCA)",
'depends': [
Expand All @@ -16,18 +16,26 @@
'data': [
'security/business_requirement_deliverable_security.xml',
'security/ir.model.access.csv',
'data/br_report_paperformat.xml',
'views/business_view.xml',
'views/res_partner.xml',
'views/report_business_requirement_deliverable.xml',
'views/report_business_requirement_deliverable_resource.xml',
'report/br_deliverable_report_view.xml',
'report/br_deliverable_sale_report_view.xml',
'report/report.xml',
],
'image': [
'static/description/icon.png',
'static/img/bus_req_deliverable.png',
'static/img/bus_req_deliverable2.png',
'static/img/bus_req_resource.png'
'static/img/bus_req_resource.png',
'static/img/bus_req_report1.png',
'static/img/bus_req_report2.png',
'static/img/bus_req_report3.png',

],
'demo': ['data/business_requirement_deliverable_demo.xml'],
'license': 'AGPL-3',
'installable': False,
'installable': True,
}
30 changes: 17 additions & 13 deletions business_requirement_deliverable/models/business.py
@@ -1,10 +1,9 @@
# -*- 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 openerp import api, fields, models
from openerp.exceptions import Warning as UserError
from openerp.exceptions import ValidationError
from openerp.tools.translate import _
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.addons import decimal_precision as dp


class BusinessRequirementResource(models.Model):
Expand Down Expand Up @@ -71,13 +70,13 @@ class BusinessRequirementResource(models.Model):
business_requirement_partner_id = fields.Many2one(
comodel_name='res.partner',
related='business_requirement_id.partner_id',
string='Business Requirement',
string='Stakeholder',
store=True
)
business_requirement_project_id = fields.Many2one(
comodel_name='project.project',
related='business_requirement_id.project_id',
string='Business Requirement',
string='Project',
store=True
)
state = fields.Selection(related='business_requirement_id.state',
Expand Down Expand Up @@ -129,6 +128,7 @@ class BusinessRequirementDeliverable(models.Model):
_name = "business.requirement.deliverable"
_description = "Business Requirement Deliverable"

yogesh = fields.Integer('Yogesh')
sequence = fields.Integer('Sequence')
state = fields.Selection(
related='business_requirement_id.state',
Expand Down Expand Up @@ -180,7 +180,8 @@ class BusinessRequirementDeliverable(models.Model):
price_total = fields.Float(
compute='_compute_get_price_total',
string='Total revenue',
store=True
store=True,
readonly=True
)
currency_id = fields.Many2one(
comodel_name='res.currency',
Expand All @@ -191,13 +192,13 @@ class BusinessRequirementDeliverable(models.Model):
business_requirement_partner_id = fields.Many2one(
comodel_name='res.partner',
related='business_requirement_id.partner_id',
string='Business Requirement',
string='Stakeholder',
store=True
)
business_requirement_project_id = fields.Many2one(
comodel_name='project.project',
related='business_requirement_id.project_id',
string='Business Requirement',
string='Project',
store=True
)
state = fields.Selection(related='business_requirement_id.state',
Expand Down Expand Up @@ -280,7 +281,7 @@ def product_uom_change(self):
product_uom = self.env['product.uom']

if self.qty != 0:
product_uom._compute_qty(
product_uom._compute_quantity(
self.uom_id.id, self.qty, self.product_id.uom_id.id) / self.qty

if pricelist:
Expand Down Expand Up @@ -328,8 +329,11 @@ class BusinessRequirement(models.Model):
readonly=True,
compute='_compute_get_currency'
)
dl_total_revenue = fields.Float('DL Total Revenue',
compute='_compute_dl_total_revenue')
dl_total_revenue = fields.Float(
string='DL Total Revenue',
digit=dp.get_precision('Account'),
compute='_compute_dl_total_revenue'
)
dl_count = fields.Integer('DL Count', compute='_compute_dl_count')
rl_count = fields.Integer('RL Count', compute='_compute_rl_count')

Expand Down
23 changes: 11 additions & 12 deletions business_requirement_deliverable/views/business_view.xml
Expand Up @@ -138,7 +138,6 @@
<field name="arch" type="xml">
<tree string="Business Requirement Deliverable" default_order="sequence">
<field name="business_requirement_id"/>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="product_id"/>
<field name="uom_id"/>
Expand Down Expand Up @@ -274,24 +273,24 @@
<field name="name">Business requirement Deliverable</field>
<field name="model">business.requirement.deliverable</field>
<field name="arch" type="xml">
<pivot string="Business Requirement">
<pivot string="Business Requirement" display_quantity="true" disable_linking="True">
</pivot>
</field>
</record>

<!--&lt;!&ndash; Graph view Requirement Deliverable Line&ndash;&gt;-->
<!--<record id="view_business_requirement_deliverable_graph" model="ir.ui.view">-->
<!--<field name="name">business.requirement.deliverable.graph</field>-->
<!--<field name="model">business.requirement.deliverable</field>-->
<!--<field name="arch" type="xml">-->
<!--<graph string="Requirement Deliverable" stacked="True">-->
<!--<field name="business_requirement_id" type="row"/>-->
<!--<field name="product_id" type="col"/>-->
<record id="view_business_requirement_deliverable_graph" model="ir.ui.view">
<field name="name">business.requirement.deliverable.graph</field>
<field name="model">business.requirement.deliverable</field>
<field name="arch" type="xml">
<graph string="Requirement Deliverable" stacked="True">
<field name="business_requirement_id"/>
<field name="product_id"/>
<!--<field name="qty" type="measure"/>-->
<!--<field name="sale_price_unit" type="measure"/>-->
<!--</graph>-->
<!--</field>-->
<!--</record>-->
</graph>
</field>
</record>

<!-- Action Requirement Deliverable Line-->
<record model="ir.actions.act_window" id="action_deliverable_lines">
Expand Down

0 comments on commit 31c6b94

Please sign in to comment.