← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report into lp:openerp-crm

 

Vincent Vinet has proposed merging lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report into lp:openerp-crm.

Requested reviews:
  OpenERP CRM Core Editors (crm-core-editors)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report/+merge/216627

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

-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report/+merge/216627
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openerp-crm/salesteam_in_sale_report.
=== 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-21 20:38:03 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2010 - 2014 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import sale_report

=== 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-21 20:38:03 +0000
@@ -0,0 +1,54 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2010 - 2014 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    'name': 'Salesteam in Sale Report',
+    'version': '0.1',
+    'author': 'Savoir-faire Linux',
+    'maintainer': 'Savoir-faire Linux',
+    'website': 'http://www.savoirfairelinux.com',
+    'license': 'AGPL-3',
+    'category': 'Others',
+    'summary': 'Sales Report Group by Partner Category',
+    'description': """
+Salesteam in Sale Report
+========================
+
+This module adds the SalesTeam, Country, City and Zip grouping
+options for the Sales Analysis Report.
+
+
+Contributors
+------------
+* Vincent Vinet (vincent.vinet@xxxxxxxxxxxxxxxxxxxx)
+""",
+    'depends': [
+        'sale_stock',
+    ],
+    'external_dependencies': {
+        'python': [],
+    },
+    'data': [
+        'report_groupby_data.xml',
+    ],
+    'installable': True,
+}

=== 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-21 20:38:03 +0000
@@ -0,0 +1,58 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* cubep_sale_report_groupby
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
+"PO-Revision-Date: 2014-04-21 16:16-0500\n"
+"Last-Translator: Vincent Vinet <vincent.vinet@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: Savoir-faire Linux\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: en\n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "City"
+msgstr "City"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_zip:0
+msgid "Partner Zip"
+msgstr "Partner Zip"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Zip"
+msgstr "Zip"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Country"
+msgstr "Country"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_country_id:0
+msgid "Partner Country"
+msgstr "Partner Country"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_city:0
+msgid "Partner City"
+msgstr "Partner City"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0 field:sale.report,salesteam_id:0
+msgid "Sales Team"
+msgstr "Sales Team"
+
+#. module: cubep_sale_report_groupby
+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
+msgid "Sales Orders Statistics"
+msgstr "Sales Orders Statistics"

=== 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-21 20:38:03 +0000
@@ -0,0 +1,58 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* cubep_sale_report_groupby
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
+"PO-Revision-Date: 2014-04-21 16:18-0500\n"
+"Last-Translator: Vincent Vinet <vincent.vinet@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: Savoir-faire Linux\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: fr\n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "City"
+msgstr "Ville"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_zip:0
+msgid "Partner Zip"
+msgstr "Code postal du partenaire"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Zip"
+msgstr "Code postal"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Country"
+msgstr "Pays"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_country_id:0
+msgid "Partner Country"
+msgstr "Pays du partenaire"
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_city:0
+msgid "Partner City"
+msgstr "Ville du partenaire"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0 field:sale.report,salesteam_id:0
+msgid "Sales Team"
+msgstr "Équipe commerciale"
+
+#. module: cubep_sale_report_groupby
+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
+msgid "Sales Orders Statistics"
+msgstr "Analyse des ventes"

=== 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-21 20:38:03 +0000
@@ -0,0 +1,58 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* cubep_sale_report_groupby
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-21 20:12+0000\n"
+"PO-Revision-Date: 2014-04-21 20:12+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "City"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_zip:0
+msgid "Partner Zip"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Zip"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+msgid "Country"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_country_id:0
+msgid "Partner Country"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: field:sale.report,partner_city:0
+msgid "Partner City"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: view:sale.report:0
+#: field:sale.report,salesteam_id:0
+msgid "Sales Team"
+msgstr ""
+
+#. module: cubep_sale_report_groupby
+#: model:ir.model,name:cubep_sale_report_groupby.model_sale_report
+msgid "Sales Orders Statistics"
+msgstr ""
+

=== 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-21 20:38:03 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+    <record id="view_order_product_search" model="ir.ui.view">
+      <field name="name">sale.report.search</field>
+      <field name="model">sale.report</field>
+      <field name="inherit_id" ref="sale.view_order_product_search" />
+      <field name="arch" type="xml">
+        <xpath expr="//filter[@string='Partner']" position="after">
+          <filter string="Sales Team" name="Sales Teamy" context="{'group_by': 'salesteam_id'}" />
+          <filter string="Country" name="Customer Country" context="{'group_by': 'partner_country_id'}" />
+          <filter string="City" name="Customer City" context="{'group_by': 'partner_city'}" />
+          <filter string="Zip" name="Customer Zip" context="{'group_by': 'partner_zip'}" />
+        </xpath>
+      </field>
+    </record>
+  </data>
+</openerp>

=== 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-21 20:38:03 +0000
@@ -0,0 +1,77 @@
+# coding: utf-8
+
+from openerp import tools
+from openerp.osv import fields, orm
+
+
+class sale_report(orm.Model):
+    _inherit = 'sale.report'
+    _auto = False
+    _columns = {
+        'salesteam_id': fields.many2one('crm.case.section', 'Sales Team', readonly=True),
+        'partner_city': fields.char('Partner City', readonly=True),
+        'partner_zip': fields.char('Partner Zip', readonly=True),
+        'partner_country_id': fields.many2one('res.country', 'Partner Country', readonly=True),
+    }
+
+    def init(self, cr):
+        tools.drop_view_if_exists(cr, 'sale_report')
+        cr.execute("""
+            create or replace view sale_report as (
+                select
+                    min(l.id) as id,
+                    l.product_id as product_id,
+                    t.uom_id as product_uom,
+                    sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
+                    sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
+                    count(*) as nbr,
+                    s.date_order as date,
+                    s.date_confirm as date_confirm,
+                    to_char(s.date_order, 'YYYY') as year,
+                    to_char(s.date_order, 'MM') as month,
+                    to_char(s.date_order, 'YYYY-MM-DD') as day,
+                    s.partner_id as partner_id,
+                    pr.country_id as partner_country_id,
+                    pr.city as partner_city,
+                    pr.zip as partner_zip,
+                    s.user_id as user_id,
+                    s.section_id as salesteam_id,
+                    s.shop_id as shop_id,
+                    s.company_id as company_id,
+                    extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
+                    s.state,
+                    t.categ_id as categ_id,
+                    s.shipped,
+                    s.shipped::integer as shipped_qty_1,
+                    s.pricelist_id as pricelist_id,
+                    s.project_id as analytic_account_id
+                from
+                    sale_order_line l
+                      join sale_order s on (l.order_id=s.id)
+                         left join product_product p on (l.product_id=p.id)
+                            left join product_template t on (p.product_tmpl_id=t.id)
+                    left join product_uom u on (u.id=l.product_uom)
+                    left join product_uom u2 on (u2.id=t.uom_id)
+                    left join res_partner pr on (s.partner_id=pr.id)
+                group by
+                    l.product_id,
+                    l.order_id,
+                    t.uom_id,
+                    t.categ_id,
+                    s.date_order,
+                    s.date_confirm,
+                    s.partner_id,
+                    pr.country_id,
+                    pr.city,
+                    pr.zip,
+                    s.user_id,
+                    s.section_id,
+                    s.shop_id,
+                    s.company_id,
+                    s.state,
+                    s.shipped,
+                    s.pricelist_id,
+                    s.project_id
+            )
+        """)
+sale_report()

=== 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'
Binary 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-21 20:38:03 +0000 differ

Follow ups