소스 검색

Agregar filtrode fecha en auditoría

SEBAS 2 년 전
커밋
7960969c0b
7개의 변경된 파일93개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 51 0
      __openerp__.py
  4. 8 0
      audit.py
  5. BIN
      audit.pyc
  6. BIN
      static/description/icon.png
  7. 28 0
      view/audit_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 audit

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 para Auditoría",
+    'version': '8.0.0.1.0',
+    'category': 'Tools',
+    'sequence': 14,
+    'author':  'Sebastian Penayo/Eiru',
+    'website': '',
+    'license': 'AGPL-3',
+    'summary': '',
+    'description': """
+Filtros de Auditoría
+=====================
+Este modulo es una extension del modulo Auditoría que permite filtrar por dia, semana.
+""",
+    'depends': [
+        'smile_audit',
+    ],
+    'external_dependencies': {
+    },
+    'data': [
+        'view/audit_view.xml'
+    ],
+    'demo': [
+    ],
+    'test': [
+    ],
+    'installable': True,
+    'auto_install': False,
+    'application': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 8 - 0
audit.py

@@ -0,0 +1,8 @@
+# -*- 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

BIN
audit.pyc


BIN
static/description/icon.png


+ 28 - 0
view/audit_view.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_audit_logfilter_search" model="ir.ui.view">
+            <field name="name">audit.log.filter.search</field>
+            <field name="model">audit.log</field>
+            <field name="inherit_id" ref="smile_audit.view_audit_log_search" />
+            <field name="arch" type="xml">
+              <search>
+                  <filter string="Este año" name="year" domain="[('create_date','&lt;=', time.strftime('%%Y-12-31')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"/>
+                  <filter string="Año pasado  " domain="[('create_date','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('create_date','&lt;=', time.strftime('%%Y-01-01'))]"/>
+                  <filter string="Mes actual" domain="[('create_date','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Mes pasado" domain="[('create_date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('create_date','&lt;',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Hoy" domain="[('create_date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('create_date', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                  <filter string="Ayer" domain="[('create_date','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+                  <filter string="Semana anterior" domain="[('create_date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('create_date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Esta semana" domain="[('create_date', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('create_date', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <separator/>
+                  <group string="Agrupar por">
+                      <filter string="Por dia" context="{'group_by':'create_date:day'}"/>
+                  </group>
+               </search>
+            </field>
+        </record>
+
+    </data>
+</openerp>