Browse Source

commit filter_accountinvoices

sebas 8 years ago
commit
0f05d4fa5e
7 changed files with 115 additions and 0 deletions
  1. 6 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 51 0
      __openerp__.py
  4. 20 0
      account_invoicefilter.py
  5. BIN
      account_invoicefilter.pyc
  6. BIN
      static/description/icon.png
  7. 38 0
      view/account_invoice_view.xml

+ 6 - 0
__init__.py

@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in module root
+# directory
+##############################################################################
+from . import account_invoicefilter

BIN
__init__.pyc


+ 51 - 0
__openerp__.py

@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2015  ADHOC SA  (http://www.adhoc.com.ar)
+#    All Rights Reserved.
+#
+#    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/>.
+#
+##############################################################################
+{
+    "name": "Filtros de Facturas por Monedas y Diario",
+    'version': '8.0.0.1.0',
+    'category': 'Tools',
+    'sequence': 14,
+    'author':  'Sebastian Penayo/Eiru',
+    'website': '',
+    'license': 'AGPL-3',
+    'summary': '',
+    'description': """
+Filtros de Facturas por Monedas y Diario
+=====================
+Este modulo es una extension del modulo account_invoice que permite filtrar por monedas y filtrar por diario.
+""",
+    'depends': [
+        'account',
+    ],
+    'external_dependencies': {
+    },
+    'data': [
+        'view/account_invoice_view.xml'
+    ],
+    'demo': [
+    ],
+    'test': [
+    ],
+    'installable': True,
+    'auto_install': False,
+    'application': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 20 - 0
account_invoicefilter.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in module root
+# directory
+##############################################################################
+from openerp import models, api, fields, _
+from datetime import datetime
+import json
+
+# class account_invoice(models.Model):
+#    _inherit = 'account.invoice'
+
+#     date_day = fields.Char(string='Date Day',compute='_get_date_day',store=True,readonly=True)
+
+#    date_month = fields.Char(string='Date Month',compute='_get_date_month',store=True,readonly=True)
+
+#    @api.one
+#    @api.depends('date_invoice')
+#    def _get_date_day(self):
+#        self.date_day = datetime.strptime(self.date_invoice,'%Y-%m-%d').strftime('%d')

BIN
account_invoicefilter.pyc


BIN
static/description/icon.png


+ 38 - 0
view/account_invoice_view.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_account_invoicesfilter_search1" model="ir.ui.view">
+            <field name="name">account.invoices.filter.search1</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.view_account_invoice_filter" />
+            <field name="arch" type="xml">
+              <search>
+
+                  <separator/>
+                  <filter string="Este año" name="year" domain="[('date_invoice','&lt;=', time.strftime('%%Y-12-31')),('date_invoice','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                  <filter string="Año pasado " domain="[('date_invoice','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('date_invoice','&lt;=', time.strftime('%%Y-01-01'))]"/>
+                  <filter string="Mes actual" domain="[('date_invoice','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('date_invoice','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Mes pasado" domain="[('date_invoice','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('date_invoice','&lt;',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Semana anterior" domain="[('date_invoice', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_invoice', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Esta semana" domain="[('date_invoice', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date_invoice', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Hoy" domain="[('date_invoice', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_invoice', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                  <filter string=" Ayer " domain="[('date_invoice','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('date_invoice','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+                  <filter string="Guarani" name="currency_id" domain="[('currency_id','=','PYG')]"/>
+                  <filter string="Dolar" name="currency_id" domain="[('currency_id','=','USD')]"/>
+                  <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"/>
+
+                  <separator/>
+                  <group string="Agrupar por">
+                      <filter string="Journal" context="{'group_by':'journal_id'}"/>
+                      <filter string="Por dia" context="{'group_by':'date_invoice:day'}"/>
+                      <filter string="Por Mes" context="{'group_by':'date_invoice:month'}"/>
+                  </group>
+               </search>
+            </field>
+        </record>
+
+
+    </data>
+</openerp>