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
=== added directory 'salesteam_in_sale_report'
=== added file 'salesteam_in_sale_report/__init__.py'
--- salesteam_in_sale_report/__init__.py 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/__init__.py 2014-04-24 17:07:45 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import sale_report
024
=== added file 'salesteam_in_sale_report/__openerp__.py'
--- salesteam_in_sale_report/__openerp__.py 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/__openerp__.py 2014-04-24 17:07:45 +0000
@@ -0,0 +1,55 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Salesteam in Sale Report',
25 'version': '0.1',
26 'author': 'Savoir-faire Linux',
27 'maintainer': 'Savoir-faire Linux',
28 'website': 'http://www.savoirfairelinux.com',
29 'license': 'AGPL-3',
30 'category': 'Others',
31 'summary': 'Sales Report Group by Partner Category',
32 'description': """
33Salesteam in Sale Report
34========================
35
36This module adds the SalesTeam, Country, City and Zip grouping
37options for the Sales Analysis Report.
38
39
40Contributors
41------------
42* Vincent Vinet (vincent.vinet@savoirfairelinux.com)
43""",
44 'depends': [
45 'crm',
46 'sale_stock',
47 ],
48 'external_dependencies': {
49 'python': [],
50 },
51 'data': [
52 'report_groupby_data.xml',
53 ],
54 'installable': True,
55}
056
=== added directory 'salesteam_in_sale_report/i18n'
=== added file 'salesteam_in_sale_report/i18n/en.po'
--- salesteam_in_sale_report/i18n/en.po 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/i18n/en.po 2014-04-24 17:07:45 +0000
@@ -0,0 +1,58 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * cubep_sale_report_groupby
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-04-21 20:12+0000\n"
10"PO-Revision-Date: 2014-04-21 16:16-0500\n"
11"Last-Translator: Vincent Vinet <vincent.vinet@savoirfairelinux.com>\n"
12"Language-Team: Savoir-faire Linux\n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"Language: en\n"
18"X-Generator: Poedit 1.5.4\n"
19
20#. module: cubep_sale_report_groupby
21#: view:sale.report:0
22msgid "City"
23msgstr "City"
24
25#. module: cubep_sale_report_groupby
26#: field:sale.report,partner_zip:0
27msgid "Partner Zip"
28msgstr "Partner Zip"
29
30#. module: cubep_sale_report_groupby
31#: view:sale.report:0
32msgid "Zip"
33msgstr "Zip"
34
35#. module: cubep_sale_report_groupby
36#: view:sale.report:0
37msgid "Country"
38msgstr "Country"
39
40#. module: cubep_sale_report_groupby
41#: field:sale.report,partner_country_id:0
42msgid "Partner Country"
43msgstr "Partner Country"
44
45#. module: cubep_sale_report_groupby
46#: field:sale.report,partner_city:0
47msgid "Partner City"
48msgstr "Partner City"
49
50#. module: cubep_sale_report_groupby
51#: view:sale.report:0 field:sale.report,salesteam_id:0
52msgid "Sales Team"
53msgstr "Sales Team"
54
55#. module: cubep_sale_report_groupby
56#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
57msgid "Sales Orders Statistics"
58msgstr "Sales Orders Statistics"
059
=== added file 'salesteam_in_sale_report/i18n/fr.po'
--- salesteam_in_sale_report/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/i18n/fr.po 2014-04-24 17:07:45 +0000
@@ -0,0 +1,58 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * cubep_sale_report_groupby
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-04-21 20:12+0000\n"
10"PO-Revision-Date: 2014-04-21 16:18-0500\n"
11"Last-Translator: Vincent Vinet <vincent.vinet@savoirfairelinux.com>\n"
12"Language-Team: Savoir-faire Linux\n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"Language: fr\n"
18"X-Generator: Poedit 1.5.4\n"
19
20#. module: cubep_sale_report_groupby
21#: view:sale.report:0
22msgid "City"
23msgstr "Ville"
24
25#. module: cubep_sale_report_groupby
26#: field:sale.report,partner_zip:0
27msgid "Partner Zip"
28msgstr "Code postal du partenaire"
29
30#. module: cubep_sale_report_groupby
31#: view:sale.report:0
32msgid "Zip"
33msgstr "Code postal"
34
35#. module: cubep_sale_report_groupby
36#: view:sale.report:0
37msgid "Country"
38msgstr "Pays"
39
40#. module: cubep_sale_report_groupby
41#: field:sale.report,partner_country_id:0
42msgid "Partner Country"
43msgstr "Pays du partenaire"
44
45#. module: cubep_sale_report_groupby
46#: field:sale.report,partner_city:0
47msgid "Partner City"
48msgstr "Ville du partenaire"
49
50#. module: cubep_sale_report_groupby
51#: view:sale.report:0 field:sale.report,salesteam_id:0
52msgid "Sales Team"
53msgstr "Équipe commerciale"
54
55#. module: cubep_sale_report_groupby
56#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
57msgid "Sales Orders Statistics"
58msgstr "Analyse des ventes"
059
=== added file 'salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot'
--- salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/i18n/salesteam_in_sale_report.pot 2014-04-24 17:07:45 +0000
@@ -0,0 +1,58 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * cubep_sale_report_groupby
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-04-21 20:12+0000\n"
10"PO-Revision-Date: 2014-04-21 20:12+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: cubep_sale_report_groupby
19#: view:sale.report:0
20msgid "City"
21msgstr ""
22
23#. module: cubep_sale_report_groupby
24#: field:sale.report,partner_zip:0
25msgid "Partner Zip"
26msgstr ""
27
28#. module: cubep_sale_report_groupby
29#: view:sale.report:0
30msgid "Zip"
31msgstr ""
32
33#. module: cubep_sale_report_groupby
34#: view:sale.report:0
35msgid "Country"
36msgstr ""
37
38#. module: cubep_sale_report_groupby
39#: field:sale.report,partner_country_id:0
40msgid "Partner Country"
41msgstr ""
42
43#. module: cubep_sale_report_groupby
44#: field:sale.report,partner_city:0
45msgid "Partner City"
46msgstr ""
47
48#. module: cubep_sale_report_groupby
49#: view:sale.report:0
50#: field:sale.report,salesteam_id:0
51msgid "Sales Team"
52msgstr ""
53
54#. module: cubep_sale_report_groupby
55#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
56msgid "Sales Orders Statistics"
57msgstr ""
58
059
=== added file 'salesteam_in_sale_report/report_groupby_data.xml'
--- salesteam_in_sale_report/report_groupby_data.xml 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/report_groupby_data.xml 2014-04-24 17:07:45 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>
3 <data>
4 <record id="view_order_product_search" model="ir.ui.view">
5 <field name="name">sale.report.search</field>
6 <field name="model">sale.report</field>
7 <field name="inherit_id" ref="sale.view_order_product_search" />
8 <field name="arch" type="xml">
9 <xpath expr="//filter[@string='Partner']" position="after">
10 <filter string="Sales Team" name="Sales Teamy" context="{'group_by': 'salesteam_id'}" />
11 <filter string="Country" name="Customer Country" context="{'group_by': 'partner_country_id'}" />
12 <filter string="City" name="Customer City" context="{'group_by': 'partner_city'}" />
13 <filter string="Zip" name="Customer Zip" context="{'group_by': 'partner_zip'}" />
14 </xpath>
15 </field>
16 </record>
17 </data>
18</openerp>
019
=== added file 'salesteam_in_sale_report/sale_report.py'
--- salesteam_in_sale_report/sale_report.py 1970-01-01 00:00:00 +0000
+++ salesteam_in_sale_report/sale_report.py 2014-04-24 17:07:45 +0000
@@ -0,0 +1,77 @@
1# coding: utf-8
2
3from openerp import tools
4from openerp.osv import fields, orm
5
6
7class sale_report(orm.Model):
8 _inherit = 'sale.report'
9 _auto = False
10 _columns = {
11 'salesteam_id': fields.many2one('crm.case.section', 'Sales Team', readonly=True),
12 'partner_city': fields.char('Partner City', readonly=True),
13 'partner_zip': fields.char('Partner Zip', readonly=True),
14 'partner_country_id': fields.many2one('res.country', 'Partner Country', readonly=True),
15 }
16
17 def init(self, cr):
18 tools.drop_view_if_exists(cr, 'sale_report')
19 cr.execute("""
20 create or replace view sale_report as (
21 select
22 min(l.id) as id,
23 l.product_id as product_id,
24 t.uom_id as product_uom,
25 sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
26 sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
27 count(*) as nbr,
28 s.date_order as date,
29 s.date_confirm as date_confirm,
30 to_char(s.date_order, 'YYYY') as year,
31 to_char(s.date_order, 'MM') as month,
32 to_char(s.date_order, 'YYYY-MM-DD') as day,
33 s.partner_id as partner_id,
34 pr.country_id as partner_country_id,
35 pr.city as partner_city,
36 pr.zip as partner_zip,
37 s.user_id as user_id,
38 s.section_id as salesteam_id,
39 s.shop_id as shop_id,
40 s.company_id as company_id,
41 extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
42 s.state,
43 t.categ_id as categ_id,
44 s.shipped,
45 s.shipped::integer as shipped_qty_1,
46 s.pricelist_id as pricelist_id,
47 s.project_id as analytic_account_id
48 from
49 sale_order_line l
50 join sale_order s on (l.order_id=s.id)
51 left join product_product p on (l.product_id=p.id)
52 left join product_template t on (p.product_tmpl_id=t.id)
53 left join product_uom u on (u.id=l.product_uom)
54 left join product_uom u2 on (u2.id=t.uom_id)
55 left join res_partner pr on (s.partner_id=pr.id)
56 group by
57 l.product_id,
58 l.order_id,
59 t.uom_id,
60 t.categ_id,
61 s.date_order,
62 s.date_confirm,
63 s.partner_id,
64 pr.country_id,
65 pr.city,
66 pr.zip,
67 s.user_id,
68 s.section_id,
69 s.shop_id,
70 s.company_id,
71 s.state,
72 s.shipped,
73 s.pricelist_id,
74 s.project_id
75 )
76 """)
77sale_report()
078
=== added directory 'salesteam_in_sale_report/static'
=== added directory 'salesteam_in_sale_report/static/src'
=== added directory 'salesteam_in_sale_report/static/src/img'
=== added file 'salesteam_in_sale_report/static/src/img/icon.png'
1Binary 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 differ79Binary 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