sebas 8 лет назад
Сommit
2e1ef8eba6

+ 29 - 0
__init__.py

@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_brand for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>   #
+#                                                                               #
+#    This program is free software: you can redistribute it and/or modify       #
+#    it under the terms of the GNU Affero General Public License as             #
+#    published by the Free Software Foundation, either version 3 of the         #
+#    License, or (at your option) any later version.                            #
+#                                                                               #
+#    This program is distributed in the hope that it will be useful,            #
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of             #
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
+#    GNU Affero General Public License for more details.                        #
+#                                                                               #
+#    You should have received a copy of the GNU Affero General Public License   #
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product Brand is an Openobject module wich enable Brand management for products #
+###################################################################################
+from . import analisis_salida
+from . import report_salida
+import math


+ 49 - 0
__openerp__.py

@@ -0,0 +1,49 @@
+# -*- 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': 'Analisis de Salida sobre Diario de Cuentas',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Analisis de Salida sobre Diario de Cuentas
+====================================================
+
+Analisis de Salida sobre Diario de Cuentas
+- Cuenta con varios filtros y muestra los siguientes datos: fecha, partner, referencia, monto, fecha
+
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['account','hr', 'report'],
+    'data': [
+		'informe_analisis_salida_view.xml',
+        'analisissalida_filter_view.xml',
+        'informe_salida_por_fecha.xml',
+    ],
+    'installable': True,
+}

+ 61 - 0
analisis_salida.py

@@ -0,0 +1,61 @@
+# -*- 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/>.
+#                                     r.employee_id as         'amount_salida': fields.float('Total Salida', readonly=True),
+#            GROUP BY p.id ,l.partner_id,l.journal_id,l.create_date,l.amount_total,s.total
+
+##############################################################################
+
+from openerp import tools
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
+
+
+class salida_analisis(osv.osv):
+    _name = "salida.analisis"
+    _description = "Analisis de Salida S/ pagos a personal"
+    _auto = False
+
+    _columns = {
+        'rnumber': fields.char('Referencia', readonly=True),
+        'name': fields.char('Descripcion', readonly=True),
+        'partner_id': fields.many2one('res.partner', 'Proveedor', readonly=True),
+        'amount_salida': fields.float('Total Salida', readonly=True),
+        'date_x': fields.datetime('Date Order', readonly=True),
+    }
+    _order = 'date_x desc'
+
+
+    def init(self, cr):
+            tools.sql.drop_view_if_exists(cr, 'salida_analisis')
+            cr.execute("""
+                CREATE OR REPLACE VIEW salida_analisis AS (
+                     SELECT l.id as id,
+                           l.number as rnumber,
+                           r.ref as name,
+                           l.partner_id as partner_id,
+                           l.amount AS amount_salida,
+                           l.create_date as date_x
+                      FROM account_move r
+                      left join account_voucher l on (r.id=l.move_id)
+                      WHERE l.state='posted' and l.type='payment'
+                      GROUP BY l.id,l.number, r.ref,l.partner_id, l.amount,l.create_date
+                )
+             """)
+salida_analisis()

BIN
analisis_salida.pyc


+ 48 - 0
analisissalida_filter_view.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+
+    <!-- Custom reports (aka filters) -->
+
+   <record id="filter_analisis_salida_diario1" model="ir.filters">
+        <field name="name">Por Mes</field>
+        <field name="model_id">salida.analisis</field>
+        <field name="journal_id" eval="False"/>
+        <field name="context">{'group_by': ['date_x:month']}</field>
+    </record>
+
+    <record id="filter_analisis_proveedor_diario2" model="ir.filters">
+         <field name="name">Por Proveedor</field>
+         <field name="model_id">salida.analisis</field>
+         <field name="journal_id" eval="False"/>
+         <field name="context">{'group_by': ['partner_id']}</field>
+     </record>
+
+    <record id="view_order_salida_search2" model="ir.ui.view">
+        <field name="name">salida.analisis.search</field>
+        <field name="model">salida.analisis</field>
+        <field name="arch" type="xml">
+            <search string="Analisis de Salida ">
+                <filter string="Este año" name="year" domain="[('date_x','&lt;=', time.strftime('%%Y-12-31')),('date_x','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                <filter string="Año pasado  " domain="[('date_x','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('date_x','&lt;=', time.strftime('%%Y-01-01'))]"/>
+                <filter string="Mes actual" domain="[('date_x','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('date_x','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                <filter string="Mes pasado" domain="[('date_x','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('date_x','&lt;',time.strftime('%%Y-%%m-01'))]"/>
+                <filter string="Hoy" domain="[('date_x', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_x', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                <filter string=" Ayer " domain="[('date_x','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('date_x','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+                <filter string="Semana anterior" domain="[('date_x', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_x', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <filter string="Esta semana" domain="[('date_x', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_x', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <separator/>
+                <group expand="0" string="Filtros Extendidos">
+                    <field name="partner_id"/>
+                    <filter string="Guarani" name="currency_id" domain="[('currency_id','=','PYG')]"/>
+                    <filter string="Dolar" name="currency_id" domain="[('currency_id','=','USD')]"/>
+                    <filter string="Mes" context="{'group_by':'date_x:month'}"/>
+                    <filter string="Por dia" context="{'group_by':'date_x:day'}"/>
+                </group>
+            </search>
+        </field>
+    </record>
+</data>
+</openerp>

+ 58 - 0
analisissalida_view.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+
+    <!-- Custom reports (aka filters) -->
+
+    <record id="filter_analisis_salida_diario1" model="ir.filters">
+        <field name="name">Por Mes</field>
+        <field name="model_id">salida.analisis</field>
+        <field name="journal_id" eval="False"/>
+        <field name="context">{'group_by': ['date_x:month']}</field>
+    </record>
+
+    <record id="filter_analisis_salida_diario" model="ir.filters">
+         <field name="name">Por Moneda/Mes</field>
+         <field name="model_id">salida.analisis</field>
+         <field name="journal_id" eval="False"/>
+         <field name="context">{'group_by': ['date_x:month', 'currency_id']}</field>
+     </record>
+
+     <record id="filter_analisis_salida_diariomes" model="ir.filters">
+          <field name="name">Por Diario</field>
+          <field name="model_id">salida.analisis</field>
+          <field name="journal_id" eval="False"/>
+          <field name="context">{'group_by': ['currency_id']}</field>
+      </record>
+
+    <record id="view_order_salida_search2" model="ir.ui.view">
+        <field name="name">salida.analisis.search</field>
+        <field name="model">salida.analisis</field>
+        <field name="arch" type="xml">
+            <search string="Analisis de Salida ">
+                <filter string="Este año" name="year" domain="[('date_x','&lt;=', time.strftime('%%Y-12-31')),('date_x','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                <filter string="Hoy" domain="[('date_x', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_x', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                <filter string="Semana anterior" domain="[('date_x', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_x', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <filter string="Esta semana" domain="[('date_x', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_x', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                <filter string="Egreso" name="salida" domain="[('type','=','payment')]"/>
+                <separator/>
+                <group expand="0" string="Filtros Extendidos">
+                    <filter string="Moneda" name="currency_id"/>
+                    <filter string="Guarani" name="currency_id" domain="[('currency_id','=','PYG')]"/>
+                    <filter string="Dolar" name="currency_id" domain="[('currency_id','=','USD')]"/>
+                    <filter string="Proveedor" name="partner_id"/>
+                </group>
+                <group expand="1" string="Agrupado por">
+                    <filter string="Mes" context="{'group_by':'date_x:month'}"/>
+                    <filter string="Por dia" context="{'group_by':'date_x:day'}"/>
+                </group>
+            </search>
+        </field>
+    </record>
+
+
+
+</data>
+</openerp>

+ 35 - 0
informe_analisis_salida_view.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="salida_analisis_tree_view" model="ir.ui.view">
+            <field name="name">salida.analisis.tree.view</field>
+            <field name="model">salida.analisis</field>
+            <field name="priority" eval="20"/>
+            <field name="arch" type="xml">
+            <tree string="Analisis de Salida sobre Diario de Cuentas" create="false">
+            <field name="id" invisible="1"/>
+            <field name="partner_id"/>
+            <field name="rnumber"/>
+            <field name="name"/>
+            <field name="amount_salida" sum="totalsal" string="Total Salida"/>
+            <field name="date_x" string="Fecha"/>
+				</tree>
+            </field>
+        </record>
+
+
+
+		<record id="action_salida_analisis_tree_view" model="ir.actions.act_window">
+            <field name="name">Analisis de Salida sobre Diario de Cuentas</field>
+            <field name="res_model">salida.analisis</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree</field>
+        </record>
+
+
+
+		<menuitem name="Analisis de Salida sobre Diario de Cuentas" sequence="47" id="menu_analisissalida_gral" parent="base.menu_reporting"/>
+		<menuitem id="salida_analisis_menu" name="Analisis de Salida sobre Diario de Cuentas" parent="menu_analisissalida_gral" action="action_salida_analisis_tree_view"/>
+
+	</data>
+</openerp>

+ 91 - 0
informe_salida_por_fecha.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<report id="report_diariosalida3"
+            model="salida.analisis"
+            string="Listado de Salida"
+            report_type="qweb-pdf"
+            name="analisis_salida.informe_salida_por_fecha"
+            file="analisis_salida.informe_salida_por_fecha"
+    />
+
+		<template id="informe_salida_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 Entrada y Salida</h4>
+						<div class="logo1" />
+
+						  <table class="table table-condensed">
+							<thead class="crm_tcab">
+								<tr class="active">
+									<th class="text-center">Cliente</th>
+									<th class="text-center">Referencia</th>
+									<th class="text-center">Descripcion</th>
+									<th class="text-center">Salida</th>
+									<th class="text-center">Fecha</th>
+								</tr>
+							</thead>
+							<t t-foreach="docs" t-as="o">
+							<tbody>
+									<tr>
+										<td class="text-left">
+											<span t-esc="o.partner_id.name"/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.rnumber"/>
+										</td>
+										<td class="text-left">
+											<span t-esc="o.name"/>
+										</td>
+										<td class="text-right">
+											<span t-field="o.amount_salida"/>
+										</td>
+										<td>
+											<span t-field="o.date_x" t-field-options='{"widget": "date"}'/>
+										</td>
+									</tr>
+							</tbody>
+							</t>
+
+							    <tr>
+												 <td colspan="8"></td>
+														 </tr>
+														 <tr class="border-black">
+																 <td colspan="3">Total:</td>
+																 <td class="text-right">
+	  																<t t-set="totalsal" t-value="sum([x.amount_salida for x in docs])"/>
+	  																<span t-esc="totalsal" t-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
+															  </td>
+
+								 </tr>
+						  </table>
+
+					</div>
+				</t>
+			</t>
+		</template>
+	</data>
+</openerp>

+ 55 - 0
report_salida.py

@@ -0,0 +1,55 @@
+#    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
+
+# class product_product(osv.Model):
+    # _inherit = 'product.product'
+
+    # def _sales_count(self, cr, uid, ids, field_name, arg, context=None):
+        # SaleOrderLine = self.pool['sale.order.line']
+        # return {
+            # product_id: SaleOrderLine.search_count(cr,uid, [('product_id', '=', product_id)], context=context)
+            # for product_id in ids
+        # }
+
+    # _columns = {
+        # 'sales_count': fields.function(_sales_count, string='# Sales', type='integer'),
+
+    # }
+
+# class product_template(osv.Model):
+    # _inherit = 'product.template'
+
+    # def _sales_count(self, cr, uid, ids, field_name, arg, context=None):
+        # res = dict.fromkeys(ids, 0)
+        # for template in self.browse(cr, uid, ids, context=context):
+            # res[template.id] = sum([p.sales_count for p in template.product_variant_ids])
+        # return res
+    
+    # def action_view_sales(self, cr, uid, ids, context=None):
+        # act_obj = self.pool.get('ir.actions.act_window')
+        # mod_obj = self.pool.get('ir.model.data')
+        # product_ids = []
+        # for template in self.browse(cr, uid, ids, context=context):
+            # product_ids += [x.id for x in template.product_variant_ids]
+        # result = mod_obj.xmlid_to_res_id(cr, uid, 'sale.action_order_line_product_tree',raise_if_not_found=True)
+        # result = act_obj.read(cr, uid, [result], context=context)[0]
+        # result['domain'] = "[('product_id','in',[" + ','.join(map(str, product_ids)) + "])]"
+        # return result
+    
+    
+    # _columns = {
+        # 'sales_count': fields.function(_sales_count, string='# Sales', type='integer'),
+
+    # }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
report_salida.pyc


BIN
static/description/icon.png