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

[ADD][br_deliverable] move the estimation pricelist from the project to the customer #117

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions business_requirement_deliverable/README.rst
Expand Up @@ -16,6 +16,8 @@ Two new concepts complement the main business requirements model:
* Deliverable lines
* Resource lines

Customer model is completed with a new field for pricelist estimation

What is a Deliverable Line?
---------------------------

Expand Down
3 changes: 2 additions & 1 deletion business_requirement_deliverable/__openerp__.py
Expand Up @@ -6,7 +6,7 @@
'category': 'Business Requirements Management',
'summary': 'Manage the Business Requirement Deliverables and \
Resources for your customers',
'version': '8.0.4.0.0',
'version': '8.0.4.0.1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should bump to 8.0.5.0.0 because this modules implies a manual migration of the data

'website': 'https://www.elico-corp.com/',
"author": "Elico Corp, Odoo Community Association (OCA)",
'depends': [
Expand All @@ -17,6 +17,7 @@
'security/business_requirement_deliverable_security.xml',
'security/ir.model.access.csv',
'views/business_view.xml',
'views/res_partner.xml',
'report/br_deliverable_report_view.xml',
'report/br_deliverable_sale_report_view.xml',
],
Expand Down
2 changes: 2 additions & 0 deletions business_requirement_deliverable/models/__init__.py
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import business
from . import res_partner
17 changes: 17 additions & 0 deletions business_requirement_deliverable/models/res_partner.py
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models


class ResPartner(models.Model):
_inherit = 'res.partner'

pricelist_id = fields.Many2one(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this be a property (like customer pricelists)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/pricelist_id/estimation_pricelist_id

Copy link
Collaborator

@seb-elico seb-elico Apr 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victormartinelicocorp I remember you told me the Sales Pricelist was a computed field. Reason is: when the partner is a contact of a company, his Sales Pricelist is the one from his company. As discussed, we should replicate this behavior.

EDIT: after checking with @elicoidal, we are looking for a slightly different behavior for the estimation pricelist. For the contacts, the sales pricelist is "inherited": it comes from their parent res_partner (e.g. their company). For the estimation pricelist, we don't need to implement this "heritage". But, in multi-company context, we need to be able to define different estimation pricelists for a customer when we work on different companies, this is what @elicoidal means by property (it's a "dynamic" field that can have different value based on the current company).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victormartinelicocorp To be discussed

string='Estimation Pricelist',
comodel_name='product.pricelist',
domain=[('type', '=', 'sale')],
help='''Pricelist used for the estimation of the Business Requirements
Deliverables linked to this project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "Linked to this project"

Currency of the Deliverables will be the one from this pricelist.'''
)
18 changes: 18 additions & 0 deletions business_requirement_deliverable/views/res_partner.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<openerp>
<data>

<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.product.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="product.view_partner_property_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_product_pricelist']" position="after">
<field name="pricelist_id" groups="product.group_sale_pricelist"/>
</xpath>
</field>
</record>

</data>
</openerp>