Преглед на файлове

commit inicial Report general de stock por variantes

Adrielso преди 8 години
родител
ревизия
ad1a664758

+ 1 - 27
__init__.py

@@ -1,28 +1,2 @@
 # -*- 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_stockgral
-import math
+import models

BIN
__init__.pyc


+ 9 - 44
__openerp__.py

@@ -1,51 +1,16 @@
 # -*- 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 Stock Valorizado',
+    'name': 'Listado General de Stock de Productos',
     'version': '0.1',
     'category': 'Product',
     'description': """
-Listado General de Stock Valorizado
-========================================
-
-Genera General de Stock Valorizado
-- Por Location
-- Por Genero
-- Por Marca
-
-    """,
-    'author': 'Eiru/Sebastian Penayo',
-    'website': 'http://www.paraguayenlaweb.com',
-	'depends': ['stock', 'report'],
-    'data': [
-		'informe_stockgral_view.xml',
-		'informe_stock_general_view1.xml',
-        'informe_stock_general_view2.xml',
-		'stockgral_filter_view.xml',
-    ],
+Listado General de Stock de producto y variantes Detallado
+==========================================================
+""",
+    'author': 'Adrielso Kunert',
+    'depends': ['stock', 'report','report_stockgral'],
+    'data': ['views/informe_stockgral_product_view.xml',
+             'views/stockgral_filter_product_view.xml',
+             'views/informe_stock_product_view.xml',],
     'installable': True,
 }

+ 0 - 88
informe_stock_general_view1.xml

@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-	<data>
-		<report id="report_ventasgral6"
-            model="report.stockgral1"
-            string="Listado de Stock Valorizado"
-            report_type="qweb-pdf"
-            name="report_stockgral.informe_stock_general_view1"
-            file="report_stockgral.informe_stock_general_view1"
-        />
-
-		<template id="informe_stock_general_view1">
-			<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 valorizacion de productos en stock</h4>
-						<div class="logo1" />
-
-						  <table class="table table-condensed">
-							<thead class="crm_tcab">
-								<tr class="active">
-									<th>Referencia</th>
-									<th>Producto</th>
-									<th class="text-right">Cantidad</th>
-									<th class="text-right">Sub Total Venta</th>
-								</tr>
-							</thead>
-							<t t-foreach="docs" t-as="o">
-							<tbody>
-									<tr>
-										<td>
-											<span t-field="o.factory_reference"/>
-										</td>
-										<td>
-											<span t-field="o.product_id"/>
-										</td>
-
-										<td class="text-right">
-											<span t-field="o.quantity"/>
-										</td>
-
-										<td class="text-right">
-											<span t-field="o.subtotal_venta"/>
-										</td>
-									</tr>
-							</tbody>
-							</t>
-							<tr>
-                                <td colspan="4"></td>
-                            </tr>
-                            <tr class="border-black">
-                                <td colspan="3">Total:</td>
-
-								<td class="text-right">
-                                    <t t-set="total" t-value="sum([x.subtotal_venta for x in docs])"/>
-                                    <span t-esc="total"/>
-                                </td>
-                            </tr>
-						  </table>
-
-					</div>
-				</t>
-			</t>
-		</template>
-	</data>
-</openerp>

+ 0 - 30
informe_stockgral_view.xml

@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-        <record id="report_stockgral_tree_view" model="ir.ui.view">
-            <field name="name">report.stockgral.tree.view</field>
-            <field name="model">report.stockgral1</field>
-            <field name="priority" eval="20"/>
-            <field name="arch" type="xml">
-                <tree string="Listado General de Stock" create="false">
-                    <field name="factory_reference" string="Referencia"/>
-					<field name="product_id" string="Producto"/>
-					<field name="quantity" string="Cantidad"/>
-					<field name="subtotal_venta" string="SubTotal" sum="st"/>
-					<field name="location_id" invisible="1"/>
-				</tree>
-            </field>
-        </record>
-				
-		<record id="action_report_stockgral_tree_view" model="ir.actions.act_window">
-            <field name="name">Listado General de Stock</field>
-            <field name="res_model">report.stockgral1</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree</field>
-        </record>
-				
-		<menuitem name="Stock" sequence="47" id="stock_gral_menu" parent="base.menu_reporting"/>
-		<menuitem id="menu_gral_stock" name="Listado General de Stock" parent="stock_gral_menu" action="action_report_stockgral_tree_view"/>
-		
-	</data>	
-</openerp>

+ 0 - 67
informe_stockgralxcliente.xml

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-	<data>
-		<template id="report_posgralxcliente">
-			<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 Pos 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_qty"/>
-										</td> 
-										<td class="text-right">
-											<span t-field="o.price_total"/>
-										</td>
-									</tr>	
-							</tbody>
-							</t>
-						  </table>
-						  
-					</div>
-				</t>
-			</t>
-		</template>
-	</data>
-</openerp> 
-
-                        
-                                       
-                                    

+ 2 - 0
models/__init__.py

@@ -0,0 +1,2 @@
+# -*- coding : utf-8 -*-
+from . import report_stock_product

BIN
models/__init__.pyc


+ 52 - 0
models/report_stock_product.py

@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+from openerp import tools, models, fields, api
+from openerp.osv import fields, osv
+
+class report_stock_product(models.Model):
+
+    _name = "report.stock.product"
+    _description = "report.stock.product"
+    _auto = False
+    _columns = {
+        'id': fields.integer('id',required=True),
+		'product_id': fields.many2one('product.product', 'Product', required=True, select=True, readonly=True),
+		'quantity': fields.float('Cantidad', readonly=True),
+        'brand_id': fields.many2one('product.brand', 'Marca', readonly=True),
+        'genre_id': fields.many2one('product.genre', 'Genero', readonly=True),
+        'categ_id': fields.many2one('product.category', 'Categoria', readonly=True),
+		'factory_reference': fields.char('Referencia', readonly=True),
+		'location_id': fields.many2one('stock.location', 'Ubicacion',  readonly=True),
+		'id_parent' : fields.many2one('product.category', 'Categoria Padre', readonly=True),
+    }
+    _order = 'id asc'
+
+    def init(self, cr):
+		tools.sql.drop_view_if_exists(cr, 'report_stock_product')
+		cr.execute("""
+            CREATE OR REPLACE VIEW report_stock_product as (
+            SELECT	row_number() over (ORDER BY product_id)as id,
+	               s.product_id as product_id,
+                   SUM(s.qty) as quantity,
+                   pt.product_brand_id as brand_id,
+                   pt.product_genre_id as genre_id,
+                   pt.categ_id as categ_id,
+                   pt.factory_reference as factory_reference,
+                   s.location_id as location_id,
+                   pcc.id_parent as id_parent
+            FROM stock_quant s
+	           left join stock_location r on (r.id=s.location_id)
+               left join product_product p on (p.id=s.product_id)
+               left join product_template pt on (pt.id=p.product_tmpl_id)
+               left join product_brand z on (pt.product_brand_id=z.id)
+               left join product_genre t on (pt.product_genre_id=t.id)
+               left join product_category g on (g.id=pt.categ_id)
+               left join (SELECT pp.id, pp.parent_id,
+                    case when (select ppp.parent_id from product_category ppp where ppp.id= pp.parent_id and ppp.parent_id !=1) is NULL
+                    then pp.parent_id  ELSE
+                    (select ppp.parent_id from product_category ppp where ppp.id= pp.parent_id and ppp.parent_id !=1) END as id_parent
+                    from product_category pp) as pcc on pcc.id = pt.categ_id
+                WHERE r.usage='internal' and  s.qty>0 and  pt.active=True
+                GROUP BY s.location_id, s.product_id, pt.product_brand_id, pt.product_genre_id, pt.factory_reference, pt.categ_id, pcc.id_parent)
+		""")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
models/report_stock_product.pyc


+ 0 - 79
report_stockgral.py

@@ -1,79 +0,0 @@
-# -*- 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 report_stockgral1(osv.osv):
-    """
-    Quants are the smallest unit of stock physical instances
-    """
-    _name = "report.stockgral1"
-    _description = "Stockgral"
-    _auto = False
-    _columns = {
-		'product_id': fields.many2one('product.product', 'Product', required=True, select=True, readonly=True),
-		'unit_price': fields.float('Precio Venta', readonly=True),
-		'quantity': fields.float('Cantidad', readonly=True),
-		'subtotal_venta': fields.float('Subtotal', readonly=True),
-		'location_id': fields.many2one('stock.location', 'Ubicacion',  readonly=True),
-		'categ_id': fields.many2one('product.category', 'Categoria', readonly=True),
-		'brand_id': fields.many2one('product.brand', 'Marca', readonly=True),
-		'factory_reference': fields.char('Referencia', readonly=True),
-		'genre_id': fields.many2one('product.genre', 'Genero', readonly=True),
-        'parent_id': fields.many2one('product.category', 'Categoria Padre', readonly=True),
-        'id_parent' : fields.many2one('product.category', 'Categoria Padre', readonly=True),
-    }
-    _order = 'product_id desc'
-
-    def init(self, cr):
-		tools.sql.drop_view_if_exists(cr, 'report_stockgral1')
-		cr.execute("""
-            CREATE OR REPLACE VIEW report_stockgral1 as (
-                SELECT	s.id as id,
-                        s.product_id as product_id,
-                        pt.list_price as unit_price,
-                        SUM(s.qty) as quantity,
-                        SUM(s.qty) * SUM(pt.list_price) as subtotal_venta,
-                        pt.product_brand_id as brand_id,
-                        pt.product_genre_id as genre_id,
-                        pt.categ_id as categ_id,
-                        pt.factory_reference as factory_reference,
-                        r.id as location_id,
-                        g.parent_id as parent_id,
-                        pcc.id_parent as id_parent
-                FROM stock_quant s
-                        left join stock_location r on (r.id=s.location_id)
-                        left join product_product p on (p.id=s.product_id)
-                        left join product_template pt on (pt.id=p.product_tmpl_id)
-                            left join product_brand z on (pt.product_brand_id=z.id)
-                            left join product_genre t on (pt.product_genre_id=t.id)
-                            left join product_category g on (g.id=pt.categ_id)
-                        left join product_uom u on (u.id=pt.uom_id)
-                        left join (SELECT pp.id, pp.parent_id,
-                          case when (select ppp.parent_id from product_category ppp where ppp.id= pp.parent_id and ppp.parent_id !=1) is NULL
-                          then pp.parent_id  ELSE
-                          (select ppp.parent_id from product_category ppp where ppp.id= pp.parent_id and ppp.parent_id !=1) END as id_parent
-                    from product_category pp) as pcc on pcc.id = pt.categ_id
-                WHERE r.usage='internal' and  s.qty>0 and  pt.active=True
-                GROUP BY s.id,s.product_id,r.id,pt.product_brand_id,pt.factory_reference,pt.categ_id,pt.product_genre_id,pt.list_price, g.parent_id,pcc.id_parent)
-		""")
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report_stockgral.pyc


+ 0 - 0
static/description/icon.png


+ 0 - 62
stockgral_filter_view.xml

@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-
-    <!-- <record id="view_order_product_graph1" model="ir.ui.view">
-         <field name="name">sale.report.graph1</field>
-         <field name="model">sale.reportgral</field>
-         <field name="arch" type="xml">
-             <graph string="Sales Analysis1" type="pivot" stacked="True">
-                 <field name="section_id" type="row"/>
-                 <field name="date" interval="month" type="col"/>
-                 <field name="price_total" type="measure"/>
-             </graph>
-         </field>
-    </record>  -->
-
-    <!-- Custom reports (aka filters) -->
-    <record id="filter_stockgral_report_loc" model="ir.filters">
-        <field name="name">Por Location</field>
-        <field name="model_id">report.stockgral1</field>
-        <field name="user_id" eval="False"/>
-        <field name="context">{'group_by': ['location_id']}</field>
-    </record>
-	<record id="filter_stockgral_report_producto" model="ir.filters">
-        <field name="name">Por Producto</field>
-        <field name="model_id">report.stockgral1</field>
-        <field name="user_id" eval="False"/>
-        <field name="context">{'group_by': ['product_id']}</field>
-    </record>
-
-
-    <record id="view_order_stockgral_search1" model="ir.ui.view">
-        <field name="name">stock.stockgral.search</field>
-        <field name="model">report.stockgral1</field>
-        <field name="arch" type="xml">
-            <search string="Analysis">
-              <!--Filtar por categorias padres  -->
-              <filter string="Accesorios" icon="terp-accessories-archiver" domain="[('id_parent','=',6)]"/>
-              <filter string="Ropas" icon="terp-accessories-archiver" domain="[('id_parent','=',5)]"/>
-              <filter string="Calzados" icon="terp-accessories-archiver" domain="[('id_parent','=',4)]"/>
-              <filter string="Pelotas" icon="terp-accessories-archiver" domain="[('id_parent','=',30)]"/>
-
-				       <field name="brand_id"/>
-				       <field name="genre_id"/>
-               <field name="categ_id"/>
-               <field name="product_id"/>
-               <field name="parent_id"/>
-               <group expand="1" string="Group By">
-                  <filter string="Marca" name="Marca" context="{'group_by':'brand_id'}"/>
-					        <filter string="Genero" name="Genero" context="{'group_by':'genre_id'}"/>
-                  <filter string="Categoria" name="Categoria" context="{'group_by':'categ_id'}"/>
-                  <filter string="Producto" name="Producto" context="{'group_by':'product_id'}"/>
-                  <filter string="Categoria Padre" name="Categoria Padre" context="{'group_by':'parent_id'}"/>
-               </group>
-            </search>
-        </field>
-    </record>
-
-   <!--  <menuitem action="action_order_report_all" id="menu_report_product_all" parent="base.next_id_64" sequence="10"/> -->
-
-</data>
-</openerp>

+ 0 - 12
stockgral_report.xml

@@ -1,12 +0,0 @@
-<!-- <?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-		<report id="report_ventasgral6"
-            model="report.stockgral1"
-            string="Listado General"
-            report_type="qweb-html"
-            name="report_stockgral.informe_stock_general_view"
-            file="report_stockgral.informe_stock_general_view"
-        />
-    </data>
-</openerp> -->

+ 5 - 5
informe_stock_general_view2.xml → views/informe_stock_product_view.xml

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
 	<data>
-		<report id="report_ventasgral7"
-            model="report.stockgral1"
+		<report id="report_stock_product"
+            model="report.stock.product"
             string="Listado General stock"
             report_type="qweb-pdf"
-            name="report_stockgral.informe_stock_general_view2"
-            file="report_stockgral.informe_stock_general_view2"
+            name="report_stock_product.informe_stock_product_view"
+            file="report_stock_product.informe_stock_product_view"
         />
 
-		<template id="informe_stock_general_view2">
+		<template id="informe_stock_product_view">
 			<t t-call="report.html_container">
 				<t t-call="report.internal_layout">
 					<div class="page">

+ 31 - 0
views/informe_stockgral_product_view.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+      <record id="report_stockgral_product_tree_view" model="ir.ui.view">
+            <field name="name">report.stockgral.template.tree.view</field>
+            <field name="model">report.stock.product</field>
+            <field name="priority" eval="20"/>
+            <field name="arch" type="xml">
+                <tree string="Listado General de Stock de Product " create="false">
+                    <field name="factory_reference" string="Referencia"/>
+					          <field name="product_id" string="Producto"/>
+					          <field name="quantity" string="Cantidad"/>
+				        </tree>
+            </field>
+      </record>
+
+		  <record id="action_report_stockgral_product_tree_view" model="ir.actions.act_window">
+            <field name="name">Listado General de Stock</field>
+            <field name="res_model">report.stock.product</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree</field>
+      </record>
+
+		<menuitem id="menu_gral_stock_product"
+              name=" Variantes de Producto "
+              parent="report_stockgral.stock_gral_menu"
+              action="action_report_stockgral_product_tree_view"
+              sequence="49"/>
+
+	</data>
+</openerp>

+ 36 - 0
views/stockgral_filter_product_view.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+    <record id="filter_stockgral_tmpl_report_loc" model="ir.filters">
+        <field name="name">Por Location</field>
+        <field name="model_id">report.stock.product</field>
+        <field name="user_id" eval="False"/>
+        <field name="context">{'group_by': ['location_id']}</field>
+    </record>
+
+    <record id="view_order_stockgral_tmpl_search1" model="ir.ui.view">
+        <field name="name">stock.stockgral.tmpl.search</field>
+        <field name="model">report.stock.product</field>
+        <field name="arch" type="xml">
+            <search string="Analysis">
+                <!--Filtar por categorias padres  -->
+                <filter string="Accesorios" icon="terp-accessories-archiver" domain="[('id_parent','=',6)]"/>
+                <filter string="Ropas" icon="terp-accessories-archiver" domain="[('id_parent','=',[5, 13])]"/>
+                <filter string="Calzados" icon="terp-accessories-archiver" domain="[('id_parent','=',4)]"/>
+                <filter string="Pelotas" icon="terp-accessories-archiver" domain="[('id_parent','=',30)]"/>
+
+				       <field name="brand_id"/>
+				       <field name="genre_id"/>
+               <field name="product_id"/>
+               <group expand="1" string="Group By">
+                  <filter string="Marca" name="Marca" context="{'group_by':'brand_id'}"/>
+					        <filter string="Genero" name="Genero" context="{'group_by':'genre_id'}"/>
+                  <filter string="Categoría Padre" name="Categoría Padre " context="{'group_by':'id_parent'}"/>
+
+                  <filter string="Producto" name="Producto" context="{'group_by':'product_id'}"/>
+               </group>
+            </search>
+        </field>
+    </record>
+</data>
+</openerp>