ソースを参照

commit report_gralinvoice

sebas 8 年 前
コミット
acf2a69aa6

+ 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_gralinvoice
+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 de Gastos',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Listado de Gastos
+========================================
+
+Listado de Gastos
+- Por contabilidad
+- Por proveedores
+- Por fecha
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['account','report','base'],
+    'data': [
+		'informe_invoice_general_view.xml',
+		'report/informe_invoicegral_view.xml',
+		'informe_invoice_por_fecha.xml',
+		'informe_invoicegralxcliente.xml',
+		'invoicegral_filter_view.xml',
+    ],
+    'installable': True,
+}

+ 81 - 0
informe_invoice_general_view.xml

@@ -0,0 +1,81 @@
+<?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.name"/>
+										</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>
+																<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_invoice_por_categoria.xml

@@ -0,0 +1,82 @@
+<?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>
+																<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>

+ 98 - 0
informe_invoice_por_fecha.xml

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_invoicegral3"
+            model="invoice.reportgral"
+            string="Listado de Gasto por fecha"
+            report_type="qweb-pdf"
+            name="report_gralinvoice.informe_invoice_por_fecha"
+            file="report_gralinvoice.informe_invoice_por_fecha"
+    />
+
+		<template id="informe_invoice_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 Gastos por fecha</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th>Fecha</th>
+									<th>Proveedor</th>
+									<th>N° de Factura</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.supplier_invoice_number"/>
+										</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>
+
+							  <tr>
+								<td colspan="6"></td>
+								</tr>
+														<tr class="border-black">
+																<td colspan="3">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>
+																<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>

+ 95 - 0
informe_invoicegralxcliente.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_invoicegral2"
+						model="invoice.reportgral"
+						string="Listado de Gasto por proveedor"
+						report_type="qweb-pdf"
+						name="report_gralinvoice.report_invoicegralxcliente"
+						file="report_gralinvoice.report_invoicegralxcliente"
+		/>
+
+		<template id="report_invoicegralxcliente">
+			<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° 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>
+
+							<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>

+ 73 - 0
invoicegral_filter_view.xml

@@ -0,0 +1,73 @@
+<?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">invoice.reportgral</field>
+      <field name="domain">[]</field>
+      <field name="user_id" eval="False"/>
+      <field name="context">{'group_by': ['partner_id']}</field>
+  </record>
+
+  <record id="filter_invoice_salespersons1" model="ir.filters">
+      <field name="name">Por vendedores</field>
+      <field name="model_id">invoice.reportgral</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_invoice_product1" model="ir.filters">
+      <field name="name">Por producto</field>
+      <field name="model_id">invoice.reportgral</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_invoice_gasto1" model="ir.filters">
+      <field name="name">Por Gastos</field>
+      <field name="model_id">invoice.reportgral</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_invoice_report_search1" model="ir.ui.view">
+      <field name="name">invoice.reportgral.report.search</field>
+      <field name="model">invoice.reportgral</field>
+      <field name="arch" type="xml">
+          <search string="Analisis de Gastos">
+              <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')))]"/>
+              <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 Combustible" domain="[('account_line_id','=',223)]" help = "Combustible"/>
+              <filter string="Por Otros Gastos" domain="[('account_line_id','!=',(223,39))]" help = "Por Otros Gastos"/>
+              <separator/>
+              <field name="partner_id" operator="child_of"/>
+              <field name="user_id" />
+              <filter string="Guarani" name="currency_id" domain="[('currency_id','=','PYG')]"/>
+              <filter string="Dolar" name="currency_id" domain="[('currency_id','=','USD')]"/>
+              <group expand="1" string="Agrupar por">
+                  <filter string="Partner" 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"/>
+                  <separator orientation="vertical" />
+                  <filter string="Mes de Factura" context="{'group_by':'date:month'}"/>
+                  <filter string="Por fecha" context="{'group_by':'date:day'}"/>
+              </group>
+          </search>
+      </field>
+  </record>
+
+
+</data>
+</openerp>

+ 18 - 0
invoicegral_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>

+ 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_invoicegral
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report/__init__.pyc


+ 35 - 0
report/informe_invoicegral_view.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+      <record id="report_facturagral_tree_view" model="ir.ui.view">
+          <field name="name">report.facturagral.tree.view</field>
+          <field name="model">invoice.reportgral</field>
+          <field name="priority" eval="20"/>
+          <field name="arch" type="xml">
+              <tree string="Listado de Gastos" 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"/>
+        <field name="supplier_invoice_number"/>
+        <field name="product_id" string="Producto"/>
+        <field name="name" string="Descripcion"/>
+        <field name="product_qty" sum="# of Qty" string="Cant."/>
+        <field name="price_total" sum="Total" string="Total"/>
+        <field name="state" invisible="1"/>
+      </tree>
+          </field>
+      </record>
+
+  <record id="action_report_facturagral_tree_view" model="ir.actions.act_window">
+          <field name="name">Listado de Gastos</field>
+          <field name="res_model">invoice.reportgral</field>
+          <field name="view_type">form</field>
+          <field name="view_mode">tree</field>
+  </record>
+
+  <menuitem name="Listado de Gastos" action="action_report_facturagral_tree_view" id="menu_action_account_invoice_report_all1" parent="account.menu_finance_reporting" sequence="2"/>
+
+  </data>
+</openerp>

+ 93 - 0
report/report_invoicegral.py

@@ -0,0 +1,93 @@
+# -*- 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 invoice_reportgral(osv.osv):
+    _name = "invoice.reportgral"
+    _description = "Facturas - Analisis"
+    _auto = False
+    _rec_name = 'date'
+
+    _columns = {
+        'date': fields.date('Date Order', readonly=True),
+		'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
+        'supplier_invoice_number':fields.char('N° Factura', readonly=True),
+		'product_id':fields.many2one('product.product', 'Product', readonly=True),
+        'name': fields.char('Descripcion', readonly=True),
+        'product_qty':fields.integer('Product Quantity', readonly=True),
+        'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
+        'company_id': fields.many2one('res.company', 'Company', readonly=True),
+        'user_id':fields.many2one('res.users', 'Salesperson', readonly=True),
+        'price_total': fields.float('Total Without Tax', readonly=True),
+        'currency_id': fields.many2one('res.currency', 'Moneda',readonly=True),
+        'state': fields.selection([
+            ('draft','Draft'),
+            ('proforma','Pro-forma'),
+            ('proforma2','Pro-forma'),
+            ('open','Open'),
+            ('paid','Done'),
+            ('cancel','Cancelled')
+            ], 'Invoice Status', 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, 'invoice_reportgral')
+            cr.execute("""
+                create or replace view invoice_reportgral as (
+                    select
+    					min(ail.id) AS id,
+    					ai.date_invoice AS date,
+                        ai.partner_id AS partner_id,
+                        ai.supplier_invoice_number AS supplier_invoice_number,
+                        ail.product_id AS product_id,
+                        ail.name AS name,
+                        sum(ail.quantity) as product_qty,
+                        ai.journal_id,
+                        ai.company_id,
+                        ai.user_id,
+                        ai.state,
+                        ai.currency_id,
+                        ai.account_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
+                    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 = 'in_invoice'
+                    GROUP BY ail.product_id, ai.date_invoice,
+                        ai.partner_id,ail.name,ai.currency_id,ai.supplier_invoice_number, ai.journal_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_invoicegral.pyc


+ 12 - 0
report_gralinvoice.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_gralinvoice.pyc


BIN
static/description/icon.png