Merge lp:~openerp-dev/openobject-addons/7.0-extra-report-company into lp:openobject-addons/7.0

Proposed by Olivier Dony (Odoo)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-extra-report-company
Merge into: lp:openobject-addons/7.0
Diff against target: 852 lines (+730/-1)
21 files modified
account_report_company/__openerp__.py (+1/-1)
analytic_report_company/__init__.py (+24/-0)
analytic_report_company/__openerp__.py (+49/-0)
analytic_report_company/analytic_report_company.py (+30/-0)
analytic_report_company/analytic_view.xml (+35/-0)
crm_report_company/__init__.py (+24/-0)
crm_report_company/__openerp__.py (+49/-0)
crm_report_company/crm_report_company.py (+30/-0)
crm_report_company/crm_view.xml (+46/-0)
purchase_report_company/__init__.py (+24/-0)
purchase_report_company/__openerp__.py (+49/-0)
purchase_report_company/purchase_report_company.py (+30/-0)
purchase_report_company/purchase_view.xml (+34/-0)
sale_report_company/__init__.py (+24/-0)
sale_report_company/__openerp__.py (+49/-0)
sale_report_company/sale_report_company.py (+30/-0)
sale_report_company/sale_view.xml (+33/-0)
stock_report_company/__init__.py (+24/-0)
stock_report_company/__openerp__.py (+50/-0)
stock_report_company/stock_report_company.py (+49/-0)
stock_report_company/stock_view.xml (+46/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-extra-report-company
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp (community) code review, test Needs Fixing
Raphaël Valyi - http://www.akretion.com (community) Needs Fixing
Alexis de Lattre (community) Approve
OpenERP Core Team Pending
Review via email: mp+203732@code.launchpad.net

Description of the change

Adds compatibility modules for storing denormalized 'commercial_partner_id' fields in the following objects:
 - Contracts (account.analytic.account) -> module analytic_report_company
 - Sales Orders (sale.order) -> module sale_report_company
 - Purchase Orders (purchase.order) -> module purchase_report_company
 - Stock Pickings (stock.picking) -> module stock_report_company
 - Leads/Opportunities (crm.lead) -> module crm_report_company

To post a comment you must log in.
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I have deployed in production sale_report_company and purchase_report_company and they work well. Code is fine.

review: Approve
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Olivier,

Finally I discover that one ! We already did some custo to have in production. Our project was about to take off and we needed them. I though you had forgotten :)

This is a must have for reporting in v7.0 and I'm glad to see it here. It is really necessary for medium and large company size.

It LGTM, thanks for the work.

Regards,

Joël

review: Approve (code review + test)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :
Download full text (3.5 KiB)

Hello Olivier,

a few remark about your MP. You already know my position about the semantic shift contact_id, partner_id to partner_id, commercial_entity_id and I already know OpenERP SA wants to keep this shift from now on. So please keep in mind I'm NOT talking about this as we may adapt to the shift once the addons codebase is adapted to it in a credible way (not too far finally even if there are still a few open regressions about this).

So my point in your MP is:

1) I think a crm.claim object also deserves such a commercial_entity_id.
Until 6.1, you could filter claims by commercial entity. I think there is no reason you couldn't not do it anymore in v7. Adding the field in crm.claim you would be on par with what I did in the RS-OCB branch (except I preserved the partner_id semantic).

2) I think this is not good to put the commercial_entity_id at save time. I think that in many situations you want to have the commercial entity BEFORE saving a new record to allow you filtering other fields of the form.
For example you create a new incoming picking and you want to relate it to a claim (RMA situation). Before your picking is save, you may want to select the claim related to the proper commercial entity. Doing that if commercial entity is set at save time is really cumbersome.

3) Instead I suggest to set commercial_entity_id when the contact (partner_d in your case) is changed in the form. This is what I do in the RS-OCB tracking branch for instance here:
https://github.com/akretion/openerp-server/blob/rs-ocb-7.0/openerp/addons/base/res/res_partner.py#L209
You could very well do it in a simpler way when you ca refactor the addons (talking about v8 which is what matters anyway). My point is that instead of doing it an arbitrary way, if you use some on_change (you should), then you should implement the on_change in a mixin. This way we know deterministically that all documents including this mixin support both a contact field (called partner_d in your case) and a commercial_entity_id and support it consistently.

This is like Java programs would implement a HasContact "interface" or Ruby programs a HasContact "module". This is the idea of "design by contract" http://en.wikipedia.org/wiki/Design_by_contract
Something that I think is required when you build an ERP and that is currently missing too much in the OpenERP culture, leading to brittle code breaking from customization to customization and from version to version. At the end of the road this lack of architecture largely explains why OpenERP market has its growth limited by its slow learning curve, both for us partners and for you OpenERP SA.

4) In the same idea of consistence, I think that in v8, these fields should NOT come from such arbitrary patchy extra modules but these fields should be present natively.
The risk with these fixes in modules is that 3rd party modules won't deal with them consistently and this is really hard to build a sustainable eco-system this way. For instance, in current v8 you would present that BI module filter tour sale orders or purchase orders by customer or supplier. But this is not, this is by contact. Some module will not notice the issue and will be...

Read more...

review: Needs Fixing
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

I'm also in favor of including the crm.claim in those modules please. Didn't though about that when posting my review, but I'gonna need it as well. It's not that painful to add it here in the meanwhile.

For the rest of Raphaël's comments, I don't want to enter too deep in that debate ! I must admit having it on an on_change would be great for v8, but I also agree with you that for v7 it's not possible regarding your policies (or at a high cost).

Thanks in advance for adding crm-claim in there.

Joël

review: Needs Fixing (code review, test)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Yes, I also just ask for on_change in v8, as for v7 I don't care; I use RS-OCB and is works well and if it just to add fields like that, I'm sure people can do it too on their own.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

By the way, I upgraded to the latest server/web/addons and made an "-u all" on an installation that has the module sale_report_company, and it fails :

2014-03-27 21:13:14,365 914 INFO prod_erp openerp.modules.module: module sale_report_company: creating or updating database tables
2014-03-27 21:13:14,443 914 ERROR prod_erp openerp.sql_db: bad query: ALTER TABLE "sale_order" ADD FOREIGN KEY ("commercial_partner_id") REFERENCES "res_partner" ON DELETE set null
Traceback (most recent call last):
  File "/home/erp_super/erp/prod/src/server/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
IntegrityError: insert or update on table "sale_order" violates foreign key constraint "sale_order_commercial_partner_id_fkey"
DETAIL: Key (commercial_partner_id)=(506) is not present in table "res_partner".

Unmerged revisions

9397. By Olivier Dony (Odoo)

[ADD] New compatibility modules for adding the denormalized commercial_partner_id dimension on main documents

      - `analytic_report_company` for analytic accounts, contracts and projects
      - `crm_report_company` for leads and opportunities
      - `purchase_report_company` for quotations and purchase orders
      - `sale_report_company` for quotations and sales orders
      - `stock_report_company` for delivery orders dans incoming shipments

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_report_company/__openerp__.py'
--- account_report_company/__openerp__.py 2013-04-19 17:18:53 +0000
+++ account_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -19,7 +19,7 @@
19#19#
20##############################################################################20##############################################################################
21{21{
22 'name': 'Invoice Analysis per Company',22 'name': 'Invoice Consolidation per Partner Company',
23 'version': '1.0',23 'version': '1.0',
24 'category': 'Accounting & Finance',24 'category': 'Accounting & Finance',
25 'description': """25 'description': """
2626
=== added directory 'analytic_report_company'
=== added file 'analytic_report_company/__init__.py'
--- analytic_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ analytic_report_company/__init__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import analytic_report_company
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'analytic_report_company/__openerp__.py'
--- analytic_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ analytic_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Contracts Consolidation per Partner Company',
23 'version': '1.0',
24 'category': 'Hidden/Dependency',
25 'description': """
26Add an extra Partner Company dimension on Contracts lists
27=========================================================
28
29By default Contracts can be associated with any given Partner
30or any Partner Contact. When using contacts, the company these
31contacts belong to is not directly available as a grouping
32dimension in Contracts lists.
33This modules adds an extra "group by" dimension labelled "Partner Company".
34
35For B2C cases where the Partner is a natural person, the Partner Company
36value will be that person herself.
37
38Note: this module will likely be removed in OpenERP 8.0, and may be
39directly integrated in the core Contracts Management module.
40""",
41 'author': 'OpenERP SA',
42 'website': 'http://www.openerp.com',
43 'depends': ['account_analytic_analysis'],
44 'data': [
45 'analytic_view.xml',
46 ],
47}
48
49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
050
=== added file 'analytic_report_company/analytic_report_company.py'
--- analytic_report_company/analytic_report_company.py 1970-01-01 00:00:00 +0000
+++ analytic_report_company/analytic_report_company.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,30 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24class contract(osv.Model):
25 _inherit = 'account.analytic.account'
26 _columns = {
27 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one',
28 relation='res.partner', store=True, readonly=True,
29 help="The commercial entity the partner belongs to, sometimes useful for reporting")
30 }
031
=== added file 'analytic_report_company/analytic_view.xml'
--- analytic_report_company/analytic_view.xml 1970-01-01 00:00:00 +0000
+++ analytic_report_company/analytic_view.xml 2014-01-29 13:26:54 +0000
@@ -0,0 +1,35 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="view_account_analytic_account_list">
5 <field name="model">account.analytic.account</field>
6 <field name="inherit_id" ref="account.view_account_analytic_account_list"/>
7 <field name="arch" type="xml">
8 <field name="partner_id" position="after">
9 <field name="commercial_partner_id" invisible="1"/>
10 </field>
11 </field>
12 </record>
13
14 <record model="ir.ui.view" id="view_account_analytic_account_overdue_search">
15 <field name="model">account.analytic.account</field>
16 <field name="inherit_id" ref="account_analytic_analysis.view_account_analytic_account_overdue_search"/>
17 <field name="arch" type="xml">
18 <filter string="Partner" position="after">
19 <filter name="commercial_partner_id" string="Partner Company"
20 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
21 </filter>
22 </field>
23 </record>
24 <record model="ir.ui.view" id="view_account_analytic_account_search">
25 <field name="model">account.analytic.account</field>
26 <field name="inherit_id" ref="account.view_account_analytic_account_search"/>
27 <field name="arch" type="xml">
28 <filter string="Associated Partner" position="after">
29 <filter name="commercial_partner_id" string="Partner Company"
30 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
31 </filter>
32 </field>
33 </record>
34 </data>
35</openerp>
0\ No newline at end of file36\ No newline at end of file
137
=== added directory 'crm_report_company'
=== added file 'crm_report_company/__init__.py'
--- crm_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ crm_report_company/__init__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import crm_report_company
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'crm_report_company/__openerp__.py'
--- crm_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ crm_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'CRM Consolidation per Partner Company',
23 'version': '1.0',
24 'category': 'Hidden/Dependency',
25 'description': """
26Add an extra Partner Company dimension on Leads/Opportunities lists
27===================================================================
28
29By default Leads and Opportunities can be associated with any given Partner
30or any Partner Contact. When using contacts, the company these contacts
31belong to is not directly available as a grouping dimension in Leads
32and Opportunities lists.
33This modules adds an extra "group by" dimension labelled "Partner Company".
34
35For B2C cases where the Partner is a natural person, the Partner Company
36value will be that person herself.
37
38Note: this module will likely be removed in OpenERP 8.0, and may be
39directly integrated in the core CRM module.
40""",
41 'author': 'OpenERP SA',
42 'website': 'http://www.openerp.com',
43 'depends': ['crm'],
44 'data': [
45 'crm_view.xml',
46 ],
47}
48
49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
050
=== added file 'crm_report_company/crm_report_company.py'
--- crm_report_company/crm_report_company.py 1970-01-01 00:00:00 +0000
+++ crm_report_company/crm_report_company.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,30 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24class crm_lead(osv.Model):
25 _inherit = 'crm.lead'
26 _columns = {
27 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one',
28 relation='res.partner', store=True, readonly=True,
29 help="The commercial entity the partner belongs to, sometimes useful for reporting")
30 }
031
=== added file 'crm_report_company/crm_view.xml'
--- crm_report_company/crm_view.xml 1970-01-01 00:00:00 +0000
+++ crm_report_company/crm_view.xml 2014-01-29 13:26:54 +0000
@@ -0,0 +1,46 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <!-- LEADS -->
5 <record model="ir.ui.view" id="crm_case_tree_view_leads">
6 <field name="model">crm.lead</field>
7 <field name="inherit_id" ref="crm.crm_case_tree_view_leads"/>
8 <field name="arch" type="xml">
9 <field name="partner_id" position="after">
10 <field name="commercial_partner_id" invisible="1"/>
11 </field>
12 </field>
13 </record>
14 <record model="ir.ui.view" id="view_crm_case_leads_filter">
15 <field name="model">crm.lead</field>
16 <field name="inherit_id" ref="crm.view_crm_case_leads_filter"/>
17 <field name="arch" type="xml">
18 <filter string="Customer" position="after">
19 <filter name="commercial_partner_id" string="Partner Company"
20 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
21 </filter>
22 </field>
23 </record>
24
25 <!-- OPPORTUNITIES -->
26 <record model="ir.ui.view" id="crm_case_tree_view_oppor">
27 <field name="model">crm.lead</field>
28 <field name="inherit_id" ref="crm.crm_case_tree_view_oppor"/>
29 <field name="arch" type="xml">
30 <field name="partner_id" position="after">
31 <field name="commercial_partner_id" invisible="1"/>
32 </field>
33 </field>
34 </record>
35 <record model="ir.ui.view" id="view_crm_case_opportunities_filter">
36 <field name="model">crm.lead</field>
37 <field name="inherit_id" ref="crm.view_crm_case_opportunities_filter"/>
38 <field name="arch" type="xml">
39 <filter string="Customer" position="after">
40 <filter name="commercial_partner_id" string="Partner Company"
41 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
42 </filter>
43 </field>
44 </record>
45 </data>
46</openerp>
0\ No newline at end of file47\ No newline at end of file
148
=== added directory 'purchase_report_company'
=== added file 'purchase_report_company/__init__.py'
--- purchase_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_report_company/__init__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import purchase_report_company
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'purchase_report_company/__openerp__.py'
--- purchase_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ purchase_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Purchase Consolidation per Supplier Company',
23 'version': '1.0',
24 'category': 'Hidden/Dependency',
25 'description': """
26Add an extra Supplier Company dimension on Quotations/Orders lists
27==================================================================
28
29By Quotations and Purchase Orders can be associated with any given Supplier
30or any Supplier Contact. When using contacts, the company these contacts
31belong to is not directly available as a grouping dimension in
32Quotations and Purchase Orders lists.
33This modules adds an extra "group by" dimension labelled "Supplier Company".
34
35In case the Supplier is a natural person, the Supplier Company
36value will be that person herself.
37
38Note: this module will likely be removed in OpenERP 8.0, and may be
39directly integrated in the core Purchase Management module.
40""",
41 'author': 'OpenERP SA',
42 'website': 'http://www.openerp.com',
43 'depends': ['purchase'],
44 'data': [
45 'purchase_view.xml',
46 ],
47}
48
49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
050
=== added file 'purchase_report_company/purchase_report_company.py'
--- purchase_report_company/purchase_report_company.py 1970-01-01 00:00:00 +0000
+++ purchase_report_company/purchase_report_company.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,30 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24class purchase_order(osv.Model):
25 _inherit = 'purchase.order'
26 _columns = {
27 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Supplier Company', type='many2one',
28 relation='res.partner', store=True, readonly=True,
29 help="The commercial entity the supplier belongs to, sometimes useful for reporting")
30 }
031
=== added file 'purchase_report_company/purchase_view.xml'
--- purchase_report_company/purchase_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_report_company/purchase_view.xml 2014-01-29 13:26:54 +0000
@@ -0,0 +1,34 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="purchase_order_tree">
5 <field name="model">purchase.order</field>
6 <field name="inherit_id" ref="purchase.purchase_order_tree"/>
7 <field name="arch" type="xml">
8 <field name="partner_id" position="after">
9 <field name="commercial_partner_id" invisible="1"/>
10 </field>
11 </field>
12 </record>
13 <record model="ir.ui.view" id="view_request_for_quotation_filter">
14 <field name="model">purchase.order</field>
15 <field name="inherit_id" ref="purchase.view_request_for_quotation_filter"/>
16 <field name="arch" type="xml">
17 <filter string="Supplier" position="after">
18 <filter name="commercial_partner_id" string="Supplier Company"
19 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
20 </filter>
21 </field>
22 </record>
23 <record model="ir.ui.view" id="view_purchase_order_filter">
24 <field name="model">purchase.order</field>
25 <field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
26 <field name="arch" type="xml">
27 <filter string="Supplier" position="after">
28 <filter name="commercial_partner_id" string="Supplier Company"
29 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
30 </filter>
31 </field>
32 </record>
33 </data>
34</openerp>
0\ No newline at end of file35\ No newline at end of file
136
=== added directory 'sale_report_company'
=== added file 'sale_report_company/__init__.py'
--- sale_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_report_company/__init__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import sale_report_company
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'sale_report_company/__openerp__.py'
--- sale_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Sales Consolidation per Customer Company',
23 'version': '1.0',
24 'category': 'Hidden/Dependency',
25 'description': """
26Add an extra Customer Company dimension on Quotations/Orders lists
27==================================================================
28
29By Quotations and Sales Orders can be associated with any given Customer
30or any Customer Contact. When using contacts, the company these contacts
31belong to is not directly available as a grouping dimension in
32Quotations and Sales Orders lists.
33This modules adds an extra "group by" dimension labelled "Customer Company".
34
35For B2C where the Customer is a natural person, the Customer Company
36value will be that person herself.
37
38Note: this module will likely be removed in OpenERP 8.0, and may be
39directly integrated in the core Sales Management module.
40""",
41 'author': 'OpenERP SA',
42 'website': 'http://www.openerp.com',
43 'depends': ['sale'],
44 'data': [
45 'sale_view.xml',
46 ],
47}
48
49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
050
=== added file 'sale_report_company/sale_report_company.py'
--- sale_report_company/sale_report_company.py 1970-01-01 00:00:00 +0000
+++ sale_report_company/sale_report_company.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,30 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24class sale_order(osv.Model):
25 _inherit = 'sale.order'
26 _columns = {
27 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Customer Company', type='many2one',
28 relation='res.partner', store=True, readonly=True,
29 help="The commercial entity the customer belongs to, sometimes useful for reporting")
30 }
031
=== added file 'sale_report_company/sale_view.xml'
--- sale_report_company/sale_view.xml 1970-01-01 00:00:00 +0000
+++ sale_report_company/sale_view.xml 2014-01-29 13:26:54 +0000
@@ -0,0 +1,33 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="view_order_tree">
5 <field name="model">sale.order</field>
6 <field name="inherit_id" ref="sale.view_order_tree"/>
7 <field name="arch" type="xml">
8 <field name="partner_id" position="after">
9 <field name="commercial_partner_id" invisible="1"/>
10 </field>
11 </field>
12 </record>
13 <record model="ir.ui.view" id="view_quotation_tree">
14 <field name="model">sale.order</field>
15 <field name="inherit_id" ref="sale.view_quotation_tree"/>
16 <field name="arch" type="xml">
17 <field name="partner_id" position="after">
18 <field name="commercial_partner_id" invisible="1"/>
19 </field>
20 </field>
21 </record>
22 <record model="ir.ui.view" id="view_sales_order_filter">
23 <field name="model">sale.order</field>
24 <field name="inherit_id" ref="sale.view_sales_order_filter"/>
25 <field name="arch" type="xml">
26 <filter string="Customer" position="after">
27 <filter name="commercial_partner_id" string="Customer Company"
28 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
29 </filter>
30 </field>
31 </record>
32 </data>
33</openerp>
0\ No newline at end of file34\ No newline at end of file
135
=== added directory 'stock_report_company'
=== added file 'stock_report_company/__init__.py'
--- stock_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_report_company/__init__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import stock_report_company
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'stock_report_company/__openerp__.py'
--- stock_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ stock_report_company/__openerp__.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,50 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Stock Consolidation per Partner Company',
23 'version': '1.0',
24 'category': 'Hidden/Dependency',
25 'description': """
26Add an extra Partner Company dimension on Delivery Orders and Incoming Shipments lists
27======================================================================================
28
29By default Delivery Orders and Incoming Shipments can be associated with any given Partner
30or any Partner Contact. When using contacts, the company these contacts belong to is
31not directly available as a grouping dimension in Delivery Orders and Incoming Shipments
32lists.
33This modules adds an extra "group by" dimension labelled "Customer Company" or
34"Supplier Company".
35
36For cases where the Partner is a natural person, the Partner Company
37value will be that person herself.
38
39Note: this module will likely be removed in OpenERP 8.0, and may be
40directly integrated in the core CRM module.
41""",
42 'author': 'OpenERP SA',
43 'website': 'http://www.openerp.com',
44 'depends': ['stock'],
45 'data': [
46 'stock_view.xml',
47 ],
48}
49
50# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
051
=== added file 'stock_report_company/stock_report_company.py'
--- stock_report_company/stock_report_company.py 1970-01-01 00:00:00 +0000
+++ stock_report_company/stock_report_company.py 2014-01-29 13:26:54 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24# Due to the outstanding inheritance limitation explained in bug 996816 the
25# field has to be defined for each "virtual copy" of the stock.picking model.
26
27class stock_picking(osv.Model):
28 _inherit = 'stock.picking'
29 _columns = {
30 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one',
31 relation='res.partner', store=True, readonly=True,
32 help="The commercial entity the partner belongs to, sometimes useful for reporting")
33 }
34
35class stock_picking_out(osv.Model):
36 _inherit = 'stock.picking.out'
37 _columns = {
38 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Customer Company', type='many2one',
39 relation='res.partner', store=True, readonly=True,
40 help="The commercial entity the partner belongs to, sometimes useful for reporting")
41 }
42
43class stock_picking_in(osv.Model):
44 _inherit = 'stock.picking.in'
45 _columns = {
46 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Supplier Company', type='many2one',
47 relation='res.partner', store=True, readonly=True,
48 help="The commercial entity the partner belongs to, sometimes useful for reporting")
49 }
0\ No newline at end of file50\ No newline at end of file
151
=== added file 'stock_report_company/stock_view.xml'
--- stock_report_company/stock_view.xml 1970-01-01 00:00:00 +0000
+++ stock_report_company/stock_view.xml 2014-01-29 13:26:54 +0000
@@ -0,0 +1,46 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <!-- DELIVERY ORDERS -->
5 <record model="ir.ui.view" id="view_picking_out_tree">
6 <field name="model">stock.picking.out</field>
7 <field name="inherit_id" ref="stock.view_picking_out_tree"/>
8 <field name="arch" type="xml">
9 <field name="partner_id" position="after">
10 <field name="commercial_partner_id" invisible="1"/>
11 </field>
12 </field>
13 </record>
14 <record model="ir.ui.view" id="view_picking_out_search">
15 <field name="model">stock.picking.out</field>
16 <field name="inherit_id" ref="stock.view_picking_out_search"/>
17 <field name="arch" type="xml">
18 <filter string="Journal" position="after">
19 <filter name="commercial_partner_id" string="Customer Company"
20 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
21 </filter>
22 </field>
23 </record>
24
25 <!-- INCOMING SHIPMENTS -->
26 <record model="ir.ui.view" id="view_picking_in_tree">
27 <field name="model">stock.picking.in</field>
28 <field name="inherit_id" ref="stock.view_picking_in_tree"/>
29 <field name="arch" type="xml">
30 <field name="partner_id" position="after">
31 <field name="commercial_partner_id" invisible="1"/>
32 </field>
33 </field>
34 </record>
35 <record model="ir.ui.view" id="view_picking_in_search">
36 <field name="model">stock.picking.in</field>
37 <field name="inherit_id" ref="stock.view_picking_in_search"/>
38 <field name="arch" type="xml">
39 <filter string="Journal" position="after">
40 <filter name="commercial_partner_id" string="Supplier Company"
41 domain="[]" context="{'group_by': 'commercial_partner_id'}"/>
42 </filter>
43 </field>
44 </record>
45 </data>
46</openerp>
0\ No newline at end of file47\ No newline at end of file