- Código
+ Código
|
@@ -119,7 +96,6 @@
[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]
[[a['label']==True and a['code'] or '' ]]
-
|
diff --git a/account_financial_report/report/balance_full_4_cols.rml b/account_financial_report/report/balance_full_4_cols.rml
index ba2007c9..3a590300 100644
--- a/account_financial_report/report/balance_full_4_cols.rml
+++ b/account_financial_report/report/balance_full_4_cols.rml
@@ -2,7 +2,7 @@
-
+
@@ -15,27 +15,22 @@
|
- [[ company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE' ]] |
+
+ [[ (company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE')]]
+ [[ company.partner_id.vat and ('- %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or '' ]]
+ |
|
- [[ (company.partner_id.vat and ('RIF: %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or removeParentNode('para')) ]] |
-
-
- |
- [[ get_inf_text(data['form']) ]] |
+ [[ get_informe_text(data['form']) ]][[data['form'] and (' (Expresado en %s)'%( company.currency_id.name)) or '']] |
|
[[data['form'] and get_month(data['form']) or '']] |
-
- |
- [[data['form'] and ('(Expresado en %s)'%(company.currency_id.symbol)) or '']] |
-
- [[ get_inf_text(data['form']) ]] / Pág.: -
+ [[ get_informe_text(data['form']) ]] / Pág.: -
@@ -84,7 +79,7 @@
[[setLang(user.context_lang)]]
-
+
diff --git a/account_financial_report/wizard/wizard_account_balance_2_report.py b/account_financial_report/wizard/wizard_account_balance_2_report.py
index bb41cb1a..64527f78 100644
--- a/account_financial_report/wizard/wizard_account_balance_2_report.py
+++ b/account_financial_report/wizard/wizard_account_balance_2_report.py
@@ -29,6 +29,7 @@
from osv import osv,fields
import pooler
import time
+
class wizard_account_balance_gene_2(osv.osv_memory):
_name = "wizard.report.account.balance.gene.2"
@@ -38,13 +39,14 @@ class wizard_account_balance_gene_2(osv.osv_memory):
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
- 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
+ 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'),
'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'),
- 'date_from': fields.date('Start date',required=True),
- 'date_to': fields.date('End date',required=True),
+ 'date_from': fields.date('Start date'),
+ 'date_to': fields.date('End date'),
'tot_check': fields.boolean('Show Total'),
'lab_str': fields.char('Description', size= 128),
- 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bdl','Libro Diario Legal')],'Tipo Informe',required=True),
+ 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True),
+ #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True),
}
_defaults = {
@@ -54,11 +56,20 @@ class wizard_account_balance_gene_2(osv.osv_memory):
'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1,
- 'fiscalyear': lambda *a: 1,
- 'display_account': lambda *a:'bal_mouvement',
-
+ 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid),
+ 'display_account': lambda *a:'con_movimiento',
}
-
+
+ def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None):
+ if context is None:
+ context = {}
+ res = {}
+ if filters in ("bydate","all"):
+ fisy = self.pool.get("account.fiscalyear")
+ fis_actual = fisy.browse(cr,uid,fiscalyear,context=context)
+ res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}}
+ return res
+
def _get_defaults(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -73,7 +84,6 @@ class wizard_account_balance_gene_2(osv.osv_memory):
data['form']['context'] = context
return data['form']
-
def _check_state(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -81,32 +91,58 @@ class wizard_account_balance_gene_2(osv.osv_memory):
self._check_date(cr, uid, data, context)
return data['form']
-
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
+
+ if data['form']['date_from'] > data['form']['date_to']:
+ raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial'))
+
sql = """SELECT f.id, f.date_start, f.date_stop
FROM account_fiscalyear f
- WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
+ WHERE '%s' = f.id """%(data['form']['fiscalyear'])
cr.execute(sql)
res = cr.dictfetchall()
+
if res:
- if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
- raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop']))
else:
return 'report'
else:
- raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
+ raise osv.except_osv(_('UserError'),'No existe periodo fiscal')
def print_report(self, cr, uid, ids,data, context=None):
if context is None:
context = {}
+
data = {}
data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(cr, uid, ids[0])
- return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene.2', 'datas': data}
-wizard_account_balance_gene_2()
+ if data['form']['filter'] == 'byperiod':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ elif data['form']['filter'] == 'bydate':
+ self._check_date(cr, uid, data)
+ del data['form']['periods']
+ elif data['form']['filter'] == 'none':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ del data['form']['periods']
+ else:
+ self._check_date(cr, uid, data)
+ lis2 = str(data['form']['periods']).replace("[","(").replace("]",")")
+ sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin
+ from account_period p
+ where p.id in %s"""%lis2
+ cr.execute(sqlmm)
+ minmax = cr.dictfetchall()
+ if minmax:
+ if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']):
+ raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio'))
+ return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene.2', 'datas': data}
+wizard_account_balance_gene_2()
diff --git a/account_financial_report/wizard/wizard_account_balance_4_report.py b/account_financial_report/wizard/wizard_account_balance_4_report.py
index 1c4b1343..5d20c6de 100644
--- a/account_financial_report/wizard/wizard_account_balance_4_report.py
+++ b/account_financial_report/wizard/wizard_account_balance_4_report.py
@@ -1,7 +1,35 @@
# -*- encoding: utf-8 -*-
+###########################################################################
+# Module Writen to OpenERP, Open Source Management Solution
+# Copyright (C) OpenERP Venezuela ().
+# All Rights Reserved
+###############Credits######################################################
+# Coded by: Humberto Arocha humberto@openerp.com.ve
+# Angelica Barrios angelicaisabelb@gmail.com
+# Jordi Esteve
+# Javier Duran
+# Planified by: Humberto Arocha
+# Finance by: LUBCAN COL S.A.S http://www.lubcancol.com
+# Audited by: Humberto Arocha humberto@openerp.com.ve
+#############################################################################
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+##############################################################################
+
from osv import osv,fields
import pooler
import time
+
class wizard_report(osv.osv_memory):
_name = "wizard.report"
@@ -11,13 +39,14 @@ class wizard_report(osv.osv_memory):
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
- 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
+ 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'),
'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'),
- 'date_from': fields.date('Start date',required=True),
- 'date_to': fields.date('End date',required=True),
+ 'date_from': fields.date('Start date'),
+ 'date_to': fields.date('End date'),
'tot_check': fields.boolean('Show Total'),
'lab_str': fields.char('Description', size= 128),
- 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bml','Libro Mayor Legal')],'Tipo Informe',required=True),
+ 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True),
+ #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True),
}
_defaults = {
@@ -27,11 +56,20 @@ class wizard_report(osv.osv_memory):
'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1,
- 'fiscalyear': lambda *a: 1,
- 'display_account': lambda *a:'bal_mouvement',
-
+ 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid),
+ 'display_account': lambda *a:'con_movimiento',
}
-
+
+ def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None):
+ if context is None:
+ context = {}
+ res = {}
+ if filters in ("bydate","all"):
+ fisy = self.pool.get("account.fiscalyear")
+ fis_actual = fisy.browse(cr,uid,fiscalyear,context=context)
+ res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}}
+ return res
+
def _get_defaults(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -46,7 +84,6 @@ class wizard_report(osv.osv_memory):
data['form']['context'] = context
return data['form']
-
def _check_state(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -54,30 +91,58 @@ class wizard_report(osv.osv_memory):
self._check_date(cr, uid, data, context)
return data['form']
-
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
+
+ if data['form']['date_from'] > data['form']['date_to']:
+ raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial'))
+
sql = """SELECT f.id, f.date_start, f.date_stop
FROM account_fiscalyear f
- WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
+ WHERE '%s' = f.id """%(data['form']['fiscalyear'])
cr.execute(sql)
res = cr.dictfetchall()
+
if res:
- if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
- raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop']))
else:
return 'report'
else:
- raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
+ raise osv.except_osv(_('UserError'),'No existe periodo fiscal')
def print_report(self, cr, uid, ids,data, context=None):
if context is None:
context = {}
+
data = {}
data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(cr, uid, ids[0])
- return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.report.reporte', 'datas': data}
+ if data['form']['filter'] == 'byperiod':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ elif data['form']['filter'] == 'bydate':
+ self._check_date(cr, uid, data)
+ del data['form']['periods']
+ elif data['form']['filter'] == 'none':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ del data['form']['periods']
+ else:
+ self._check_date(cr, uid, data)
+ lis2 = str(data['form']['periods']).replace("[","(").replace("]",")")
+ sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin
+ from account_period p
+ where p.id in %s"""%lis2
+ cr.execute(sqlmm)
+ minmax = cr.dictfetchall()
+ if minmax:
+ if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']):
+ raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio'))
+
+ return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.report.reporte', 'datas': data}
+
wizard_report()
diff --git a/account_financial_report/wizard/wizard_account_balance_report.py b/account_financial_report/wizard/wizard_account_balance_report.py
index 2ff078e0..48300d65 100644
--- a/account_financial_report/wizard/wizard_account_balance_report.py
+++ b/account_financial_report/wizard/wizard_account_balance_report.py
@@ -26,7 +26,6 @@
# along with this program. If not, see .
##############################################################################
-
from osv import osv,fields
import pooler
import time
@@ -40,13 +39,14 @@ class wizard_account_balance_gene(osv.osv_memory):
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
- 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
+ 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'),
'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'),
- 'date_from': fields.date('Start date',required=True),
- 'date_to': fields.date('End date',required=True),
+ 'date_from': fields.date('Start date'),
+ 'date_to': fields.date('End date'),
'tot_check': fields.boolean('Show Total'),
'lab_str': fields.char('Description', size= 128),
'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True),
+ #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True),
}
_defaults = {
@@ -56,11 +56,20 @@ class wizard_account_balance_gene(osv.osv_memory):
'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1,
- 'fiscalyear': lambda *a: 1,
- 'display_account': lambda *a:'bal_mouvement',
-
+ 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid),
+ 'display_account': lambda *a:'con_movimiento',
}
-
+
+ def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None):
+ if context is None:
+ context = {}
+ res = {}
+ if filters in ("bydate","all"):
+ fisy = self.pool.get("account.fiscalyear")
+ fis_actual = fisy.browse(cr,uid,fiscalyear,context=context)
+ res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}}
+ return res
+
def _get_defaults(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -75,7 +84,6 @@ class wizard_account_balance_gene(osv.osv_memory):
data['form']['context'] = context
return data['form']
-
def _check_state(self, cr, uid, data, context=None):
if context is None:
context = {}
@@ -83,34 +91,58 @@ class wizard_account_balance_gene(osv.osv_memory):
self._check_date(cr, uid, data, context)
return data['form']
-
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
+
+ if data['form']['date_from'] > data['form']['date_to']:
+ raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial'))
+
sql = """SELECT f.id, f.date_start, f.date_stop
FROM account_fiscalyear f
- WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
+ WHERE '%s' = f.id """%(data['form']['fiscalyear'])
cr.execute(sql)
res = cr.dictfetchall()
+
if res:
- if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
- raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop']))
else:
return 'report'
else:
- raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
+ raise osv.except_osv(_('UserError'),'No existe periodo fiscal')
def print_report(self, cr, uid, ids,data, context=None):
if context is None:
context = {}
+
data = {}
data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(cr, uid, ids[0])
-
- print 'data',data
-
+
+ if data['form']['filter'] == 'byperiod':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ elif data['form']['filter'] == 'bydate':
+ self._check_date(cr, uid, data)
+ del data['form']['periods']
+ elif data['form']['filter'] == 'none':
+ del data['form']['date_from']
+ del data['form']['date_to']
+ del data['form']['periods']
+ else:
+ self._check_date(cr, uid, data)
+ lis2 = str(data['form']['periods']).replace("[","(").replace("]",")")
+ sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin
+ from account_period p
+ where p.id in %s"""%lis2
+ cr.execute(sqlmm)
+ minmax = cr.dictfetchall()
+ if minmax:
+ if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']):
+ raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio'))
+
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene', 'datas': data}
wizard_account_balance_gene()
-
| |