Merge lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report into lp:~crm-core-editors/openerp-crm/7.0

Proposed by Vincent Vinet
Status: Needs review
Proposed branch: lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report
Merge into: lp:~crm-core-editors/openerp-crm/7.0
Diff against target: 389 lines (+347/-0)
7 files modified
salesteam_in_sale_report/__init__.py (+23/-0)
salesteam_in_sale_report/__openerp__.py (+55/-0)
salesteam_in_sale_report/i18n/en.po (+58/-0)
salesteam_in_sale_report/i18n/fr.po (+58/-0)
salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot (+58/-0)
salesteam_in_sale_report/report_groupby_data.xml (+18/-0)
salesteam_in_sale_report/sale_report.py (+77/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Needs Resubmitting
Review via email: mp+216627@code.launchpad.net

Description of the change

Hello,

This branch adds the salesteam_in_sale_report module.

The module changes the sales analysis report to allow grouping by:
- Salesteam
- Partner Country, City and Zip

To post a comment you must log in.
6. By Vincent Vinet

add missing crm dependency for section_id

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

This project is now hosted on https://github.com/OCA/crm. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

6. By Vincent Vinet

add missing crm dependency for section_id

5. By Vincent Vinet

[ADD] salesteam in sale report addon

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'salesteam_in_sale_report'
2=== added file 'salesteam_in_sale_report/__init__.py'
3--- salesteam_in_sale_report/__init__.py 1970-01-01 00:00:00 +0000
4+++ salesteam_in_sale_report/__init__.py 2014-04-24 17:07:45 +0000
5@@ -0,0 +1,23 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
11+# (<http://www.savoirfairelinux.com>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+from . import sale_report
29
30=== added file 'salesteam_in_sale_report/__openerp__.py'
31--- salesteam_in_sale_report/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ salesteam_in_sale_report/__openerp__.py 2014-04-24 17:07:45 +0000
33@@ -0,0 +1,55 @@
34+# -*- encoding: utf-8 -*-
35+##############################################################################
36+#
37+# OpenERP, Open Source Management Solution
38+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
39+# (<http://www.savoirfairelinux.com>).
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+
56+{
57+ 'name': 'Salesteam in Sale Report',
58+ 'version': '0.1',
59+ 'author': 'Savoir-faire Linux',
60+ 'maintainer': 'Savoir-faire Linux',
61+ 'website': 'http://www.savoirfairelinux.com',
62+ 'license': 'AGPL-3',
63+ 'category': 'Others',
64+ 'summary': 'Sales Report Group by Partner Category',
65+ 'description': """
66+Salesteam in Sale Report
67+========================
68+
69+This module adds the SalesTeam, Country, City and Zip grouping
70+options for the Sales Analysis Report.
71+
72+
73+Contributors
74+------------
75+* Vincent Vinet (vincent.vinet@savoirfairelinux.com)
76+""",
77+ 'depends': [
78+ 'crm',
79+ 'sale_stock',
80+ ],
81+ 'external_dependencies': {
82+ 'python': [],
83+ },
84+ 'data': [
85+ 'report_groupby_data.xml',
86+ ],
87+ 'installable': True,
88+}
89
90=== added directory 'salesteam_in_sale_report/i18n'
91=== added file 'salesteam_in_sale_report/i18n/en.po'
92--- salesteam_in_sale_report/i18n/en.po 1970-01-01 00:00:00 +0000
93+++ salesteam_in_sale_report/i18n/en.po 2014-04-24 17:07:45 +0000
94@@ -0,0 +1,58 @@
95+# Translation of OpenERP Server.
96+# This file contains the translation of the following modules:
97+# * cubep_sale_report_groupby
98+#
99+msgid ""
100+msgstr ""
101+"Project-Id-Version: OpenERP Server 7.0\n"
102+"Report-Msgid-Bugs-To: \n"
103+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
104+"PO-Revision-Date: 2014-04-21 16:16-0500\n"
105+"Last-Translator: Vincent Vinet <vincent.vinet@savoirfairelinux.com>\n"
106+"Language-Team: Savoir-faire Linux\n"
107+"MIME-Version: 1.0\n"
108+"Content-Type: text/plain; charset=UTF-8\n"
109+"Content-Transfer-Encoding: 8bit\n"
110+"Plural-Forms: \n"
111+"Language: en\n"
112+"X-Generator: Poedit 1.5.4\n"
113+
114+#. module: cubep_sale_report_groupby
115+#: view:sale.report:0
116+msgid "City"
117+msgstr "City"
118+
119+#. module: cubep_sale_report_groupby
120+#: field:sale.report,partner_zip:0
121+msgid "Partner Zip"
122+msgstr "Partner Zip"
123+
124+#. module: cubep_sale_report_groupby
125+#: view:sale.report:0
126+msgid "Zip"
127+msgstr "Zip"
128+
129+#. module: cubep_sale_report_groupby
130+#: view:sale.report:0
131+msgid "Country"
132+msgstr "Country"
133+
134+#. module: cubep_sale_report_groupby
135+#: field:sale.report,partner_country_id:0
136+msgid "Partner Country"
137+msgstr "Partner Country"
138+
139+#. module: cubep_sale_report_groupby
140+#: field:sale.report,partner_city:0
141+msgid "Partner City"
142+msgstr "Partner City"
143+
144+#. module: cubep_sale_report_groupby
145+#: view:sale.report:0 field:sale.report,salesteam_id:0
146+msgid "Sales Team"
147+msgstr "Sales Team"
148+
149+#. module: cubep_sale_report_groupby
150+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
151+msgid "Sales Orders Statistics"
152+msgstr "Sales Orders Statistics"
153
154=== added file 'salesteam_in_sale_report/i18n/fr.po'
155--- salesteam_in_sale_report/i18n/fr.po 1970-01-01 00:00:00 +0000
156+++ salesteam_in_sale_report/i18n/fr.po 2014-04-24 17:07:45 +0000
157@@ -0,0 +1,58 @@
158+# Translation of OpenERP Server.
159+# This file contains the translation of the following modules:
160+# * cubep_sale_report_groupby
161+#
162+msgid ""
163+msgstr ""
164+"Project-Id-Version: OpenERP Server 7.0\n"
165+"Report-Msgid-Bugs-To: \n"
166+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
167+"PO-Revision-Date: 2014-04-21 16:18-0500\n"
168+"Last-Translator: Vincent Vinet <vincent.vinet@savoirfairelinux.com>\n"
169+"Language-Team: Savoir-faire Linux\n"
170+"MIME-Version: 1.0\n"
171+"Content-Type: text/plain; charset=UTF-8\n"
172+"Content-Transfer-Encoding: 8bit\n"
173+"Plural-Forms: \n"
174+"Language: fr\n"
175+"X-Generator: Poedit 1.5.4\n"
176+
177+#. module: cubep_sale_report_groupby
178+#: view:sale.report:0
179+msgid "City"
180+msgstr "Ville"
181+
182+#. module: cubep_sale_report_groupby
183+#: field:sale.report,partner_zip:0
184+msgid "Partner Zip"
185+msgstr "Code postal du partenaire"
186+
187+#. module: cubep_sale_report_groupby
188+#: view:sale.report:0
189+msgid "Zip"
190+msgstr "Code postal"
191+
192+#. module: cubep_sale_report_groupby
193+#: view:sale.report:0
194+msgid "Country"
195+msgstr "Pays"
196+
197+#. module: cubep_sale_report_groupby
198+#: field:sale.report,partner_country_id:0
199+msgid "Partner Country"
200+msgstr "Pays du partenaire"
201+
202+#. module: cubep_sale_report_groupby
203+#: field:sale.report,partner_city:0
204+msgid "Partner City"
205+msgstr "Ville du partenaire"
206+
207+#. module: cubep_sale_report_groupby
208+#: view:sale.report:0 field:sale.report,salesteam_id:0
209+msgid "Sales Team"
210+msgstr "Équipe commerciale"
211+
212+#. module: cubep_sale_report_groupby
213+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
214+msgid "Sales Orders Statistics"
215+msgstr "Analyse des ventes"
216
217=== added file 'salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot'
218--- salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot 1970-01-01 00:00:00 +0000
219+++ salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot 2014-04-24 17:07:45 +0000
220@@ -0,0 +1,58 @@
221+# Translation of OpenERP Server.
222+# This file contains the translation of the following modules:
223+# * cubep_sale_report_groupby
224+#
225+msgid ""
226+msgstr ""
227+"Project-Id-Version: OpenERP Server 7.0\n"
228+"Report-Msgid-Bugs-To: \n"
229+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
230+"PO-Revision-Date: 2014-04-21 20:12+0000\n"
231+"Last-Translator: <>\n"
232+"Language-Team: \n"
233+"MIME-Version: 1.0\n"
234+"Content-Type: text/plain; charset=UTF-8\n"
235+"Content-Transfer-Encoding: \n"
236+"Plural-Forms: \n"
237+
238+#. module: cubep_sale_report_groupby
239+#: view:sale.report:0
240+msgid "City"
241+msgstr ""
242+
243+#. module: cubep_sale_report_groupby
244+#: field:sale.report,partner_zip:0
245+msgid "Partner Zip"
246+msgstr ""
247+
248+#. module: cubep_sale_report_groupby
249+#: view:sale.report:0
250+msgid "Zip"
251+msgstr ""
252+
253+#. module: cubep_sale_report_groupby
254+#: view:sale.report:0
255+msgid "Country"
256+msgstr ""
257+
258+#. module: cubep_sale_report_groupby
259+#: field:sale.report,partner_country_id:0
260+msgid "Partner Country"
261+msgstr ""
262+
263+#. module: cubep_sale_report_groupby
264+#: field:sale.report,partner_city:0
265+msgid "Partner City"
266+msgstr ""
267+
268+#. module: cubep_sale_report_groupby
269+#: view:sale.report:0
270+#: field:sale.report,salesteam_id:0
271+msgid "Sales Team"
272+msgstr ""
273+
274+#. module: cubep_sale_report_groupby
275+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
276+msgid "Sales Orders Statistics"
277+msgstr ""
278+
279
280=== added file 'salesteam_in_sale_report/report_groupby_data.xml'
281--- salesteam_in_sale_report/report_groupby_data.xml 1970-01-01 00:00:00 +0000
282+++ salesteam_in_sale_report/report_groupby_data.xml 2014-04-24 17:07:45 +0000
283@@ -0,0 +1,18 @@
284+<?xml version="1.0" encoding="UTF-8"?>
285+<openerp>
286+ <data>
287+ <record id="view_order_product_search" model="ir.ui.view">
288+ <field name="name">sale.report.search</field>
289+ <field name="model">sale.report</field>
290+ <field name="inherit_id" ref="sale.view_order_product_search" />
291+ <field name="arch" type="xml">
292+ <xpath expr="//filter[@string='Partner']" position="after">
293+ <filter string="Sales Team" name="Sales Teamy" context="{'group_by': 'salesteam_id'}" />
294+ <filter string="Country" name="Customer Country" context="{'group_by': 'partner_country_id'}" />
295+ <filter string="City" name="Customer City" context="{'group_by': 'partner_city'}" />
296+ <filter string="Zip" name="Customer Zip" context="{'group_by': 'partner_zip'}" />
297+ </xpath>
298+ </field>
299+ </record>
300+ </data>
301+</openerp>
302
303=== added file 'salesteam_in_sale_report/sale_report.py'
304--- salesteam_in_sale_report/sale_report.py 1970-01-01 00:00:00 +0000
305+++ salesteam_in_sale_report/sale_report.py 2014-04-24 17:07:45 +0000
306@@ -0,0 +1,77 @@
307+# coding: utf-8
308+
309+from openerp import tools
310+from openerp.osv import fields, orm
311+
312+
313+class sale_report(orm.Model):
314+ _inherit = 'sale.report'
315+ _auto = False
316+ _columns = {
317+ 'salesteam_id': fields.many2one('crm.case.section', 'Sales Team', readonly=True),
318+ 'partner_city': fields.char('Partner City', readonly=True),
319+ 'partner_zip': fields.char('Partner Zip', readonly=True),
320+ 'partner_country_id': fields.many2one('res.country', 'Partner Country', readonly=True),
321+ }
322+
323+ def init(self, cr):
324+ tools.drop_view_if_exists(cr, 'sale_report')
325+ cr.execute("""
326+ create or replace view sale_report as (
327+ select
328+ min(l.id) as id,
329+ l.product_id as product_id,
330+ t.uom_id as product_uom,
331+ sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
332+ sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
333+ count(*) as nbr,
334+ s.date_order as date,
335+ s.date_confirm as date_confirm,
336+ to_char(s.date_order, 'YYYY') as year,
337+ to_char(s.date_order, 'MM') as month,
338+ to_char(s.date_order, 'YYYY-MM-DD') as day,
339+ s.partner_id as partner_id,
340+ pr.country_id as partner_country_id,
341+ pr.city as partner_city,
342+ pr.zip as partner_zip,
343+ s.user_id as user_id,
344+ s.section_id as salesteam_id,
345+ s.shop_id as shop_id,
346+ s.company_id as company_id,
347+ extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
348+ s.state,
349+ t.categ_id as categ_id,
350+ s.shipped,
351+ s.shipped::integer as shipped_qty_1,
352+ s.pricelist_id as pricelist_id,
353+ s.project_id as analytic_account_id
354+ from
355+ sale_order_line l
356+ join sale_order s on (l.order_id=s.id)
357+ left join product_product p on (l.product_id=p.id)
358+ left join product_template t on (p.product_tmpl_id=t.id)
359+ left join product_uom u on (u.id=l.product_uom)
360+ left join product_uom u2 on (u2.id=t.uom_id)
361+ left join res_partner pr on (s.partner_id=pr.id)
362+ group by
363+ l.product_id,
364+ l.order_id,
365+ t.uom_id,
366+ t.categ_id,
367+ s.date_order,
368+ s.date_confirm,
369+ s.partner_id,
370+ pr.country_id,
371+ pr.city,
372+ pr.zip,
373+ s.user_id,
374+ s.section_id,
375+ s.shop_id,
376+ s.company_id,
377+ s.state,
378+ s.shipped,
379+ s.pricelist_id,
380+ s.project_id
381+ )
382+ """)
383+sale_report()
384
385=== added directory 'salesteam_in_sale_report/static'
386=== added directory 'salesteam_in_sale_report/static/src'
387=== added directory 'salesteam_in_sale_report/static/src/img'
388=== added file 'salesteam_in_sale_report/static/src/img/icon.png'
389Binary files salesteam_in_sale_report/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and salesteam_in_sale_report/static/src/img/icon.png 2014-04-24 17:07:45 +0000 differ

Subscribers

People subscribed via source and target branches