Merge lp:~openerp-dev/openobject-addons/7.0-extra-report-company into lp:openobject-addons/7.0
- 7.0-extra-report-company
- Merge into 7.0
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 |
Related bugs: |
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 |
Commit message
Description of the change
Adds compatibility modules for storing denormalized 'commercial_
- Contracts (account.
- Sales Orders (sale.order) -> module sale_report_company
- Purchase Orders (purchase.order) -> module purchase_
- Stock Pickings (stock.picking) -> module stock_report_
- Leads/Opportunities (crm.lead) -> module crm_report_company
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
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : | # |
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_
So my point in your MP is:
1) I think a crm.claim object also deserves such a commercial_
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_
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_
https:/
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_
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://
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...
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
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.
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_
2014-03-27 21:13:14,365 914 INFO prod_erp openerp.
2014-03-27 21:13:14,443 914 ERROR prod_erp openerp.sql_db: bad query: ALTER TABLE "sale_order" ADD FOREIGN KEY ("commercial_
Traceback (most recent call last):
File "/home/
res = self._obj.
IntegrityError: insert or update on table "sale_order" violates foreign key constraint "sale_order_
DETAIL: Key (commercial_
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
1 | === modified file 'account_report_company/__openerp__.py' |
2 | --- account_report_company/__openerp__.py 2013-04-19 17:18:53 +0000 |
3 | +++ account_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
4 | @@ -19,7 +19,7 @@ |
5 | # |
6 | ############################################################################## |
7 | { |
8 | - 'name': 'Invoice Analysis per Company', |
9 | + 'name': 'Invoice Consolidation per Partner Company', |
10 | 'version': '1.0', |
11 | 'category': 'Accounting & Finance', |
12 | 'description': """ |
13 | |
14 | === added directory 'analytic_report_company' |
15 | === added file 'analytic_report_company/__init__.py' |
16 | --- analytic_report_company/__init__.py 1970-01-01 00:00:00 +0000 |
17 | +++ analytic_report_company/__init__.py 2014-01-29 13:26:54 +0000 |
18 | @@ -0,0 +1,24 @@ |
19 | +# -*- coding: utf-8 -*- |
20 | +############################################################################## |
21 | +# |
22 | +# OpenERP, Open Source Business Applications |
23 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
24 | +# |
25 | +# This program is free software: you can redistribute it and/or modify |
26 | +# it under the terms of the GNU Affero General Public License as |
27 | +# published by the Free Software Foundation, either version 3 of the |
28 | +# License, or (at your option) any later version. |
29 | +# |
30 | +# This program is distributed in the hope that it will be useful, |
31 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
33 | +# GNU Affero General Public License for more details. |
34 | +# |
35 | +# You should have received a copy of the GNU Affero General Public License |
36 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
37 | +# |
38 | +############################################################################## |
39 | + |
40 | +import analytic_report_company |
41 | + |
42 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
43 | |
44 | === added file 'analytic_report_company/__openerp__.py' |
45 | --- analytic_report_company/__openerp__.py 1970-01-01 00:00:00 +0000 |
46 | +++ analytic_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
47 | @@ -0,0 +1,49 @@ |
48 | +# -*- coding: utf-8 -*- |
49 | +############################################################################## |
50 | +# |
51 | +# OpenERP, Open Source Business Applications |
52 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
53 | +# |
54 | +# This program is free software: you can redistribute it and/or modify |
55 | +# it under the terms of the GNU Affero General Public License as |
56 | +# published by the Free Software Foundation, either version 3 of the |
57 | +# License, or (at your option) any later version. |
58 | +# |
59 | +# This program is distributed in the hope that it will be useful, |
60 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
61 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
62 | +# GNU Affero General Public License for more details. |
63 | +# |
64 | +# You should have received a copy of the GNU Affero General Public License |
65 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
66 | +# |
67 | +############################################################################## |
68 | +{ |
69 | + 'name': 'Contracts Consolidation per Partner Company', |
70 | + 'version': '1.0', |
71 | + 'category': 'Hidden/Dependency', |
72 | + 'description': """ |
73 | +Add an extra Partner Company dimension on Contracts lists |
74 | +========================================================= |
75 | + |
76 | +By default Contracts can be associated with any given Partner |
77 | +or any Partner Contact. When using contacts, the company these |
78 | +contacts belong to is not directly available as a grouping |
79 | +dimension in Contracts lists. |
80 | +This modules adds an extra "group by" dimension labelled "Partner Company". |
81 | + |
82 | +For B2C cases where the Partner is a natural person, the Partner Company |
83 | +value will be that person herself. |
84 | + |
85 | +Note: this module will likely be removed in OpenERP 8.0, and may be |
86 | +directly integrated in the core Contracts Management module. |
87 | +""", |
88 | + 'author': 'OpenERP SA', |
89 | + 'website': 'http://www.openerp.com', |
90 | + 'depends': ['account_analytic_analysis'], |
91 | + 'data': [ |
92 | + 'analytic_view.xml', |
93 | + ], |
94 | +} |
95 | + |
96 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
97 | |
98 | === added file 'analytic_report_company/analytic_report_company.py' |
99 | --- analytic_report_company/analytic_report_company.py 1970-01-01 00:00:00 +0000 |
100 | +++ analytic_report_company/analytic_report_company.py 2014-01-29 13:26:54 +0000 |
101 | @@ -0,0 +1,30 @@ |
102 | +# -*- coding: utf-8 -*- |
103 | +############################################################################## |
104 | +# |
105 | +# OpenERP, Open Source Business Applications |
106 | +# Copyright (c) 2013 S.A. <http://openerp.com> |
107 | +# |
108 | +# This program is free software: you can redistribute it and/or modify |
109 | +# it under the terms of the GNU Affero General Public License as |
110 | +# published by the Free Software Foundation, either version 3 of the |
111 | +# License, or (at your option) any later version. |
112 | +# |
113 | +# This program is distributed in the hope that it will be useful, |
114 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
115 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
116 | +# GNU Affero General Public License for more details. |
117 | +# |
118 | +# You should have received a copy of the GNU Affero General Public License |
119 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
120 | +# |
121 | +############################################################################## |
122 | + |
123 | +from openerp.osv import osv, fields |
124 | + |
125 | +class contract(osv.Model): |
126 | + _inherit = 'account.analytic.account' |
127 | + _columns = { |
128 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one', |
129 | + relation='res.partner', store=True, readonly=True, |
130 | + help="The commercial entity the partner belongs to, sometimes useful for reporting") |
131 | + } |
132 | |
133 | === added file 'analytic_report_company/analytic_view.xml' |
134 | --- analytic_report_company/analytic_view.xml 1970-01-01 00:00:00 +0000 |
135 | +++ analytic_report_company/analytic_view.xml 2014-01-29 13:26:54 +0000 |
136 | @@ -0,0 +1,35 @@ |
137 | +<?xml version="1.0"?> |
138 | +<openerp> |
139 | + <data> |
140 | + <record model="ir.ui.view" id="view_account_analytic_account_list"> |
141 | + <field name="model">account.analytic.account</field> |
142 | + <field name="inherit_id" ref="account.view_account_analytic_account_list"/> |
143 | + <field name="arch" type="xml"> |
144 | + <field name="partner_id" position="after"> |
145 | + <field name="commercial_partner_id" invisible="1"/> |
146 | + </field> |
147 | + </field> |
148 | + </record> |
149 | + |
150 | + <record model="ir.ui.view" id="view_account_analytic_account_overdue_search"> |
151 | + <field name="model">account.analytic.account</field> |
152 | + <field name="inherit_id" ref="account_analytic_analysis.view_account_analytic_account_overdue_search"/> |
153 | + <field name="arch" type="xml"> |
154 | + <filter string="Partner" position="after"> |
155 | + <filter name="commercial_partner_id" string="Partner Company" |
156 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
157 | + </filter> |
158 | + </field> |
159 | + </record> |
160 | + <record model="ir.ui.view" id="view_account_analytic_account_search"> |
161 | + <field name="model">account.analytic.account</field> |
162 | + <field name="inherit_id" ref="account.view_account_analytic_account_search"/> |
163 | + <field name="arch" type="xml"> |
164 | + <filter string="Associated Partner" position="after"> |
165 | + <filter name="commercial_partner_id" string="Partner Company" |
166 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
167 | + </filter> |
168 | + </field> |
169 | + </record> |
170 | + </data> |
171 | +</openerp> |
172 | \ No newline at end of file |
173 | |
174 | === added directory 'crm_report_company' |
175 | === added file 'crm_report_company/__init__.py' |
176 | --- crm_report_company/__init__.py 1970-01-01 00:00:00 +0000 |
177 | +++ crm_report_company/__init__.py 2014-01-29 13:26:54 +0000 |
178 | @@ -0,0 +1,24 @@ |
179 | +# -*- coding: utf-8 -*- |
180 | +############################################################################## |
181 | +# |
182 | +# OpenERP, Open Source Business Applications |
183 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
184 | +# |
185 | +# This program is free software: you can redistribute it and/or modify |
186 | +# it under the terms of the GNU Affero General Public License as |
187 | +# published by the Free Software Foundation, either version 3 of the |
188 | +# License, or (at your option) any later version. |
189 | +# |
190 | +# This program is distributed in the hope that it will be useful, |
191 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
192 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
193 | +# GNU Affero General Public License for more details. |
194 | +# |
195 | +# You should have received a copy of the GNU Affero General Public License |
196 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
197 | +# |
198 | +############################################################################## |
199 | + |
200 | +import crm_report_company |
201 | + |
202 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
203 | |
204 | === added file 'crm_report_company/__openerp__.py' |
205 | --- crm_report_company/__openerp__.py 1970-01-01 00:00:00 +0000 |
206 | +++ crm_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
207 | @@ -0,0 +1,49 @@ |
208 | +# -*- coding: utf-8 -*- |
209 | +############################################################################## |
210 | +# |
211 | +# OpenERP, Open Source Business Applications |
212 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
213 | +# |
214 | +# This program is free software: you can redistribute it and/or modify |
215 | +# it under the terms of the GNU Affero General Public License as |
216 | +# published by the Free Software Foundation, either version 3 of the |
217 | +# License, or (at your option) any later version. |
218 | +# |
219 | +# This program is distributed in the hope that it will be useful, |
220 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
221 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
222 | +# GNU Affero General Public License for more details. |
223 | +# |
224 | +# You should have received a copy of the GNU Affero General Public License |
225 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
226 | +# |
227 | +############################################################################## |
228 | +{ |
229 | + 'name': 'CRM Consolidation per Partner Company', |
230 | + 'version': '1.0', |
231 | + 'category': 'Hidden/Dependency', |
232 | + 'description': """ |
233 | +Add an extra Partner Company dimension on Leads/Opportunities lists |
234 | +=================================================================== |
235 | + |
236 | +By default Leads and Opportunities can be associated with any given Partner |
237 | +or any Partner Contact. When using contacts, the company these contacts |
238 | +belong to is not directly available as a grouping dimension in Leads |
239 | +and Opportunities lists. |
240 | +This modules adds an extra "group by" dimension labelled "Partner Company". |
241 | + |
242 | +For B2C cases where the Partner is a natural person, the Partner Company |
243 | +value will be that person herself. |
244 | + |
245 | +Note: this module will likely be removed in OpenERP 8.0, and may be |
246 | +directly integrated in the core CRM module. |
247 | +""", |
248 | + 'author': 'OpenERP SA', |
249 | + 'website': 'http://www.openerp.com', |
250 | + 'depends': ['crm'], |
251 | + 'data': [ |
252 | + 'crm_view.xml', |
253 | + ], |
254 | +} |
255 | + |
256 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
257 | |
258 | === added file 'crm_report_company/crm_report_company.py' |
259 | --- crm_report_company/crm_report_company.py 1970-01-01 00:00:00 +0000 |
260 | +++ crm_report_company/crm_report_company.py 2014-01-29 13:26:54 +0000 |
261 | @@ -0,0 +1,30 @@ |
262 | +# -*- coding: utf-8 -*- |
263 | +############################################################################## |
264 | +# |
265 | +# OpenERP, Open Source Business Applications |
266 | +# Copyright (c) 2013 S.A. <http://openerp.com> |
267 | +# |
268 | +# This program is free software: you can redistribute it and/or modify |
269 | +# it under the terms of the GNU Affero General Public License as |
270 | +# published by the Free Software Foundation, either version 3 of the |
271 | +# License, or (at your option) any later version. |
272 | +# |
273 | +# This program is distributed in the hope that it will be useful, |
274 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
275 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
276 | +# GNU Affero General Public License for more details. |
277 | +# |
278 | +# You should have received a copy of the GNU Affero General Public License |
279 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
280 | +# |
281 | +############################################################################## |
282 | + |
283 | +from openerp.osv import osv, fields |
284 | + |
285 | +class crm_lead(osv.Model): |
286 | + _inherit = 'crm.lead' |
287 | + _columns = { |
288 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one', |
289 | + relation='res.partner', store=True, readonly=True, |
290 | + help="The commercial entity the partner belongs to, sometimes useful for reporting") |
291 | + } |
292 | |
293 | === added file 'crm_report_company/crm_view.xml' |
294 | --- crm_report_company/crm_view.xml 1970-01-01 00:00:00 +0000 |
295 | +++ crm_report_company/crm_view.xml 2014-01-29 13:26:54 +0000 |
296 | @@ -0,0 +1,46 @@ |
297 | +<?xml version="1.0"?> |
298 | +<openerp> |
299 | + <data> |
300 | + <!-- LEADS --> |
301 | + <record model="ir.ui.view" id="crm_case_tree_view_leads"> |
302 | + <field name="model">crm.lead</field> |
303 | + <field name="inherit_id" ref="crm.crm_case_tree_view_leads"/> |
304 | + <field name="arch" type="xml"> |
305 | + <field name="partner_id" position="after"> |
306 | + <field name="commercial_partner_id" invisible="1"/> |
307 | + </field> |
308 | + </field> |
309 | + </record> |
310 | + <record model="ir.ui.view" id="view_crm_case_leads_filter"> |
311 | + <field name="model">crm.lead</field> |
312 | + <field name="inherit_id" ref="crm.view_crm_case_leads_filter"/> |
313 | + <field name="arch" type="xml"> |
314 | + <filter string="Customer" position="after"> |
315 | + <filter name="commercial_partner_id" string="Partner Company" |
316 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
317 | + </filter> |
318 | + </field> |
319 | + </record> |
320 | + |
321 | + <!-- OPPORTUNITIES --> |
322 | + <record model="ir.ui.view" id="crm_case_tree_view_oppor"> |
323 | + <field name="model">crm.lead</field> |
324 | + <field name="inherit_id" ref="crm.crm_case_tree_view_oppor"/> |
325 | + <field name="arch" type="xml"> |
326 | + <field name="partner_id" position="after"> |
327 | + <field name="commercial_partner_id" invisible="1"/> |
328 | + </field> |
329 | + </field> |
330 | + </record> |
331 | + <record model="ir.ui.view" id="view_crm_case_opportunities_filter"> |
332 | + <field name="model">crm.lead</field> |
333 | + <field name="inherit_id" ref="crm.view_crm_case_opportunities_filter"/> |
334 | + <field name="arch" type="xml"> |
335 | + <filter string="Customer" position="after"> |
336 | + <filter name="commercial_partner_id" string="Partner Company" |
337 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
338 | + </filter> |
339 | + </field> |
340 | + </record> |
341 | + </data> |
342 | +</openerp> |
343 | \ No newline at end of file |
344 | |
345 | === added directory 'purchase_report_company' |
346 | === added file 'purchase_report_company/__init__.py' |
347 | --- purchase_report_company/__init__.py 1970-01-01 00:00:00 +0000 |
348 | +++ purchase_report_company/__init__.py 2014-01-29 13:26:54 +0000 |
349 | @@ -0,0 +1,24 @@ |
350 | +# -*- coding: utf-8 -*- |
351 | +############################################################################## |
352 | +# |
353 | +# OpenERP, Open Source Business Applications |
354 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
355 | +# |
356 | +# This program is free software: you can redistribute it and/or modify |
357 | +# it under the terms of the GNU Affero General Public License as |
358 | +# published by the Free Software Foundation, either version 3 of the |
359 | +# License, or (at your option) any later version. |
360 | +# |
361 | +# This program is distributed in the hope that it will be useful, |
362 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
363 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
364 | +# GNU Affero General Public License for more details. |
365 | +# |
366 | +# You should have received a copy of the GNU Affero General Public License |
367 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
368 | +# |
369 | +############################################################################## |
370 | + |
371 | +import purchase_report_company |
372 | + |
373 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
374 | |
375 | === added file 'purchase_report_company/__openerp__.py' |
376 | --- purchase_report_company/__openerp__.py 1970-01-01 00:00:00 +0000 |
377 | +++ purchase_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
378 | @@ -0,0 +1,49 @@ |
379 | +# -*- coding: utf-8 -*- |
380 | +############################################################################## |
381 | +# |
382 | +# OpenERP, Open Source Business Applications |
383 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
384 | +# |
385 | +# This program is free software: you can redistribute it and/or modify |
386 | +# it under the terms of the GNU Affero General Public License as |
387 | +# published by the Free Software Foundation, either version 3 of the |
388 | +# License, or (at your option) any later version. |
389 | +# |
390 | +# This program is distributed in the hope that it will be useful, |
391 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
392 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
393 | +# GNU Affero General Public License for more details. |
394 | +# |
395 | +# You should have received a copy of the GNU Affero General Public License |
396 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
397 | +# |
398 | +############################################################################## |
399 | +{ |
400 | + 'name': 'Purchase Consolidation per Supplier Company', |
401 | + 'version': '1.0', |
402 | + 'category': 'Hidden/Dependency', |
403 | + 'description': """ |
404 | +Add an extra Supplier Company dimension on Quotations/Orders lists |
405 | +================================================================== |
406 | + |
407 | +By Quotations and Purchase Orders can be associated with any given Supplier |
408 | +or any Supplier Contact. When using contacts, the company these contacts |
409 | +belong to is not directly available as a grouping dimension in |
410 | +Quotations and Purchase Orders lists. |
411 | +This modules adds an extra "group by" dimension labelled "Supplier Company". |
412 | + |
413 | +In case the Supplier is a natural person, the Supplier Company |
414 | +value will be that person herself. |
415 | + |
416 | +Note: this module will likely be removed in OpenERP 8.0, and may be |
417 | +directly integrated in the core Purchase Management module. |
418 | +""", |
419 | + 'author': 'OpenERP SA', |
420 | + 'website': 'http://www.openerp.com', |
421 | + 'depends': ['purchase'], |
422 | + 'data': [ |
423 | + 'purchase_view.xml', |
424 | + ], |
425 | +} |
426 | + |
427 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
428 | |
429 | === added file 'purchase_report_company/purchase_report_company.py' |
430 | --- purchase_report_company/purchase_report_company.py 1970-01-01 00:00:00 +0000 |
431 | +++ purchase_report_company/purchase_report_company.py 2014-01-29 13:26:54 +0000 |
432 | @@ -0,0 +1,30 @@ |
433 | +# -*- coding: utf-8 -*- |
434 | +############################################################################## |
435 | +# |
436 | +# OpenERP, Open Source Business Applications |
437 | +# Copyright (c) 2013 S.A. <http://openerp.com> |
438 | +# |
439 | +# This program is free software: you can redistribute it and/or modify |
440 | +# it under the terms of the GNU Affero General Public License as |
441 | +# published by the Free Software Foundation, either version 3 of the |
442 | +# License, or (at your option) any later version. |
443 | +# |
444 | +# This program is distributed in the hope that it will be useful, |
445 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
446 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
447 | +# GNU Affero General Public License for more details. |
448 | +# |
449 | +# You should have received a copy of the GNU Affero General Public License |
450 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
451 | +# |
452 | +############################################################################## |
453 | + |
454 | +from openerp.osv import osv, fields |
455 | + |
456 | +class purchase_order(osv.Model): |
457 | + _inherit = 'purchase.order' |
458 | + _columns = { |
459 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Supplier Company', type='many2one', |
460 | + relation='res.partner', store=True, readonly=True, |
461 | + help="The commercial entity the supplier belongs to, sometimes useful for reporting") |
462 | + } |
463 | |
464 | === added file 'purchase_report_company/purchase_view.xml' |
465 | --- purchase_report_company/purchase_view.xml 1970-01-01 00:00:00 +0000 |
466 | +++ purchase_report_company/purchase_view.xml 2014-01-29 13:26:54 +0000 |
467 | @@ -0,0 +1,34 @@ |
468 | +<?xml version="1.0"?> |
469 | +<openerp> |
470 | + <data> |
471 | + <record model="ir.ui.view" id="purchase_order_tree"> |
472 | + <field name="model">purchase.order</field> |
473 | + <field name="inherit_id" ref="purchase.purchase_order_tree"/> |
474 | + <field name="arch" type="xml"> |
475 | + <field name="partner_id" position="after"> |
476 | + <field name="commercial_partner_id" invisible="1"/> |
477 | + </field> |
478 | + </field> |
479 | + </record> |
480 | + <record model="ir.ui.view" id="view_request_for_quotation_filter"> |
481 | + <field name="model">purchase.order</field> |
482 | + <field name="inherit_id" ref="purchase.view_request_for_quotation_filter"/> |
483 | + <field name="arch" type="xml"> |
484 | + <filter string="Supplier" position="after"> |
485 | + <filter name="commercial_partner_id" string="Supplier Company" |
486 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
487 | + </filter> |
488 | + </field> |
489 | + </record> |
490 | + <record model="ir.ui.view" id="view_purchase_order_filter"> |
491 | + <field name="model">purchase.order</field> |
492 | + <field name="inherit_id" ref="purchase.view_purchase_order_filter"/> |
493 | + <field name="arch" type="xml"> |
494 | + <filter string="Supplier" position="after"> |
495 | + <filter name="commercial_partner_id" string="Supplier Company" |
496 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
497 | + </filter> |
498 | + </field> |
499 | + </record> |
500 | + </data> |
501 | +</openerp> |
502 | \ No newline at end of file |
503 | |
504 | === added directory 'sale_report_company' |
505 | === added file 'sale_report_company/__init__.py' |
506 | --- sale_report_company/__init__.py 1970-01-01 00:00:00 +0000 |
507 | +++ sale_report_company/__init__.py 2014-01-29 13:26:54 +0000 |
508 | @@ -0,0 +1,24 @@ |
509 | +# -*- coding: utf-8 -*- |
510 | +############################################################################## |
511 | +# |
512 | +# OpenERP, Open Source Business Applications |
513 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
514 | +# |
515 | +# This program is free software: you can redistribute it and/or modify |
516 | +# it under the terms of the GNU Affero General Public License as |
517 | +# published by the Free Software Foundation, either version 3 of the |
518 | +# License, or (at your option) any later version. |
519 | +# |
520 | +# This program is distributed in the hope that it will be useful, |
521 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
522 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
523 | +# GNU Affero General Public License for more details. |
524 | +# |
525 | +# You should have received a copy of the GNU Affero General Public License |
526 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
527 | +# |
528 | +############################################################################## |
529 | + |
530 | +import sale_report_company |
531 | + |
532 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
533 | |
534 | === added file 'sale_report_company/__openerp__.py' |
535 | --- sale_report_company/__openerp__.py 1970-01-01 00:00:00 +0000 |
536 | +++ sale_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
537 | @@ -0,0 +1,49 @@ |
538 | +# -*- coding: utf-8 -*- |
539 | +############################################################################## |
540 | +# |
541 | +# OpenERP, Open Source Business Applications |
542 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
543 | +# |
544 | +# This program is free software: you can redistribute it and/or modify |
545 | +# it under the terms of the GNU Affero General Public License as |
546 | +# published by the Free Software Foundation, either version 3 of the |
547 | +# License, or (at your option) any later version. |
548 | +# |
549 | +# This program is distributed in the hope that it will be useful, |
550 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
551 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
552 | +# GNU Affero General Public License for more details. |
553 | +# |
554 | +# You should have received a copy of the GNU Affero General Public License |
555 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
556 | +# |
557 | +############################################################################## |
558 | +{ |
559 | + 'name': 'Sales Consolidation per Customer Company', |
560 | + 'version': '1.0', |
561 | + 'category': 'Hidden/Dependency', |
562 | + 'description': """ |
563 | +Add an extra Customer Company dimension on Quotations/Orders lists |
564 | +================================================================== |
565 | + |
566 | +By Quotations and Sales Orders can be associated with any given Customer |
567 | +or any Customer Contact. When using contacts, the company these contacts |
568 | +belong to is not directly available as a grouping dimension in |
569 | +Quotations and Sales Orders lists. |
570 | +This modules adds an extra "group by" dimension labelled "Customer Company". |
571 | + |
572 | +For B2C where the Customer is a natural person, the Customer Company |
573 | +value will be that person herself. |
574 | + |
575 | +Note: this module will likely be removed in OpenERP 8.0, and may be |
576 | +directly integrated in the core Sales Management module. |
577 | +""", |
578 | + 'author': 'OpenERP SA', |
579 | + 'website': 'http://www.openerp.com', |
580 | + 'depends': ['sale'], |
581 | + 'data': [ |
582 | + 'sale_view.xml', |
583 | + ], |
584 | +} |
585 | + |
586 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
587 | |
588 | === added file 'sale_report_company/sale_report_company.py' |
589 | --- sale_report_company/sale_report_company.py 1970-01-01 00:00:00 +0000 |
590 | +++ sale_report_company/sale_report_company.py 2014-01-29 13:26:54 +0000 |
591 | @@ -0,0 +1,30 @@ |
592 | +# -*- coding: utf-8 -*- |
593 | +############################################################################## |
594 | +# |
595 | +# OpenERP, Open Source Business Applications |
596 | +# Copyright (c) 2013 S.A. <http://openerp.com> |
597 | +# |
598 | +# This program is free software: you can redistribute it and/or modify |
599 | +# it under the terms of the GNU Affero General Public License as |
600 | +# published by the Free Software Foundation, either version 3 of the |
601 | +# License, or (at your option) any later version. |
602 | +# |
603 | +# This program is distributed in the hope that it will be useful, |
604 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
605 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
606 | +# GNU Affero General Public License for more details. |
607 | +# |
608 | +# You should have received a copy of the GNU Affero General Public License |
609 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
610 | +# |
611 | +############################################################################## |
612 | + |
613 | +from openerp.osv import osv, fields |
614 | + |
615 | +class sale_order(osv.Model): |
616 | + _inherit = 'sale.order' |
617 | + _columns = { |
618 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Customer Company', type='many2one', |
619 | + relation='res.partner', store=True, readonly=True, |
620 | + help="The commercial entity the customer belongs to, sometimes useful for reporting") |
621 | + } |
622 | |
623 | === added file 'sale_report_company/sale_view.xml' |
624 | --- sale_report_company/sale_view.xml 1970-01-01 00:00:00 +0000 |
625 | +++ sale_report_company/sale_view.xml 2014-01-29 13:26:54 +0000 |
626 | @@ -0,0 +1,33 @@ |
627 | +<?xml version="1.0"?> |
628 | +<openerp> |
629 | + <data> |
630 | + <record model="ir.ui.view" id="view_order_tree"> |
631 | + <field name="model">sale.order</field> |
632 | + <field name="inherit_id" ref="sale.view_order_tree"/> |
633 | + <field name="arch" type="xml"> |
634 | + <field name="partner_id" position="after"> |
635 | + <field name="commercial_partner_id" invisible="1"/> |
636 | + </field> |
637 | + </field> |
638 | + </record> |
639 | + <record model="ir.ui.view" id="view_quotation_tree"> |
640 | + <field name="model">sale.order</field> |
641 | + <field name="inherit_id" ref="sale.view_quotation_tree"/> |
642 | + <field name="arch" type="xml"> |
643 | + <field name="partner_id" position="after"> |
644 | + <field name="commercial_partner_id" invisible="1"/> |
645 | + </field> |
646 | + </field> |
647 | + </record> |
648 | + <record model="ir.ui.view" id="view_sales_order_filter"> |
649 | + <field name="model">sale.order</field> |
650 | + <field name="inherit_id" ref="sale.view_sales_order_filter"/> |
651 | + <field name="arch" type="xml"> |
652 | + <filter string="Customer" position="after"> |
653 | + <filter name="commercial_partner_id" string="Customer Company" |
654 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
655 | + </filter> |
656 | + </field> |
657 | + </record> |
658 | + </data> |
659 | +</openerp> |
660 | \ No newline at end of file |
661 | |
662 | === added directory 'stock_report_company' |
663 | === added file 'stock_report_company/__init__.py' |
664 | --- stock_report_company/__init__.py 1970-01-01 00:00:00 +0000 |
665 | +++ stock_report_company/__init__.py 2014-01-29 13:26:54 +0000 |
666 | @@ -0,0 +1,24 @@ |
667 | +# -*- coding: utf-8 -*- |
668 | +############################################################################## |
669 | +# |
670 | +# OpenERP, Open Source Business Applications |
671 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
672 | +# |
673 | +# This program is free software: you can redistribute it and/or modify |
674 | +# it under the terms of the GNU Affero General Public License as |
675 | +# published by the Free Software Foundation, either version 3 of the |
676 | +# License, or (at your option) any later version. |
677 | +# |
678 | +# This program is distributed in the hope that it will be useful, |
679 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
680 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
681 | +# GNU Affero General Public License for more details. |
682 | +# |
683 | +# You should have received a copy of the GNU Affero General Public License |
684 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
685 | +# |
686 | +############################################################################## |
687 | + |
688 | +import stock_report_company |
689 | + |
690 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
691 | |
692 | === added file 'stock_report_company/__openerp__.py' |
693 | --- stock_report_company/__openerp__.py 1970-01-01 00:00:00 +0000 |
694 | +++ stock_report_company/__openerp__.py 2014-01-29 13:26:54 +0000 |
695 | @@ -0,0 +1,50 @@ |
696 | +# -*- coding: utf-8 -*- |
697 | +############################################################################## |
698 | +# |
699 | +# OpenERP, Open Source Business Applications |
700 | +# Copyright (c) 2013 OpenERP S.A. <http://openerp.com> |
701 | +# |
702 | +# This program is free software: you can redistribute it and/or modify |
703 | +# it under the terms of the GNU Affero General Public License as |
704 | +# published by the Free Software Foundation, either version 3 of the |
705 | +# License, or (at your option) any later version. |
706 | +# |
707 | +# This program is distributed in the hope that it will be useful, |
708 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
709 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
710 | +# GNU Affero General Public License for more details. |
711 | +# |
712 | +# You should have received a copy of the GNU Affero General Public License |
713 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
714 | +# |
715 | +############################################################################## |
716 | +{ |
717 | + 'name': 'Stock Consolidation per Partner Company', |
718 | + 'version': '1.0', |
719 | + 'category': 'Hidden/Dependency', |
720 | + 'description': """ |
721 | +Add an extra Partner Company dimension on Delivery Orders and Incoming Shipments lists |
722 | +====================================================================================== |
723 | + |
724 | +By default Delivery Orders and Incoming Shipments can be associated with any given Partner |
725 | +or any Partner Contact. When using contacts, the company these contacts belong to is |
726 | +not directly available as a grouping dimension in Delivery Orders and Incoming Shipments |
727 | +lists. |
728 | +This modules adds an extra "group by" dimension labelled "Customer Company" or |
729 | +"Supplier Company". |
730 | + |
731 | +For cases where the Partner is a natural person, the Partner Company |
732 | +value will be that person herself. |
733 | + |
734 | +Note: this module will likely be removed in OpenERP 8.0, and may be |
735 | +directly integrated in the core CRM module. |
736 | +""", |
737 | + 'author': 'OpenERP SA', |
738 | + 'website': 'http://www.openerp.com', |
739 | + 'depends': ['stock'], |
740 | + 'data': [ |
741 | + 'stock_view.xml', |
742 | + ], |
743 | +} |
744 | + |
745 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
746 | |
747 | === added file 'stock_report_company/stock_report_company.py' |
748 | --- stock_report_company/stock_report_company.py 1970-01-01 00:00:00 +0000 |
749 | +++ stock_report_company/stock_report_company.py 2014-01-29 13:26:54 +0000 |
750 | @@ -0,0 +1,49 @@ |
751 | +# -*- coding: utf-8 -*- |
752 | +############################################################################## |
753 | +# |
754 | +# OpenERP, Open Source Business Applications |
755 | +# Copyright (c) 2013 S.A. <http://openerp.com> |
756 | +# |
757 | +# This program is free software: you can redistribute it and/or modify |
758 | +# it under the terms of the GNU Affero General Public License as |
759 | +# published by the Free Software Foundation, either version 3 of the |
760 | +# License, or (at your option) any later version. |
761 | +# |
762 | +# This program is distributed in the hope that it will be useful, |
763 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
764 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
765 | +# GNU Affero General Public License for more details. |
766 | +# |
767 | +# You should have received a copy of the GNU Affero General Public License |
768 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
769 | +# |
770 | +############################################################################## |
771 | + |
772 | +from openerp.osv import osv, fields |
773 | + |
774 | +# Due to the outstanding inheritance limitation explained in bug 996816 the |
775 | +# field has to be defined for each "virtual copy" of the stock.picking model. |
776 | + |
777 | +class stock_picking(osv.Model): |
778 | + _inherit = 'stock.picking' |
779 | + _columns = { |
780 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Partner Company', type='many2one', |
781 | + relation='res.partner', store=True, readonly=True, |
782 | + help="The commercial entity the partner belongs to, sometimes useful for reporting") |
783 | + } |
784 | + |
785 | +class stock_picking_out(osv.Model): |
786 | + _inherit = 'stock.picking.out' |
787 | + _columns = { |
788 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Customer Company', type='many2one', |
789 | + relation='res.partner', store=True, readonly=True, |
790 | + help="The commercial entity the partner belongs to, sometimes useful for reporting") |
791 | + } |
792 | + |
793 | +class stock_picking_in(osv.Model): |
794 | + _inherit = 'stock.picking.in' |
795 | + _columns = { |
796 | + 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Supplier Company', type='many2one', |
797 | + relation='res.partner', store=True, readonly=True, |
798 | + help="The commercial entity the partner belongs to, sometimes useful for reporting") |
799 | + } |
800 | \ No newline at end of file |
801 | |
802 | === added file 'stock_report_company/stock_view.xml' |
803 | --- stock_report_company/stock_view.xml 1970-01-01 00:00:00 +0000 |
804 | +++ stock_report_company/stock_view.xml 2014-01-29 13:26:54 +0000 |
805 | @@ -0,0 +1,46 @@ |
806 | +<?xml version="1.0"?> |
807 | +<openerp> |
808 | + <data> |
809 | + <!-- DELIVERY ORDERS --> |
810 | + <record model="ir.ui.view" id="view_picking_out_tree"> |
811 | + <field name="model">stock.picking.out</field> |
812 | + <field name="inherit_id" ref="stock.view_picking_out_tree"/> |
813 | + <field name="arch" type="xml"> |
814 | + <field name="partner_id" position="after"> |
815 | + <field name="commercial_partner_id" invisible="1"/> |
816 | + </field> |
817 | + </field> |
818 | + </record> |
819 | + <record model="ir.ui.view" id="view_picking_out_search"> |
820 | + <field name="model">stock.picking.out</field> |
821 | + <field name="inherit_id" ref="stock.view_picking_out_search"/> |
822 | + <field name="arch" type="xml"> |
823 | + <filter string="Journal" position="after"> |
824 | + <filter name="commercial_partner_id" string="Customer Company" |
825 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
826 | + </filter> |
827 | + </field> |
828 | + </record> |
829 | + |
830 | + <!-- INCOMING SHIPMENTS --> |
831 | + <record model="ir.ui.view" id="view_picking_in_tree"> |
832 | + <field name="model">stock.picking.in</field> |
833 | + <field name="inherit_id" ref="stock.view_picking_in_tree"/> |
834 | + <field name="arch" type="xml"> |
835 | + <field name="partner_id" position="after"> |
836 | + <field name="commercial_partner_id" invisible="1"/> |
837 | + </field> |
838 | + </field> |
839 | + </record> |
840 | + <record model="ir.ui.view" id="view_picking_in_search"> |
841 | + <field name="model">stock.picking.in</field> |
842 | + <field name="inherit_id" ref="stock.view_picking_in_search"/> |
843 | + <field name="arch" type="xml"> |
844 | + <filter string="Journal" position="after"> |
845 | + <filter name="commercial_partner_id" string="Supplier Company" |
846 | + domain="[]" context="{'group_by': 'commercial_partner_id'}"/> |
847 | + </filter> |
848 | + </field> |
849 | + </record> |
850 | + </data> |
851 | +</openerp> |
852 | \ No newline at end of file |
I have deployed in production sale_report_company and purchase_ report_ company and they work well. Code is fine.