Browse Source

Modulo report_gral

sebas 8 years ago
commit
91842d406a

+ 29 - 0
__init__.py

@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_brand for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.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/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product Brand is an Openobject module wich enable Brand management for products #
+###################################################################################
+from . import report_gralventa
+from . import report
+import math

BIN
__init__.pyc


+ 52 - 0
__openerp__.py

@@ -0,0 +1,52 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_features for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.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/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product features is an Openobject module wich enable features management for products #
+###################################################################################
+{
+    'name': 'Listado General de Ventas',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Listado General de Ventas
+========================================
+
+Modulo creado para el analisis de ventas normales (sale) cuenta con filtros de marca product_brand, categoria, compañia, producto, cliente, vendedor, estado, fecha,
+tambien incluye los totales y subtotales.
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com.py',
+	'depends': ['sale','sales_team','account_voucher', 'procurement', 'report'],
+    'data': [
+		'informe_venta_general_view.xml',
+		'report/informe_ventagral_view.xml',
+		'informe_venta_por_fecha.xml',
+		'informe_venta_por_categoria.xml',
+		'informe_ventagralxcliente.xml',
+		'ventagral_filter_view.xml',
+		'ventagral_report.xml',
+    ],
+    'installable': True,
+}

+ 87 - 0
informe_venta_general_view.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="report_ventagral">
+			<t t-call="report.html_container">
+				<t t-call="report.external_layout">
+					<div class="page">
+						<style type="text/css">
+							.crm_tcab{
+							font-size: 3mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.crm_tbody{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.logo1{
+							width: 100%;
+							top: 1.5cm;
+							}
+
+							.total1{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+						</style>
+						<h4 class="text-center">Listado de ventas por producto</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Producto</th>
+									<th class="text-right">Precio Unit.</th>
+									<th class="text-right">Cantidad</th>
+									<th class="text-right">Sub Total</th>
+									<th class="text-right">Fecha</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td>
+											<span t-field="o.product_id"/>
+										</td>
+										<td class="text-right">
+											<span t-esc="o.price_unit"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.product_uom_qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.date"/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+
+							<tr>
+								<td colspan="5"></td>
+							</tr>
+							<tr class="border-black">
+									<td colspan="2">Total:</td>
+											<td class="text-right">
+																<t t-set="total" t-value="sum([x.product_uom_qty for x in docs])"/>
+																	<span t-esc="total"/>
+											</td>
+											<td class="text-right">
+																					<t t-set="total1" t-value="sum([r.price_total for r in docs])"/>
+																					<span t-esc="total1"/>
+											</td>
+								</tr>
+
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 82 - 0
informe_venta_por_categoria.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="informe_venta_por_categoria">
+			<t t-call="report.html_container">
+				<t t-call="report.external_layout">
+					<div class="page">
+						<style type="text/css">
+							.crm_tcab{
+							font-size: 3mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.crm_tbody{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.logo1{
+							width: 100%;
+							top: 1.5cm;
+							}
+
+							.total1{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+						</style>
+						<h4 class="text-center">Listado de ventas por categoria</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Producto</th>
+									<th class="text-left">Categoria</th>
+									<th class="text-center">Cantidad</th>
+									<th class="text-right">Sub Total</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td class="text-left">
+											<span t-esc="o.product_id.name"/>
+										</td>
+										<td class="text-left">
+											<span t-field="o.product_categ_id"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.product_uom_qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+							           <tr>
+                                <td colspan="4"></td>
+                            </tr>
+                            <tr class="border-black">
+                                <td colspan="2">Total:</td>
+								                <td class="text-right">
+                                    <t t-set="total" t-value="sum([x.product_uom_qty for x in docs])"/>
+                                    <span t-esc="total"/>
+                                </td>
+																<td class="text-right">
+																<t t-set="total1" t-value="sum([r.product_qty for r in docs])"/>
+																<span t-esc="total1"/>
+																</td>
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 88 - 0
informe_venta_por_fecha.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="informe_venta_por_fecha">
+			<t t-call="report.html_container">
+				<t t-call="report.external_layout">
+					<div class="page">
+						<style type="text/css">
+							.crm_tcab{
+							font-size: 3mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.crm_tbody{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.logo1{
+							width: 100%;
+							top: 1.5cm;
+							}
+
+							.total1{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+						</style>
+						<h4 class="text-center">Listado de ventas por fecha</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Fecha</th>
+									<th>Cliente</th>
+									<th>Producto</th>
+									<th class="text-center">Cantidad</th>
+									<th class="text-right">Sub Total</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td>
+											<span t-field="o.date" t-field-options='{"widget": "date"}'/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.partner_id.name"/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.product_id.name"/>
+										</td>
+										<td class="text-center">
+											<span t-field="o.product_uom_qty" sum="# of Qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+
+							<tr>
+								<td colspan="5"></td>
+							</tr>
+							<tr class="border-black">
+									<td colspan="2">Total:</td>
+								      <td class="text-right">
+																<t t-set="total" t-value="sum([x.product_uom_qty for x in docs])"/>
+																	<span t-esc="total"/>
+									    </td>
+											<td class="text-right">
+			                                    <t t-set="total1" t-value="sum([r.price_total for r in docs])"/>
+			                                    <span t-esc="total1"/>
+			                </td>
+						    </tr>
+
+
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 80 - 0
informe_ventagralxcliente.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="report_ventagralxcliente">
+			<t t-call="report.html_container">
+				<t t-call="report.external_layout">
+					<div class="page">
+						<style type="text/css">
+							.crm_tcab{
+							font-size: 3mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.crm_tbody{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+							.logo1{
+							width: 100%;
+							top: 1.5cm;
+							}
+
+							.total1{
+							font-size: 2.8mm;
+							font-family: Arial, Helvetica, sans-serif;
+							}
+
+						</style>
+						<h4 class="text-center">Listado de ventas por cliente</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Cliente</th>
+									<th class="text-center">Cantidad</th>
+									<th class="text-right">Sub Total</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td>
+											<span t-field="o.partner_id"/>
+										</td>
+										<td class="text-center">
+											<span t-field="o.product_uom_qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+
+							<tr>
+							 <td colspan="3"></td>
+						 </tr>
+						 <tr class="border-black">
+								 <td colspan="1">Total:</td>
+										 <td class="text-right">
+															 <t t-set="total" t-value="sum([x.product_uom_qty for x in docs])"/>
+																 <span t-esc="total"/>
+										 </td>
+										 <td class="text-right">
+																				 <t t-set="total1" t-value="sum([r.price_total for r in docs])"/>
+																				 <span t-esc="total1"/>
+										 </td>
+							 </tr>
+
+
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 24 - 0
report/__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+import report_gral
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/__init__.pyc


+ 37 - 0
report/informe_ventagral_view.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="report_gral_tree_view" model="ir.ui.view">
+            <field name="name">report.gral.tree.view</field>
+            <field name="model">sale.reportgral</field>
+            <field name="priority" eval="20"/>
+            <field name="arch" type="xml">
+                <tree string="Listado General de Ventas" create="false">
+					<field name="id" invisible="1"/>
+					<field name="date"/>
+					<field name="user_id" invisible="1"/>
+					<field name="company_id" invisible="1" group="base.group_multi_company"/>
+					<field name="partner_id" invisible="1"/>
+					<field name="product_id" string="Producto"/>
+					<field name="product_categ_id" invisible="1"/>
+					<field name="nbr" sum="# of Lines" invisible="1"/>
+          <field name="price_unit" string="Precio Unit."/>
+					<field name="product_uom_qty" sum="# of Qty" string="Cantidad"/>
+					<field name="product_uom" invisible="1"/>
+					<field name="price_total" sum="Total" string="Total"/>
+					<field name="state" invisible="1"/>
+				</tree>
+            </field>
+        </record>
+
+		<record id="action_report_gral_tree_view" model="ir.actions.act_window">
+            <field name="name">Listado General de Ventas</field>
+            <field name="res_model">sale.reportgral</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree</field>
+        </record>
+
+	  <menuitem action="action_report_gral_tree_view" name="Listado General de Ventas" id="venta_gral_menu" parent="base.next_id_64" sequence="10"/>
+
+	</data>
+</openerp>

+ 138 - 0
report/report_gral.py

@@ -0,0 +1,138 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 openerp import tools
+from openerp.osv import fields, osv
+
+class sale_reportgral(osv.osv):
+    _name = "sale.reportgral"
+    _description = "Listado General de Ventas"
+    _auto = False
+    _rec_name = 'date'
+
+    _columns = {
+        'date': fields.datetime('Fecha de Orden', readonly=True),  # TDE FIXME master: rename into date_order
+        'date_confirm': fields.date('Fecha Confirmada', readonly=True),
+        'product_id': fields.many2one('product.product', 'Producto', readonly=True),
+        'product_uom': fields.many2one('product.uom', 'Unidad de Medida', readonly=True),
+        'product_uom_qty': fields.float('# de Cant.', readonly=True),
+        'product_brand_id':fields.many2one('product.brand', 'Marca', readonly=True),
+        'partner_id': fields.many2one('res.partner', 'Cliente', readonly=True),
+        'warehouse_id': fields.many2one('stock.warehouse', 'Sucursal',  readonly=True),
+        'city_id': fields.many2one('res.country.state', 'City', readonly=True),
+        'city': fields.char('Ciudad', readonly=True),
+        'company_id': fields.many2one('res.company', 'Compania', readonly=True),
+        'user_id': fields.many2one('res.users', 'Vendedor', readonly=True),
+        'price_unit': fields.float('Precio Unit', readonly=True),
+        'price_total': fields.float('Precio Total', readonly=True),
+        'delay': fields.float('Retraso', digits=(16,2), readonly=True),
+        'product_categ_id': fields.many2one('product.category', 'Categoria', readonly=True),
+        'nbr': fields.integer('# de Lineas', readonly=True),  # TDE FIXME master: rename into nbr_lines
+        'state': fields.selection([
+            ('draft', 'Borrador'),
+            ('waiting_date', 'Lista de espera'),
+            ('manual', 'Manual En Progreso'),
+            ('progress', 'En Progreso'),
+            ('invoice_except', 'Excepción factura'),
+            ('done', 'Realizado'),
+            ('cancel', 'Cancelado')
+            ], 'Order Status', readonly=True),
+        'pricelist_id': fields.many2one('product.pricelist', 'Lista de Precio', readonly=True),
+        'analytic_account_id': fields.many2one('account.analytic.account', 'Cuenta Analtica', readonly=True),
+        'section_id': fields.many2one('crm.case.section', 'Seccion'),
+    }
+    _order = 'date desc'
+
+    def _select(self):
+        select_str1 = """
+             SELECT min(l.id) as id,
+                    l.product_id as product_id,
+                    t.uom_id as product_uom,
+                    l.price_unit as price_unit,
+                    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,
+                    s.partner_id as partner_id,
+                    q.id as city_id,
+                    h.name as city,
+                    s.user_id as user_id,
+                    s.company_id as company_id,
+                    s.warehouse_id as warehouse_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 product_categ_id,
+                    t.product_brand_id as product_brand_id,
+                    s.pricelist_id as pricelist_id,
+                    s.project_id as analytic_account_id,
+                    s.section_id as section_id
+        """
+        return select_str1
+
+    def _from(self):
+        from_str1 = """
+                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_brand r on (t.product_brand_id=r.id)
+                    left join res_partner q on (q.id=s.partner_id)
+                    left join res_country_state h on (h.id=q.state_id)
+                    left join stock_warehouse j on (s.warehouse_id=j.id)
+                    left join product_uom u on (u.id=l.product_uom)
+                    left join product_uom u2 on (u2.id=t.uom_id)
+        """
+        return from_str1
+
+    def _group_by(self):
+        group_by_str1 = """
+            GROUP BY l.product_id,
+                    l.order_id,
+                    t.uom_id,
+                    t.categ_id,
+                    l.price_unit,
+                    s.date_order,
+                    q.id,
+                    h.name,
+                    s.date_confirm,
+                    s.partner_id,
+                    s.user_id,
+                    s.company_id,
+                    s.warehouse_id,
+                    s.state,
+                    s.pricelist_id,
+                    t.product_brand_id,
+                    s.project_id,
+                    s.section_id
+        """
+        return group_by_str1
+
+    def init(self, cr):
+        # self._table = sale_report
+        tools.drop_view_if_exists(cr, self._table)
+        cr.execute("""CREATE or REPLACE VIEW %s as (
+            %s
+            FROM ( %s )
+            %s
+            )""" % (self._table, self._select(), self._from(), self._group_by()))
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/report_gral.pyc


+ 55 - 0
report_gralventa.py

@@ -0,0 +1,55 @@
+#    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 datetime import datetime, timedelta
+import time
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
+import openerp.addons.decimal_precision as dp
+from openerp import workflow
+
+# class product_product(osv.Model):
+    # _inherit = 'product.product'
+
+    # def _sales_count(self, cr, uid, ids, field_name, arg, context=None):
+        # SaleOrderLine = self.pool['sale.order.line']
+        # return {
+            # product_id: SaleOrderLine.search_count(cr,uid, [('product_id', '=', product_id)], context=context)
+            # for product_id in ids
+        # }
+
+    # _columns = {
+        # 'sales_count': fields.function(_sales_count, string='# Sales', type='integer'),
+
+    # }
+
+# class product_template(osv.Model):
+    # _inherit = 'product.template'
+
+    # def _sales_count(self, cr, uid, ids, field_name, arg, context=None):
+        # res = dict.fromkeys(ids, 0)
+        # for template in self.browse(cr, uid, ids, context=context):
+            # res[template.id] = sum([p.sales_count for p in template.product_variant_ids])
+        # return res
+    
+    # def action_view_sales(self, cr, uid, ids, context=None):
+        # act_obj = self.pool.get('ir.actions.act_window')
+        # mod_obj = self.pool.get('ir.model.data')
+        # product_ids = []
+        # for template in self.browse(cr, uid, ids, context=context):
+            # product_ids += [x.id for x in template.product_variant_ids]
+        # result = mod_obj.xmlid_to_res_id(cr, uid, 'sale.action_order_line_product_tree',raise_if_not_found=True)
+        # result = act_obj.read(cr, uid, [result], context=context)[0]
+        # result['domain'] = "[('product_id','in',[" + ','.join(map(str, product_ids)) + "])]"
+        # return result
+    
+    
+    # _columns = {
+        # 'sales_count': fields.function(_sales_count, string='# Sales', type='integer'),
+
+    # }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report_gralventa.pyc


BIN
static/description/icon.png


+ 125 - 0
ventagral_filter_view.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <!-- Custom reports (aka filters) -->
+    <record id="filter_sale_report_sales_funnel1" model="ir.filters">
+        <field name="name">Canal de Ventas</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="domain">['&amp;', ('date','&lt;=', time.strftime('%%Y-12-31')), '&amp;', ('date','&gt;=',time.strftime('%%Y-01-01')), '|', ('state','in',('draft','sent')), ('state','not in',('draft','sent','cancel'))]</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['state'], 'measures': ['price_total']}</field>
+    </record>
+    <record id="filter_sale_report_salespersons1" model="ir.filters">
+        <field name="name">Por Vendedores</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'user_id']}</field>
+    </record>
+    <record id="filter_sale_report_salesteam1" model="ir.filters">
+        <field name="name">Por equipo de ventas</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'section_id']}</field>
+    </record>
+    <record id="filter_sale_report_product1" model="ir.filters">
+        <field name="name">Por Mes Producto</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'product_id']}</field>
+    </record>
+
+    <record id="filter_ventan_report_partner1" model="ir.filters">
+          <field name="name">Por Mes/Cliente</field>
+          <field name="model_id">sale.reportgral</field>
+          <field name="user_id" eval="False"/>
+          <field name="context">{'group_by':['date:month','partner_id']}</field>
+      </record>
+
+    <record id="filter_sale_report_mescategmarcacli" model="ir.filters">
+          <field name="name">Por Mes/Categoria/Marca/Cliente</field>
+          <field name="model_id">sale.reportgral</field>
+          <field name="user_id" eval="False"/>
+          <field name="context">{'group_by': ['date:month','product_categ_id','product_brand_id','partner_id']}</field>
+    </record>
+
+    <record id="filter_sale_report_salesteam1" model="ir.filters">
+        <field name="name">Por Categoria</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['product_categ_id']}</field>
+    </record>
+	<record id="filter_sale_report_brand1" model="ir.filters">
+        <field name="name">Por Marca</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['product_brand_id']}</field>
+    </record>
+	<record id="filter_sale_report_brand2" model="ir.filters">
+        <field name="name">Por Mes/Marca</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month','product_brand_id']}</field>
+    </record>
+
+    <record id="filter_sale_report_mescategcli" model="ir.filters">
+          <field name="name">Por Mes/Categoria/Cliente</field>
+          <field name="model_id">sale.reportgral</field>
+          <field name="user_id" eval="False"/>
+          <field name="context">{'group_by': ['date:month','product_categ_id','partner_id']}</field>
+    </record>
+
+	<record id="filter_sale_report_product2" model="ir.filters">
+        <field name="name">Por Producto</field>
+        <field name="model_id">sale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['product_id']}</field>
+    </record>
+
+    <record id="view_order_product_search1" model="ir.ui.view">
+        <field name="name">sale.reportgral.search</field>
+        <field name="model">sale.reportgral</field>
+        <field name="arch" type="xml">
+            <search string="Analisis de Ventas ">
+                <field name="date"/>
+                <field name="date_confirm"/>
+                <filter string="Este año" name="year" invisible="1" domain="[('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                <filter name="Presupuestos" domain="[('state','in',('draft','sent'))]"/>
+                <filter name="Ventas" string="Ventas" domain="[('state','not in',('draft','sent','cancel'))]"/>
+                <separator/>
+                <filter string="Mis Ventas" help="Mis Ventas" domain="[('user_id','=',uid)]"/>
+                <filter string="Este año" name="year" domain="[('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                <filter string="Año pasado  " domain="[('date','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('date','&lt;=', time.strftime('%%Y-01-01'))]"/>
+                <filter string="Mes actual" domain="[('date','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('date','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                <filter string="Mes pasado" domain="[('date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('date','&lt;',time.strftime('%%Y-%%m-01'))]"/>
+                <filter string="Semana anterior" domain="[('date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <filter string="Esta semana" domain="[('date', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <filter string="Hoy" domain="[('date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                <filter string=" Ayer " domain="[('date','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+                <group expand="0" string="Filtros Extendidos">
+                    <field name="partner_id" domain="[('partner_id','=',self)]"/>
+                    <field name="product_categ_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
+                </group>
+                <group expand="1" string="Agrupado por">
+                    <filter string="Vendedor/Usuario" name="User" context="{'group_by':'user_id'}"/>
+                    <filter string="Equipo de Ventas" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
+                    <filter string="Cliente" name="Customer" context="{'group_by':'partner_id'}"/>
+                    <filter string="Ciudad" name="Ciudad" context="{'group_by':'city_id'}"/>
+                    <filter string="Producto" name="Producto" context="{'group_by':'product_id'}"/>
+                    <filter string="Mes/Categoria" name="Category" context="{'group_by':'product_categ_id'}"/>
+                    <filter string="Estado" context="{'group_by':'state'}"/>
+                    <filter string="Empresa" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
+                    <filter string="Sucursal" context="{'group_by':'warehouse_id'}"/>
+                    <separator/>
+                    <filter string="Mes" context="{'group_by':'date:month'}" help="Ordenado fecha de ventas"/>
+                    <filter string="Por dia" context="{'group_by':'date:day'}"/>
+                </group>
+            </search>
+        </field>
+    </record>
+
+   <!--  <menuitem action="action_order_report_all" id="menu_report_product_all" parent="base.next_id_64" sequence="10"/> -->
+
+</data>
+</openerp>

+ 36 - 0
ventagral_report.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+		<report id="report_gral"
+            model="sale.reportgral"
+            string="Listado de ventas por producto"
+            report_type="qweb-pdf"
+            name="report_gral.report_ventagral"
+            file="report_gral.report_ventagral"
+        />
+
+		<report id="report_gral2"
+            model="sale.reportgral"
+            string="Listado de ventas por cliente"
+            report_type="qweb-pdf"
+            name="report_gral.report_ventagralxcliente"
+            file="report_gral.report_ventagralxcliente"
+        />
+		
+		<report id="report_gral3"
+            model="sale.reportgral"
+            string="Listado de ventas por fecha"
+            report_type="qweb-pdf"
+            name="report_gral.informe_venta_por_fecha"
+            file="report_gral.informe_venta_por_fecha"
+        />
+		
+		<report id="report_gral4"
+            model="sale.reportgral"
+            string="Listado de ventas por categoria"
+            report_type="qweb-pdf"
+            name="report_gral.informe_venta_por_categoria"
+            file="report_gral.informe_venta_por_categoria"
+        />
+    </data>
+</openerp>