Kaynağa Gözat

report_stockgral_tmp

sebas 7 yıl önce
işleme
4d35202aef

+ 3 - 0
__init__.py

@@ -0,0 +1,3 @@
+# -*- encoding: utf-8 -*-
+
+from . import models

BIN
__init__.pyc


+ 26 - 0
__openerp__.py

@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+
+{   'name': 'Listado General de Stock Producto Template',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Listado General de Stock Valorizado de Producto Padres
+======================================================
+
+Genera General de Stock Valorizado
+- Por Location
+- Por Genero
+- Por Marca
+- Por Categoria Padre
+
+    """,
+    'author': 'Adrielso kunert',
+    'website': '',
+	'depends': ['stock', 'report', 'report_stockgral'],
+    'data': ['views/informe_stockgral_tmpl_view.xml',
+             'views/stockgral_filter_view.xml',
+		     'views/informe_stock_general_view1.xml',
+
+    ],
+    'installable': True,
+}

+ 3 - 0
models/__init__.py

@@ -0,0 +1,3 @@
+# -*- encoding: utf-8 -*-
+import report_stockgral_tmpl
+import math

BIN
models/__init__.pyc


+ 53 - 0
models/report_stockgral_tmpl.py

@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+from openerp import tools, models, fields, api
+from openerp.osv import fields, osv
+
+class Report_Stockgral_Template(models.Model):
+
+    _name = "report.stockgral.template"
+    _description = "Stock_general_template"
+    _auto = False
+    _columns = {
+    	'quantity': fields.float('Cantidad', readonly=True),
+        'location_id': fields.many2one('stock.location', 'Ubicacion',  readonly=True),
+        'product_tmpl_id': fields.many2one('product.template', 'Product', required=True, select=True, readonly=True),
+	    'brand_id': fields.many2one('product.brand', 'Marca', readonly=True),
+        'genre_id': fields.many2one('product.genre', 'Genero', readonly=True),
+        'factory_reference': fields.char('Referencia', readonly=True),
+		'parent_id': fields.many2one('product.category', 'Categoria Padre', readonly=True),
+
+    }
+    _order = 'product_tmpl_id desc'
+
+    def init(self, cr):
+		tools.sql.drop_view_if_exists(cr, 'report_stockgral_template')
+		cr.execute("""
+            CREATE OR REPLACE VIEW report_stockgral_template as (
+                select 	row_number() over (ORDER BY product_tmpl_id)as id,
+	sum(sq.qty) as quantity,
+	sq.location_id as location_id,
+	pp.product_tmpl_id as product_tmpl_id,
+	pt.product_brand_id as brand_id,
+	pt.product_genre_id as genre_id,
+	pt.factory_reference as factory_reference,
+    pcc.id_parent as parent_id
+from stock_quant sq
+	left join stock_location sl on (sl.id = sq.location_id)
+        left join product_product pp on (pp.id = sq.product_id)
+        left join product_template pt on (pt.id = pp.product_tmpl_id)
+        left join product_brand pb on (pt.product_brand_id = pb.id)
+        left join product_genre pg on (pt.product_genre_id = pg.id)
+        left join product_category pc on (pc.id = pt.categ_id)
+	left join product_uom pu on (pu.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 sq.qty > 0 and pt.active=True AND sl.usage='internal'
+GROUP BY sq.location_id, pp.product_tmpl_id, pt.product_brand_id, pt.product_genre_id, pt.factory_reference, pcc.id_parent)
+		""")
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
models/report_stockgral_tmpl.pyc


BIN
static/description/icon.png


+ 86 - 0
views/informe_stock_general_view1.xml

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_ventasgral8"
+            model="report.stockgral.template"
+            string="Listado General de Categoria Padres"
+            report_type="qweb-pdf"
+            name="report_stockgral_tmp.informe_stock_general_view1"
+            file="report_stockgral_tmp.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>
+								</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_tmpl_id"/>
+										</td>
+
+										<td class="text-right">
+											<span t-field="o.quantity"/>
+										</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.quantity for x in docs])"/>
+																	<span t-esc="total"/>
+															</td>
+
+                            </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 31 - 0
views/informe_stockgral_tmpl_view.xml

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

+ 67 - 0
views/informe_stockgralxcliente.xml

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

+ 36 - 0
views/stockgral_filter_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.stockgral.template</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.stockgral.template</field>
+        <field name="arch" type="xml">
+            <search string="Analysis">
+                <!--Filtar por categorias padres  -->
+                <filter string="Ropas" icon="terp-accessories-archiver" domain="[('categ_id','child_of',[5])]"/>
+                <filter string="Accesorios" icon="terp-accessories-archiver" domain="[('categ_id','child_of',[6])]"/>
+                <filter string="Calzados" icon="terp-accessories-archiver" domain="[('categ_id','child_of',[4])]"/>
+                <filter string="Pelotas" icon="terp-accessories-archiver" domain="[('categ_id','child_of',[30])]"/>
+                <field name="brand_id"/>
+                <field name="genre_id"/>
+                <field name="parent_id"/>
+                <field name="product_tmpl_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':'parent_id'}"/>
+                    <filter string="Producto" name="Producto" context="{'group_by':'product_tmpl_id'}"/>
+               </group>
+            </search>
+        </field>
+    </record>
+</data>
+</openerp>