Kaynağa Gözat

Modulo report_gralnormal

sebas 8 yıl önce
işleme
b30ba54e45

+ 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_gralventabrds
+from . import report
+import math

BIN
__init__.pyc


+ 54 - 0
__openerp__.py

@@ -0,0 +1,54 @@
+# -*- 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 ventas normales con product_brands',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Listado ventas normales con product_brands
+========================================
+
+Genera varios listados de ventas normales con product_brands
+- Por productos
+- Por clientes
+- Por fecha
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['sale','sales_team','account_voucher','report','kingfisher_pro'],
+    'data': [
+		'informe_venta_general_view2.xml',
+		'report/informe_ventagral_view2.xml',
+		'informe_ventagralxcliente2.xml',
+		'informe_venta_por_categoria2.xml',
+		'informe_venta_por_fecha2.xml',
+		'ventagral_filter_view2.xml',
+        'ventagral_report2.xml',
+    ],
+    'installable': True,
+}

+ 84 - 0
informe_venta_general_view2.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="report_ventagral2">
+			<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>
+								</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="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.price_total for r in docs])"/>
+																										<span t-esc="total1"/>
+																</td>
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 82 - 0
informe_venta_por_categoria2.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="informe_venta_por_categoria2">
+			<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.price_total for r in docs])"/>
+																<span t-esc="total1"/>
+																</td>
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 89 - 0
informe_venta_por_fecha2.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="informe_venta_por_fecha2">
+			<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="3">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_ventagralxcliente2.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="report_ventagralxcliente2">
+			<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_gralbrds
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/__init__.pyc


+ 37 - 0
report/informe_ventagral_view2.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="report_gral_tree_view1" model="ir.ui.view">
+            <field name="name">report.gral.tree.view</field>
+            <field name="model">xsale.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_view1" model="ir.actions.act_window">
+            <field name="name">Listado General de Ventas</field>
+            <field name="res_model">xsale.reportgral</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree</field>
+        </record>
+
+	  <menuitem action="action_report_gral_tree_view1" name="Listado General de Ventas" id="venta_gral_menu1" parent="base.next_id_64" sequence="10"/>
+
+	</data>
+</openerp>

+ 138 - 0
report/report_gralbrds.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 xsale_reportgral(osv.osv):
+    _name = "xsale.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.brands', 'Marca', readonly=True),
+        'partner_id': fields.many2one('res.partner', 'Cliente', 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),
+        'warehouse_id': fields.many2one('stock.warehouse', 'Sucursal',  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,
+                    l.price_unit as price_unit,
+                    t.uom_id as product_uom,
+                    q.id as city_id,
+                    h.name as city,
+                    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,
+                    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_brands r on (t.product_brand_id=r.id)
+                    left join stock_warehouse j on (s.warehouse_id=j.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 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,
+                    l.price_unit,
+                    t.categ_id,
+                    s.date_order,
+                    s.date_confirm,
+                    s.partner_id,
+                    q.id,
+                    h.name,
+                    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_gralbrds.pyc


+ 16 - 0
report_gralventabrds.py

@@ -0,0 +1,16 @@
+#    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
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report_gralventabrds.pyc


BIN
static/description/icon.png


+ 115 - 0
ventagral_filter_view2.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <!-- Custom reports (aka filters) -->
+    <record id="filter_sale_report_sales_funnel2" model="ir.filters">
+        <field name="name">Canal de Ventas</field>
+        <field name="model_id">xsale.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_salespersons2" model="ir.filters">
+        <field name="name">Por Vendedores</field>
+        <field name="model_id">xsale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'user_id']}</field>
+    </record>
+    <record id="filter_sale_report_salesteam2" model="ir.filters">
+        <field name="name">Por equipo de ventas</field>
+        <field name="model_id">xsale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'section_id']}</field>
+    </record>
+    <record id="filter_sale_report_product2" model="ir.filters">
+        <field name="name">Por Mes Producto</field>
+        <field name="model_id">xsale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['date:month', 'product_id']}</field>
+    </record>
+
+    <record id="filter_sale_report_mescategmarcacli2" model="ir.filters">
+          <field name="name">Por Mes/Categoria/Marca/Cliente</field>
+          <field name="model_id">xsale.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_salesteam2" model="ir.filters">
+        <field name="name">Por Categoria</field>
+        <field name="model_id">xsale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['product_categ_id']}</field>
+    </record>
+	<record id="filter_sale_report_brand2" model="ir.filters">
+        <field name="name">Por Marca</field>
+        <field name="model_id">xsale.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">xsale.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_mescategcli2" model="ir.filters">
+          <field name="name">Por Mes/Categoria/Cliente</field>
+          <field name="model_id">xsale.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">xsale.reportgral</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['product_id']}</field>
+    </record>
+
+    <record id="view_order_product_search2" model="ir.ui.view">
+        <field name="name">sale.reportgral.search</field>
+        <field name="model">xsale.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" invisible="1" domain="[('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                <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'))]"/>
+                <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')))]"/>
+                <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 mes de ventas"/>
+                    <filter string="Por Fecha" 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_report2.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+		<report id="report_gral22"
+            model="xsale.reportgral"
+            string="Listado de ventas por producto"
+            report_type="qweb-pdf"
+            name="report_gralnormal.report_ventagral2"
+            file="report_gralnormal.report_ventagral2"
+        />
+
+		<report id="report_gral23"
+            model="xsale.reportgral"
+            string="Listado de ventas por cliente"
+            report_type="qweb-pdf"
+            name="report_gralnormal.report_ventagralxcliente2"
+            file="report_gralnormal.report_ventagralxcliente2"
+        />
+
+		<report id="report_gral34"
+            model="xsale.reportgral"
+            string="Listado de ventas por fecha"
+            report_type="qweb-pdf"
+            name="report_gralnormal.informe_venta_por_fecha2"
+            file="report_gralnormal.informe_venta_por_fecha2"
+        />
+
+		<report id="report_gral44"
+            model="xsale.reportgral"
+            string="Listado de ventas por categoria"
+            report_type="qweb-pdf"
+            name="report_gralnormal.informe_venta_por_categoria2"
+            file="report_gralnormal.informe_venta_por_categoria2"
+        />
+    </data>
+</openerp>