Переглянути джерело

Modulo report_facturaventa

sebas 7 роки тому
коміт
fdfc3561e1

+ 30 - 0
__init__.py

@@ -0,0 +1,30 @@
+# -*- 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 #
+###################################################################################
+
+import report_facturaventa
+import report
+import math


+ 53 - 0
__openerp__.py

@@ -0,0 +1,53 @@
+# -*- 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 de facturas de ventas',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Listado de facturas de ventas
+========================================
+
+Listado de facturas de ventas
+- Por contabilidad
+- Por tipo
+- Por cliente
+- Por fecha
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['account','report','base'],
+    'data': [
+		'informe_factura_venta_view.xml',
+		'report/informe_facturaventa_view.xml',
+		'informe_facturaventa_por_fecha.xml',
+		'facturaventa_report.xml',
+		'facturaventa_filter_view.xml',
+    ],
+    'installable': True,
+}

+ 74 - 0
facturaventa_filter_view.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+  <!-- Custom reports (aka filters) -->
+  <record id="filter_report_gastos_funnel" model="ir.filters">
+      <field name="name">Proveedor</field>
+      <field name="model_id">facturaventa.report</field>
+      <field name="domain">[]</field>
+      <field name="user_id" eval="False"/>
+      <field name="context">{'group_by': ['partner_id']}</field>
+  </record>
+
+  <record id="filter_facturaventa_salespersons1" model="ir.filters">
+      <field name="name">Por vendedores</field>
+      <field name="model_id">facturaventa.report</field>
+      <field name="domain">[]</field>
+      <field name="user_id" eval="False"/>
+      <field name="context">{'group_by': ['date:month', 'user_id']}</field>
+  </record>
+  <record id="filter_facturaventa_product1" model="ir.filters">
+      <field name="name">Por producto</field>
+      <field name="model_id">facturaventa.report</field>
+      <field name="domain">[]</field>
+      <field name="user_id" eval="False"/>
+      <field name="context">{'group_by': ['date:month', 'product_id']}</field>
+  </record>
+  <record id="filter_factura_venta" model="ir.filters">
+      <field name="name">Por Factura Venta</field>
+      <field name="model_id">facturaventa.report</field>
+      <field name="domain">[]</field>
+      <field name="user_id" eval="False"/>
+      <field name="context">{'group_by': ['date:month', 'account_line_id']}</field>
+  </record>
+
+  <record id="view_account_facturaventa_report_search1" model="ir.ui.view">
+      <field name="name">invoice.facturaventa.report.search</field>
+      <field name="model">facturaventa.report</field>
+      <field name="arch" type="xml">
+          <search string="Analisis de Factura de Ventas">
+              <field name="date"/>
+              <filter string="Este año" name="thisyear" domain="['|', ('date', '=', False), '&amp;',('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]" help="Journal invoices with period in current year"/>
+              <separator/>
+              <filter string="Para facturar" domain="[('state','=','draft')]" help = "Draft Invoices"/>
+              <filter string="Pro-forma" domain="['|', ('state','=','proforma'),('state','=','proforma2')]"/>
+              <filter string="Facturado" name="current" domain="[('state','not in', ('draft','cancel','proforma','proforma2'))]"/>
+              <filter string="Por Servicio de Internet" domain="[('origin', 'like', 'AA')]" help = "Internet"/>
+              <filter string="Servicio Tecnico/Ventas" domain="[('origin', 'not ilike', 'AA')]" help = "Servicio/Ventas"/>
+              <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=" Ayer " domain="[('date_order','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('date_order','&gt;=',(datetime.date.today()-relativedelta(days=1)).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="Ultimos 15 dias atras" domain="[('date','&lt;=',time.strftime('%%d/%%m/%%Y')),('date','&gt;=',((context_today()-relativedelta(days=15)).strftime('%%d/%%m/%%Y')))]"/>
+              <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')))]"/>
+              <separator/>
+              <field name="partner_id" operator="child_of"/>
+              <group expand="1" string="Agrupar por">
+                  <filter string="Cliente" name="partner_id" context="{'group_by':'partner_id'}"/>
+                  <filter string="Vendedor" name='user' context="{'group_by':'user_id'}"/>
+                  <filter string="Contabilidad" name='account_line_id' context="{'group_by':'account_line_id'}"/>
+                  <filter string="Estado" context="{'group_by':'state'}"/>
+                  <filter string="Compania" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
+                  <filter string="Moneda" name="currency_id" context="{'group_by':'currency_id'}"/>
+                  <separator orientation="vertical" />
+                  <filter string="Mes de Factura" context="{'group_by':'date:month'}"/>
+                  <filter string="Por dia" context="{'group_by':'date:day'}"/>
+              </group>
+          </search>
+      </field>
+  </record>
+
+
+</data>
+</openerp>

+ 18 - 0
facturaventa_report.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+		<!-- <report id="report_invoicegral5"
+            model="invoice.reportgral"
+            string="Listado de Gasto por producto"
+            report_type="qweb-pdf"
+            name="report_gralinvoice.report_invoicegral6"
+            file="report_gralinvoice.report_invoicegral6"
+        />-->
+
+
+
+		
+
+
+    </data>
+</openerp>

+ 77 - 0
informe_factura_venta_view.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="report_facturagral6">
+			<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 Gastos</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_total)/(o.product_qty)"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.product_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_qty for x in docs])"/>
+                                    <span t-esc="total"/>
+                                </td>
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 78 - 0
informe_facturaventa_por_categoria.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<template id="informe_factura_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 Factura 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.categ_id"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.product_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_qty for x in docs])"/>
+                                    <span t-esc="total"/>
+                                </td>
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 83 - 0
informe_facturaventa_por_fecha.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_facturaventa3"
+            model="facturaventa.report"
+            string="Listado de Factura de Ventas"
+            report_type="qweb-pdf"
+            name="report_facturaventa.informe_facturaventa_por_fecha"
+            file="report_facturaventa.informe_facturaventa_por_fecha"
+    />
+
+		<template id="informe_facturaventa_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 Factura de Ventas</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Fecha</th>
+									<th class="text-center">Cliente</th>
+									<th class="text-center">Nro</th>
+									<th class="text-center">Producto</th>
+									<th class="text-center">Cant.</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.origin"/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.product_id.name"/>
+										</td>
+										<td class="text-center">
+											<span t-field="o.product_qty" sum="# of Qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 79 - 0
informe_facturaventaxcli.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_invoicegral2"
+						model="facturaventa.report"
+						string="Listado de Gasto por proveedor"
+						report_type="qweb-pdf"
+						name="report_facturaventa.report_facturaventaxcliente"
+						file="report_facturaventa.report_facturaventaxcliente"
+		/>
+
+		<template id="report_facturaventaxcliente">
+			<t t-call="report.html_container">
+				<t t-call="report.internal_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 Gastos</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Proveedor</th>
+									<th class="text-center">N° de Factura</th>
+									<th class="text-center">Cantidad</th>
+									<th class="text-center">Sub Total</th>
+									<th class="text-center">Fecha</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td>
+											<span t-field="o.partner_id.name"/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.supplier_invoice_number"/>
+										</td>
+										<td class="text-center">
+											<span t-field="o.product_qty"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.price_total"/>
+										</td>
+										<td class="text-left">
+											<span t-field="o.date" t-field-options='{"widget": "date"}'/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+						  </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_facturaventa
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/__init__.pyc


+ 52 - 0
report/informe_facturaventa_view.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+      <record id="report_facturaventa_tree_view" model="ir.ui.view">
+          <field name="name">report.facturaventa.tree.view</field>
+          <field name="model">facturaventa.report</field>
+          <field name="priority" eval="20"/>
+          <field name="arch" type="xml">
+        <tree string="Listado de Factura de Ventas" create="false">
+        <field name="id" invisible="1"/>
+        <field name="date" invisible="1"/>
+        <field name="user_id" invisible="1"/>
+        <field name="company_id" invisible="1" group="base.group_multi_company"/>
+        <field name="partner_id"/>
+        <field name="invoice_id" on_change="onchange_invoice_id(invoice_id)"/>
+        <field name="origin"/>
+        <field name="product_id" string="Producto"/>
+        <field name="product_qty" sum="# of Qty" string="Cantidad"/>
+        <field name="price_total" sum="Total" string="Total"/>
+        <field name="currency_id" string="Moneda"/>
+        <field name="state" invisible="1"/>
+        </tree>
+          </field>
+      </record>
+
+      <record model="ir.ui.view" id="facturaventa_analisis_form">
+              <field name="name">Listado de Factura de Ventas</field>
+              <field name="model">facturaventa.report</field>
+              <field name="view_type">form</field>
+              <field eval="20" name="priority"/>
+              <field name="arch" type="xml">
+                  <form string="Listado de Factura de Ventas" create="false" edit="false">
+                      <group>
+                          <field name="date"/>
+                          <field name="partner_id"/>
+                          <field name="invoice_id" on_change="onchange_invoice_id(invoice_id)"/>
+                      </group>
+                  </form>
+              </field>
+    </record>
+
+  <record id="action_report_facturaventa_tree_view" model="ir.actions.act_window">
+          <field name="name">Listado de Facturas de Ventas</field>
+          <field name="res_model">facturaventa.report</field>
+          <field name="view_type">form</field>
+          <field name="view_mode">tree,form</field>
+  </record>
+
+  <menuitem name="Listado de Facturas de Ventas" action="action_report_facturaventa_tree_view" id="menu_action_account_invoice_report_all1" parent="account.menu_finance_reporting" sequence="4"/>
+
+  </data>
+</openerp>

+ 96 - 0
report/report_facturaventa.py

@@ -0,0 +1,96 @@
+# -*- 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
+from datetime import datetime
+
+
+class facturaventa_report(osv.osv):
+    _name = "facturaventa.report"
+    _description = "Factura de Ventas - Informe"
+    _auto = False
+    _rec_name = 'date'
+
+    _columns = {
+        'date': fields.date('Fecha', readonly=True),
+		'partner_id':fields.many2one('res.partner', 'Cliente', readonly=True),
+        'invoice_id' : fields.many2one('account.invoice','N° Factura', readonly=True),
+		'product_id':fields.many2one('product.product', 'Producto', readonly=True),
+        'name': fields.char('Descripcion', readonly=True),
+        'origin': fields.char('Referencia', readonly=True),
+        'product_qty':fields.integer('Cantidad', readonly=True),
+        'journal_id': fields.many2one('account.journal', 'Diario', readonly=True),
+        'currency_id':fields.many2one('res.currency', 'Moneda', readonly=True),
+        'company_id': fields.many2one('res.company', 'Compañia', readonly=True),
+        'user_id':fields.many2one('res.users', 'Vendedor', readonly=True),
+        'price_total': fields.float('Total s/ Impuesto', readonly=True),
+        'state': fields.selection([
+            ('draft','Borrador'),
+            ('proforma','Pro-forma'),
+            ('proforma2','Pro-forma'),
+            ('open','Abierto'),
+            ('paid','Pagado'),
+            ('cancel','Cancelado')
+            ], 'Estado de Factura', readonly=True),
+        'account_id': fields.many2one('account.account', 'Account',readonly=True),
+        'account_line_id': fields.many2one('account.account', 'Account Line',readonly=True),
+    }
+    _order = 'date desc'
+
+
+    def init(self, cr):
+            tools.drop_view_if_exists(cr, 'facturaventa_report')
+            cr.execute("""
+                create or replace view facturaventa_report as (
+                    select
+    					min(ail.id) AS id,
+    					ai.date_invoice AS date,
+                        ai.partner_id AS partner_id,
+                        ai.id AS invoice_id,
+                        ail.product_id AS product_id,
+                        ai.origin AS origin,
+                        ail.name AS name,
+                        sum(ail.quantity) as product_qty,
+                        ai.journal_id,
+                        ai.company_id,
+                        ai.user_id,
+                        ai.state,
+                        ai.account_id,
+                        ai.currency_id,
+                        ail.account_id AS account_line_id,
+    					sum(ail.quantity * ail.price_unit) as price_total
+                    from account_invoice_line ail
+                    JOIN account_invoice ai ON ai.id = ail.invoice_id
+                       LEFT JOIN res_currency t ON t.id = ai.currency_id
+                    JOIN res_partner partner ON ai.commercial_partner_id = partner.id
+                    LEFT JOIN product_product pr ON pr.id = ail.product_id
+                    left JOIN product_template pt ON pt.id = pr.product_tmpl_id
+                    LEFT JOIN product_uom u ON u.id = ail.uos_id
+                    where ai.type = 'out_invoice'
+                    GROUP BY ail.product_id,ai.origin, ai.date_invoice,
+                        ai.partner_id,ail.name,ai.id, ai.journal_id,ai.currency_id,
+                        ai.user_id, ai.company_id, ai.state, pt.categ_id,
+                        ai.account_id, ail.account_id)
+                    """)
+
+
+    # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/report_facturaventa.pyc


+ 12 - 0
report_facturaventa.py

@@ -0,0 +1,12 @@
+#    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

BIN
report_facturaventa.pyc


BIN
static/description/icon.png