Humberto Arocha
12 years ago
28 changed files with 0 additions and 10673 deletions
-
29l10n_ve_account_financial_report/__init__.py
-
35l10n_ve_account_financial_report/__openerp__.py
-
1120l10n_ve_account_financial_report/i18n/account_financial_report.pot
-
1154l10n_ve_account_financial_report/i18n/ca.po
-
1139l10n_ve_account_financial_report/i18n/ca_ES.po
-
1154l10n_ve_account_financial_report/i18n/es.po
-
1132l10n_ve_account_financial_report/i18n/es_ES.po
-
1149l10n_ve_account_financial_report/i18n/pl.po
-
21l10n_ve_account_financial_report/report/__init__.py
-
383l10n_ve_account_financial_report/report/account_analisis_cuentas.py
-
329l10n_ve_account_financial_report/report/account_balance.py
-
269l10n_ve_account_financial_report/report/account_balance_2_cols.py
-
334l10n_ve_account_financial_report/report/account_balance_4_cols.py
-
398l10n_ve_account_financial_report/report/account_mayor_analitico.py
-
228l10n_ve_account_financial_report/report/analisis_cuentas.rml
-
132l10n_ve_account_financial_report/report/balance_full.rml
-
132l10n_ve_account_financial_report/report/balance_full_2_cols.rml
-
148l10n_ve_account_financial_report/report/balance_full_4_cols.rml
-
151l10n_ve_account_financial_report/report/balance_full_4_cols_h.rml
-
148l10n_ve_account_financial_report/report/balance_full_4_cols_v.rml
-
245l10n_ve_account_financial_report/report/mayor_analitico.rml
-
20l10n_ve_account_financial_report/wizard/__init__.py
-
144l10n_ve_account_financial_report/wizard/account_report_wizard.xml
-
153l10n_ve_account_financial_report/wizard/wizard_account_balance_2_report.py
-
186l10n_ve_account_financial_report/wizard/wizard_account_balance_4_report.py
-
153l10n_ve_account_financial_report/wizard/wizard_account_balance_report.py
-
128l10n_ve_account_financial_report/wizard/wizard_account_libro_mayor_report.py
-
59l10n_ve_account_financial_report/wizard_report_report.xml
@ -1,29 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# Coded by: Humberto Arocha humberto@openerp.com.ve |
|||
# Angelica Barrios angelicaisabelb@gmail.com |
|||
# Jordi Esteve <jesteve@zikzakmedia.com> |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import report |
|||
import wizard |
@ -1,35 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
{ |
|||
"name" : "Reportes Financieros", |
|||
"version" : "0.3", |
|||
"author" : "Vauxoo & Industrias Diana C.A.", |
|||
"website" : "http://wiki.openerp.org.ve/", |
|||
"depends" : ["base","account"], |
|||
"category" : "Localisation/Accounting", |
|||
"description": """ |
|||
Modulo para Generar reportes financieros |
|||
""", |
|||
"init_xml" : [], |
|||
"demo_xml" : [], |
|||
"update_xml" : [ |
|||
"wizard_report_report.xml", |
|||
"wizard/account_report_wizard.xml", |
|||
#~ "wizard/account_mayor_analitico.xml", |
|||
], |
|||
"active": False, |
|||
"installable": True, |
|||
} |
1120
l10n_ve_account_financial_report/i18n/account_financial_report.pot
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1154
l10n_ve_account_financial_report/i18n/ca.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1139
l10n_ve_account_financial_report/i18n/ca_ES.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1154
l10n_ve_account_financial_report/i18n/es.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1132
l10n_ve_account_financial_report/i18n/es_ES.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1149
l10n_ve_account_financial_report/i18n/pl.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,21 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import account_balance_4_cols |
|||
import account_balance_2_cols |
|||
import account_balance |
|||
import account_mayor_analitico |
|||
import account_analisis_cuentas |
@ -1,383 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import xml |
|||
import copy |
|||
from operator import itemgetter |
|||
import time |
|||
import datetime |
|||
from report import report_sxw |
|||
from tools import config |
|||
|
|||
|
|||
class account_analisis_cuentas(report_sxw.rml_parse): |
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
super(account_analisis_cuentas, self).__init__(cr, uid, name, context) |
|||
self.sum_debit = 0.00 |
|||
self.sum_credit = 0.00 |
|||
self.sum_balance = 0.00 |
|||
self.sum_debit_fy = 0.00 |
|||
self.sum_credit_fy = 0.00 |
|||
self.sum_balance_fy = 0.00 |
|||
self.date_lst = [] |
|||
self.date_lst_string = '' |
|||
self.localcontext.update({ |
|||
'time': time, |
|||
'lines': self.lines, |
|||
'get_fiscalyear_text': self.get_fiscalyear_text, |
|||
'get_periods_and_date_text': self.get_periods_and_date_text, |
|||
'get_inf_text': self.get_informe_text, |
|||
'set_fecha': self.set_fecha, |
|||
}) |
|||
self.context = context |
|||
|
|||
def set_fecha(self, fecha): |
|||
f = fecha.split('-') |
|||
date = datetime.date(int(f[0]),int(f[1]),int(f[2])) |
|||
return str(date.strftime("%d/%m/%Y")) |
|||
|
|||
def get_fiscalyear_text(self, form): |
|||
""" |
|||
Returns the fiscal year text used on the report. |
|||
""" |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
return fiscalyear.name or fiscalyear.code |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
return "%s*" % (fiscalyear.name or fiscalyear.code) |
|||
|
|||
def get_informe_text(self, form): |
|||
""" |
|||
Returns the header text used on the report. |
|||
""" |
|||
inf_type = { |
|||
'bgen' : ' Balance General', |
|||
'bcom' : ' Balance de Comprobacion', |
|||
'edogp': 'Estado de Ganancias y Perdidas', |
|||
'bac': ' Analisis de Cuentas', |
|||
'bml': ' Mayor Analitico' |
|||
} |
|||
return inf_type[form['inf_type']] |
|||
|
|||
def get_periods_and_date_text(self, form): |
|||
""" |
|||
Returns the text with the periods/dates used on the report. |
|||
""" |
|||
period_obj = self.pool.get('account.period') |
|||
periods_str = None |
|||
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
|||
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id), ('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
period_ids = form['periods'] |
|||
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
|||
|
|||
dates_str = None |
|||
if form['filter'] in ['bydate', 'all']: |
|||
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
|||
return {'periods':periods_str, 'date':dates_str} |
|||
|
|||
def es_especial(self, periods): |
|||
period_obj = self.pool.get('account.period') |
|||
period_brws = period_obj.browse(self.cr, self.uid, periods) |
|||
tod=0 |
|||
for p_b in period_brws: |
|||
if p_b.special: |
|||
tod = tod + 1 |
|||
if tod == len(periods): |
|||
return True |
|||
else: |
|||
return False |
|||
|
|||
def calcular_debito_credito(self, account, form): |
|||
res = {} |
|||
if form['filter'] in ('bydate','none'): |
|||
#Para filtrar por 'fechas' o 'sin filtro', este porque se envia el año fiscal por fecha. |
|||
where = """ and aml.date between '%s' and '%s'"""%(form['date_from'],form['date_to']) |
|||
elif form['filter'] == 'byperiod': |
|||
#Para filtrar por periodos |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """ and aml.period_id in %s"""%(periodos) |
|||
else: |
|||
#Para filtrar por periodos y fechas |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """ and aml.period_id in %s and aml.date between '%s' and '%s'"""%(periodos,form['date_from'],form['date_to']) |
|||
if form.get('state'): |
|||
estado = " and am.state = '%s'"%form['state'] |
|||
where = where + estado |
|||
|
|||
analytic_list = str(form['analytic_list']).replace("[","(").replace("]",")") |
|||
where = where + " and aaa.id in " + analytic_list |
|||
|
|||
account_list = str(account).replace("[","(").replace("]",")") |
|||
where = where + " and aa.id in " + account_list |
|||
|
|||
sql_saldos = """select aml.account_id as id, |
|||
COALESCE(SUM(aml.debit), 0) as debit, |
|||
COALESCE(SUM(aml.credit), 0) as credit |
|||
from account_move_line aml |
|||
inner join account_analytic_account aaa on aml.analytic_account_id = aaa.id |
|||
inner join account_journal aj on aj.id = aml.journal_id |
|||
inner join account_account aa on aa.id = aml.account_id |
|||
inner join account_period ap on ap.id = aml.period_id |
|||
inner join account_move am on am.id = aml.move_id |
|||
where aml.state <> 'draft'""" + where + \ |
|||
""" group by aml.account_id""" |
|||
|
|||
self.cr.execute(sql_saldos) |
|||
resultat = self.cr.dictfetchall() |
|||
|
|||
for det in resultat: |
|||
res[det['id']] = { |
|||
'debit': det['debit'], |
|||
'credit': det['credit'], |
|||
} |
|||
return res |
|||
|
|||
def _get_analisis_cuenta_analitica(self, account, form): |
|||
res = [] |
|||
if form['filter'] in ('bydate','none'): |
|||
#Para filtrar por 'fechas' o 'sin filtro', este porque se envia el año fiscal por fecha. |
|||
where = """ and aml.date between '%s' and '%s'"""%(form['date_from'],form['date_to']) |
|||
elif form['filter'] == 'byperiod': |
|||
#Para filtrar por periodos |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """ and aml.period_id in %s"""%(periodos) |
|||
else: |
|||
#Para filtrar por periodos y fechas |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """ and aml.period_id in %s and aml.date between '%s' and '%s'"""%(periodos,form['date_from'],form['date_to']) |
|||
if form.get('state'): |
|||
estado = " and am.state = '%s'"%form['state'] |
|||
where = where + estado |
|||
|
|||
where = where + " and aa.id = '%s'"%(account['id']) |
|||
analytic_list = str(form['analytic_list']).replace("[","(").replace("]",")") |
|||
where = where + " and aaa.id in " + analytic_list |
|||
|
|||
sql_detalle = """select aml.id as id, aj.name as diario, |
|||
aa.name as descripcion, |
|||
(select name from res_partner where aml.partner_id = id) as partner, |
|||
aa.code as cuenta, aml.name || ' -- Ref: ' || aml.ref as ref, |
|||
case when aml.debit is null then 0.00 else aml.debit end as debit, |
|||
case when aml.credit is null then 0.00 else aml.credit end as credit, |
|||
aml.date as fecha, ap.name as periodo, |
|||
aaa.code as analitica |
|||
from account_move_line aml |
|||
inner join account_analytic_account aaa on aml.analytic_account_id = aaa.id |
|||
inner join account_journal aj on aj.id = aml.journal_id |
|||
inner join account_account aa on aa.id = aml.account_id |
|||
inner join account_period ap on ap.id = aml.period_id |
|||
inner join account_move am on am.id = aml.move_id |
|||
where aml.state <> 'draft'""" + where + \ |
|||
""" order by analitica, fecha""" |
|||
|
|||
self.cr.execute(sql_detalle) |
|||
resultat = self.cr.dictfetchall() |
|||
balance = account['balanceinit'] |
|||
|
|||
for det in resultat: |
|||
balance += det['debit'] - det['credit'] |
|||
res.append({ |
|||
'id': det['id'], |
|||
'date': det['fecha'], |
|||
'journal':det['diario'], |
|||
'ref': det['ref'], |
|||
'debit': det['debit'], |
|||
'credit': det['credit'], |
|||
'analytic': det['analitica'], |
|||
'period': det['periodo'], |
|||
'balance': balance, |
|||
}) |
|||
return res |
|||
|
|||
def lines(self, form, ids={}, done=None, level=0): |
|||
""" |
|||
Returns all the data needed for the report lines |
|||
(account info plus debit/credit/balance in the selected period |
|||
and the full year) |
|||
""" |
|||
tot_bin = 0.0 |
|||
tot_deb = 0.0 |
|||
tot_crd = 0.0 |
|||
tot_eje = 0.0 |
|||
if not ids: |
|||
ids = self.ids |
|||
if not ids: |
|||
return [] |
|||
if not done: |
|||
done = {} |
|||
|
|||
if form.has_key('account_list') and form['account_list']: |
|||
account_ids = form['account_list'] |
|||
del form['account_list'] |
|||
res = {} |
|||
result_acc = [] |
|||
accounts_levels = {} |
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
# Get the fiscal year |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
|
|||
# |
|||
# Get the accounts |
|||
# |
|||
def _get_children_and_consol(cr, uid, ids, level, context={}): |
|||
aa_obj = self.pool.get('account.account') |
|||
ids2=[] |
|||
temp=[] |
|||
read_data= aa_obj.read(cr, uid, ids,['id','child_id','level','type'], context) |
|||
for data in read_data: |
|||
if data['child_id'] and data['level'] < level and data['type']!='consolidation': |
|||
#ids2.append([data['id'],'Label', 'Total']) |
|||
ids2.append([data['id'],True, False]) |
|||
temp=[] |
|||
for x in data['child_id']: |
|||
temp.append(x) |
|||
ids2 += _get_children_and_consol(cr, uid, temp, level, context) |
|||
ids2.append([data['id'],False,True]) |
|||
else: |
|||
ids2.append([data['id'],True,True]) |
|||
return ids2 |
|||
|
|||
child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
|||
if child_ids: |
|||
account_ids = child_ids |
|||
|
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
############################################################################# |
|||
# Calculate the period Debit/Credit # |
|||
# (from the selected period or all the non special periods in the fy) # |
|||
############################################################################# |
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
if ctx['filter'] not in ['bydate','none']: |
|||
especial = self.es_especial(form['periods']) |
|||
else: |
|||
especial = False |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
if especial: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods'])]) |
|||
else: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']), ('special','=',False)]) |
|||
|
|||
if form['filter'] in ['bydate','all','none']: |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
|
|||
accounts=[] |
|||
|
|||
val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) |
|||
|
|||
"""DESDE AQUI VOY A COMENZAR A CAMBIAR""" |
|||
#Extraer cuentas que no son tipo vista |
|||
cuenta_ids = {} |
|||
for cue in val: |
|||
if cue.type != 'view': |
|||
cuenta_ids[cue.id] = cue |
|||
account_ids = self.calcular_debito_credito(cuenta_ids.keys(), form) |
|||
|
|||
if account_ids != {}: |
|||
for acc in account_ids.keys(): |
|||
new_acc = { |
|||
'id' :acc, |
|||
'type' :cuenta_ids[acc].type, |
|||
'code' :str(cuenta_ids[acc].code), |
|||
'name' :cuenta_ids[acc].name.upper(), |
|||
'parent_id' :cuenta_ids[acc].parent_id and cuenta_ids[acc].parent_id.id, |
|||
'level' :cuenta_ids[acc].level, |
|||
'label' :True, |
|||
'total' :True, |
|||
'debit' :account_ids[acc]['debit'], |
|||
'credit' :account_ids[acc]['credit'], |
|||
} |
|||
accounts.append(new_acc) |
|||
|
|||
def missing_period(): |
|||
ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ |
|||
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
|||
|
|||
############################################################################# |
|||
# Calculate the period initial Balance # |
|||
# (fy balance minus the balance from the start of the selected period # |
|||
# to the end of the year) # |
|||
############################################################################# |
|||
|
|||
ctx = self.context.copy() |
|||
if form.get('state'): |
|||
ctx['state'] = form['state'] |
|||
|
|||
if form.get('analytic_list'): |
|||
ctx['analytic_list'] = form['analytic_list'] |
|||
|
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
|
|||
if form['filter'] in ['byperiod']: |
|||
ctx['periods'] = form['periods'] |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) |
|||
if not ctx['periods']: |
|||
missing_period() |
|||
elif form['filter'] in ['bydate', 'all']: |
|||
ctx['date_from'] = fiscalyear.date_start |
|||
ctx['date_to'] = form['date_from'] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) |
|||
elif form['filter'] == 'none': |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) |
|||
|
|||
for acc in accounts: |
|||
if especial: |
|||
acc['balanceinit'] = 0.0 |
|||
acc['balance'] = acc['debit'] - acc['credit'] |
|||
else: |
|||
account_ids_ant = self.calcular_debito_credito([acc['id']], ctx) |
|||
if account_ids_ant != {}: |
|||
acc['balanceinit'] = account_ids_ant[acc['id']]['debit'] - account_ids_ant[acc['id']]['credit'] |
|||
acc['balance'] = acc['balanceinit'] + acc['debit'] - acc['credit'] |
|||
else: |
|||
acc['balanceinit'] = 0.0 |
|||
acc['balance'] = acc['debit'] - acc['credit'] |
|||
|
|||
for acc_anl in accounts: |
|||
acc_anl['analisis'] = self._get_analisis_cuenta_analitica(acc_anl,form) |
|||
accounts.sort(key=lambda x: x['code']) |
|||
|
|||
return accounts |
|||
|
|||
report_sxw.report_sxw('report.wizard.reporte.comprobacion.analisis.cuentas', 'wizard.reporte.comprobacion', 'l10n_ve_account_financial_report/report/analisis_cuentas.rml', parser=account_analisis_cuentas, header=False) |
@ -1,329 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import xml |
|||
import copy |
|||
from operator import itemgetter |
|||
import time |
|||
import datetime |
|||
from report import report_sxw |
|||
from tools import config |
|||
|
|||
class account_balance(report_sxw.rml_parse): |
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
super(account_balance, self).__init__(cr, uid, name, context) |
|||
self.sum_debit = 0.00 |
|||
self.sum_credit = 0.00 |
|||
self.sum_balance = 0.00 |
|||
self.sum_debit_fy = 0.00 |
|||
self.sum_credit_fy = 0.00 |
|||
self.sum_balance_fy = 0.00 |
|||
self.date_lst = [] |
|||
self.date_lst_string = '' |
|||
self.localcontext.update({ |
|||
'time': time, |
|||
'lines': self.lines, |
|||
'get_fiscalyear_text': self.get_fiscalyear_text, |
|||
'get_periods_and_date_text': self.get_periods_and_date_text, |
|||
'get_inf_text': self.get_informe_text, |
|||
}) |
|||
self.context = context |
|||
|
|||
|
|||
def get_fiscalyear_text(self, form): |
|||
""" |
|||
Returns the fiscal year text used on the report. |
|||
""" |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
return fiscalyear.name or fiscalyear.code |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
return "%s*" % (fiscalyear.name or fiscalyear.code) |
|||
|
|||
def get_informe_text(self, form): |
|||
""" |
|||
Returns the header text used on the report. |
|||
""" |
|||
inf_type = { |
|||
'bgen' : ' Balance General', |
|||
'bcom' : ' Balance de Comprobacion', |
|||
'edogp': 'Estado de Ganancias y Perdidas' |
|||
} |
|||
return inf_type[form['inf_type']] |
|||
|
|||
def get_periods_and_date_text(self, form): |
|||
""" |
|||
Returns the text with the periods/dates used on the report. |
|||
""" |
|||
period_obj = self.pool.get('account.period') |
|||
periods_str = None |
|||
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
|||
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
period_ids = form['periods'] |
|||
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
|||
|
|||
dates_str = None |
|||
if form['filter'] in ['bydate', 'all']: |
|||
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
|||
return {'periods':periods_str, 'date':dates_str} |
|||
|
|||
def es_especial(self, periods): |
|||
period_obj = self.pool.get('account.period') |
|||
period_brws = period_obj.browse(self.cr, self.uid, periods) |
|||
tod=0 |
|||
for p_b in period_brws: |
|||
if p_b.special: |
|||
tod = tod + 1 |
|||
if tod == len(periods): |
|||
return True |
|||
else: |
|||
return False |
|||
|
|||
|
|||
def lines(self, form, ids={}, done=None, level=0): |
|||
""" |
|||
Returns all the data needed for the report lines |
|||
(account info plus debit/credit/balance in the selected period |
|||
and the full year) |
|||
""" |
|||
tot_bin = 0.0 |
|||
tot_deb = 0.0 |
|||
tot_crd = 0.0 |
|||
tot_eje = 0.0 |
|||
if not ids: |
|||
ids = self.ids |
|||
if not ids: |
|||
return [] |
|||
if not done: |
|||
done = {} |
|||
|
|||
if form.has_key('account_list') and form['account_list']: |
|||
account_ids = form['account_list'] |
|||
del form['account_list'] |
|||
res = {} |
|||
result_acc = [] |
|||
accounts_levels = {} |
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
# Get the fiscal year |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
|
|||
# |
|||
# Get the accounts |
|||
# |
|||
def _get_children_and_consol(cr, uid, ids, level, context={}): |
|||
aa_obj = self.pool.get('account.account') |
|||
ids2=[] |
|||
temp=[] |
|||
read_data= aa_obj.read(cr, uid, ids,['id','child_id','level','type'], context) |
|||
for data in read_data: |
|||
if data['child_id'] and data['level'] < level and data['type']!='consolidation': |
|||
#ids2.append([data['id'],'Label', 'Total']) |
|||
ids2.append([data['id'],True, False]) |
|||
temp=[] |
|||
for x in data['child_id']: |
|||
temp.append(x) |
|||
ids2 += _get_children_and_consol(cr, uid, temp, level, context) |
|||
ids2.append([data['id'],False,True]) |
|||
else: |
|||
ids2.append([data['id'],True,True]) |
|||
return ids2 |
|||
|
|||
child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
|||
if child_ids: |
|||
account_ids = child_ids |
|||
|
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
############################################################################# |
|||
# Calculate the period Debit/Credit # |
|||
# (from the selected period or all the non special periods in the fy) # |
|||
############################################################################# |
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
#~ ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
|||
if ctx['filter'] not in ['bydate','none']: |
|||
especial = self.es_especial(form['periods']) |
|||
else: |
|||
especial = False |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
if especial: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods'])]) |
|||
else: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) |
|||
|
|||
if form['filter'] in ['bydate','all','none']: |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
|
|||
accounts=[] |
|||
|
|||
val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) |
|||
c = 0 |
|||
for aa_id in account_ids: |
|||
new_acc = { |
|||
'id' :val[c].id, |
|||
'type' :val[c].type, |
|||
'code' :val[c].code, |
|||
'name' :val[c].name, |
|||
'debit' :val[c].debit, |
|||
'credit' :val[c].credit, |
|||
'parent_id' :val[c].parent_id and val[c].parent_id.id, |
|||
'level' :val[c].level, |
|||
'label' :aa_id[1], |
|||
'total' :aa_id[2], |
|||
} |
|||
c += 1 |
|||
accounts.append(new_acc) |
|||
|
|||
def missing_period(): |
|||
ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ |
|||
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
|||
|
|||
############################################################################# |
|||
# Calculate the period initial Balance # |
|||
# (fy balance minus the balance from the start of the selected period # |
|||
# to the end of the year) # |
|||
############################################################################# |
|||
|
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
|
|||
if form['filter'] in ['byperiod', 'all']: |
|||
ctx['periods'] = form['periods'] |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) |
|||
if not ctx['periods']: |
|||
missing_period() |
|||
elif form['filter'] in ['bydate']: |
|||
ctx['date_from'] = fiscalyear.date_start |
|||
ctx['date_to'] = form['date_from'] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) |
|||
elif form['filter'] == 'none': |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) |
|||
|
|||
period_balanceinit = {} |
|||
for acc in account_obj.browse(self.cr, self.uid, [x[0] for x in account_ids], ctx): |
|||
if especial: |
|||
period_balanceinit[acc['id']] = 0.0 |
|||
else: |
|||
period_balanceinit[acc['id']] = acc.balance |
|||
|
|||
# |
|||
# Generate the report lines (checking each account) |
|||
# |
|||
tot = {} |
|||
for account in accounts: |
|||
account_id = account['id'] |
|||
|
|||
if account_id in done: |
|||
pass |
|||
|
|||
done[account_id] = 1 |
|||
|
|||
accounts_levels[account_id] = account['level'] |
|||
|
|||
# |
|||
# Check if we need to include this level |
|||
# |
|||
if not form['display_account_level'] or account['level'] <= form['display_account_level']: |
|||
# |
|||
# Copy the account values |
|||
# |
|||
res = { |
|||
'id' : account_id, |
|||
'type' : account['type'], |
|||
'code': account['code'], |
|||
'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], |
|||
'level': account['level'], |
|||
'balanceinit': period_balanceinit[account_id], |
|||
'debit': account['debit'], |
|||
'credit': account['credit'], |
|||
'balance': period_balanceinit[account_id]+account['debit']-account['credit'], |
|||
'parent_id': account['parent_id'], |
|||
'bal_type': '', |
|||
'label': account['label'], |
|||
'total': account['total'], |
|||
} |
|||
# |
|||
# Round the values to zero if needed (-0.000001 ~= 0) |
|||
# |
|||
if abs(res['balance']) < 0.5 * 10**-4: |
|||
res['balance'] = 0.0 |
|||
|
|||
# |
|||
# Check whether we must include this line in the report or not |
|||
# |
|||
if form['display_account'] == 'con_movimiento' and account['parent_id']: |
|||
# Include accounts with movements |
|||
if abs(res['debit']) >= 0.5 * 10**-int(2) or abs(res['credit']) >= 0.5 * 10**-int(2): |
|||
result_acc.append(res) |
|||
elif form['display_account'] == 'con_balance' and account['parent_id']: |
|||
# Include accounts with balance |
|||
if abs(res['balance']) >= 0.5 * 10**-4: |
|||
result_acc.append(res) |
|||
else: |
|||
# Include all accounts |
|||
result_acc.append(res) |
|||
if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): |
|||
tot[res['id']] = True |
|||
tot_bin += res['balanceinit'] |
|||
tot_deb += res['debit'] |
|||
tot_crd += res['credit'] |
|||
tot_eje += res['balance'] |
|||
if form['tot_check']: |
|||
str_label = form['lab_str'] |
|||
res2 = { |
|||
'type' : 'view', |
|||
'name': 'TOTAL %s'%(str_label), |
|||
'balanceinit': tot_bin, |
|||
'debit': tot_deb, |
|||
'credit': tot_crd, |
|||
'balance': tot_eje, |
|||
'label': False, |
|||
'total': True, |
|||
} |
|||
result_acc.append(res2) |
|||
|
|||
return result_acc |
|||
|
|||
report_sxw.report_sxw('report.wizard.reporte.comprobacion.un.col', |
|||
'account.account', |
|||
'l10n_ve_account_financial_report/report/balance_full.rml', |
|||
parser=account_balance, |
|||
header=False) |
@ -1,269 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# Coded by: Humberto Arocha humberto@openerp.com.ve |
|||
# Angelica Barrios angelicaisabelb@gmail.com |
|||
# Jordi Esteve <jesteve@zikzakmedia.com> |
|||
# Javier Duran <javieredm@gmail.com> |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import xml |
|||
import copy |
|||
from operator import itemgetter |
|||
import time |
|||
import datetime |
|||
from report import report_sxw |
|||
from tools import config |
|||
|
|||
|
|||
class account_balance(report_sxw.rml_parse): |
|||
|
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
print 'INICIO: ',datetime.datetime.now() |
|||
super(account_balance, self).__init__(cr, uid, name, context) |
|||
self.sum_debit = 0.00 |
|||
self.sum_credit = 0.00 |
|||
self.sum_balance = 0.00 |
|||
self.sum_debit_fy = 0.00 |
|||
self.sum_credit_fy = 0.00 |
|||
self.sum_balance_fy = 0.00 |
|||
self.date_lst = [] |
|||
self.date_lst_string = '' |
|||
self.localcontext.update({ |
|||
'time': time, |
|||
'lines': self.lines, |
|||
'get_fiscalyear_text': self.get_fiscalyear_text, |
|||
'get_periods_and_date_text': self.get_periods_and_date_text, |
|||
'get_inf_text': self.get_informe_text, |
|||
}) |
|||
self.context = context |
|||
|
|||
|
|||
def get_fiscalyear_text(self, form): |
|||
""" |
|||
Returns the fiscal year text used on the report. |
|||
""" |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
return fiscalyear.name or fiscalyear.code |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
return "%s*" % (fiscalyear.name or fiscalyear.code) |
|||
|
|||
def get_informe_text(self, form): |
|||
""" |
|||
Returns the header text used on the report. |
|||
""" |
|||
inf_type = { |
|||
'bgen' : ' Balance General', |
|||
'bcom' : ' Balance de Comprobacion', |
|||
'edogp': 'Estado de Ganancias y Perdidas' |
|||
} |
|||
return inf_type[form['inf_type']] |
|||
|
|||
def get_periods_and_date_text(self, form): |
|||
""" |
|||
Returns the text with the periods/dates used on the report. |
|||
""" |
|||
period_obj = self.pool.get('account.period') |
|||
periods_str = None |
|||
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
|||
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
period_ids = form['periods'] |
|||
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
|||
|
|||
dates_str = None |
|||
if form['filter'] in ['bydate', 'all']: |
|||
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
|||
|
|||
return {'periods':periods_str, 'date':dates_str} |
|||
|
|||
|
|||
def lines(self, form, ids={}, done=None, level=0): |
|||
""" |
|||
Returns all the data needed for the report lines |
|||
(account info plus debit/credit/balance in the selected period |
|||
and the full year) |
|||
""" |
|||
tot_deb = 0.0 |
|||
tot_crd = 0.0 |
|||
if not ids: |
|||
ids = self.ids |
|||
if not ids: |
|||
return [] |
|||
if not done: |
|||
done = {} |
|||
print "Lista Form %s"%form |
|||
print "Tipo de Obj %s"%type(form) |
|||
|
|||
print "form:%s"%form |
|||
if form.has_key('account_list') and form['account_list']: |
|||
#account_ids = form['account_list'][0][2] |
|||
account_ids = form['account_list'] |
|||
del form['account_list'] |
|||
res = {} |
|||
result_acc = [] |
|||
accounts_levels = {} |
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
# Get the fiscal year |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
|
|||
# |
|||
# Get the accounts |
|||
# |
|||
def _get_children_and_consol(cr, uid, ids, level, context={}): |
|||
aa_obj = self.pool.get('account.account') |
|||
ids2=[] |
|||
temp=[] |
|||
read_data= aa_obj.read(cr, uid, ids,['id','child_id','level','type'], context) |
|||
for data in read_data: |
|||
if data['child_id'] and data['level'] < level and data['type']!='consolidation': |
|||
#ids2.append([data['id'],'Label', 'Total']) |
|||
ids2.append([data['id'],True, False]) |
|||
temp=[] |
|||
for x in data['child_id']: |
|||
temp.append(x) |
|||
ids2 += _get_children_and_consol(cr, uid, temp, level, context) |
|||
ids2.append([data['id'],False,True]) |
|||
else: |
|||
ids2.append([data['id'],True,True]) |
|||
return ids2 |
|||
|
|||
child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
|||
if child_ids: |
|||
account_ids = child_ids |
|||
|
|||
# |
|||
# Calculate the period Debit/Credit |
|||
# (from the selected period or all the non special periods in the fy) |
|||
# |
|||
ctx = self.context.copy() |
|||
print "CTX = %s\nY\nFORM = %s"%(ctx,form) |
|||
ctx['filter'] = form.get('filter','all') |
|||
#~ ctx['filter'] = form['context'].get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
print "PERIODS ",form['periods'] |
|||
#~ ctx['periods'] = form['periods'][0][2] |
|||
ctx['periods'] = form['periods'] |
|||
if form['filter'] in ['bydate', 'all']: |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
|
|||
accounts=[] |
|||
for aa_id in account_ids: |
|||
new_acc = account_obj.read(self.cr, self.uid, aa_id[0], ['type','code','name','debit','credit','parent_id','level'], ctx) |
|||
new_acc.update({'label':aa_id[1],'total':aa_id[2]}) |
|||
accounts.append(new_acc) |
|||
|
|||
def missing_period(): |
|||
ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ |
|||
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
|||
|
|||
|
|||
# |
|||
# Generate the report lines (checking each account) |
|||
# |
|||
tot = {} |
|||
for account in accounts: |
|||
account_id = account['id'] |
|||
|
|||
if account_id in done: |
|||
pass |
|||
# continue |
|||
|
|||
done[account_id] = 1 |
|||
|
|||
accounts_levels[account_id] = account['level'] |
|||
|
|||
# |
|||
# Check if we need to include this level |
|||
# |
|||
if not form['display_account_level'] or account['level'] <= form['display_account_level']: |
|||
# |
|||
# Copy the account values |
|||
# |
|||
res = { |
|||
'id' : account_id, |
|||
'type' : account['type'], |
|||
'code': account['code'], |
|||
'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], |
|||
'level': account['level'], |
|||
'debit': account['debit'], |
|||
'credit': account['credit'], |
|||
'parent_id': account['parent_id'], |
|||
'bal_type': '', |
|||
'label': account['label'], |
|||
'total': account['total'], |
|||
} |
|||
|
|||
# |
|||
# Check whether we must include this line in the report or not |
|||
# |
|||
if form['display_account'] == 'con_movimiento' and account['parent_id']: |
|||
# Include accounts with movements |
|||
if abs(res['credit']-res['debit']) >= 0.5 * 10**-int(2) \ |
|||
or abs(res['credit']) >= 0.5 * 10**-int(2) \ |
|||
or abs(res['debit']) >= 0.5 * 10**-int(2): |
|||
result_acc.append(res) |
|||
elif form['display_account'] == 'con_balance' and account['parent_id']: |
|||
# Include accounts with balance |
|||
if abs(res['credit']-res['debit']) >= 0.5 * 10**-int(2): |
|||
result_acc.append(res) |
|||
else: |
|||
# Include all account |
|||
result_acc.append(res) |
|||
if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): |
|||
tot[res['id']] = True |
|||
tot_deb += res['debit'] |
|||
tot_crd += res['credit'] |
|||
if form['tot_check']: |
|||
str_label = form['lab_str'] |
|||
res2 = { |
|||
'type' : 'view', |
|||
'name': 'TOTAL %s'%(str_label), |
|||
'debit': tot_deb, |
|||
'credit': tot_crd, |
|||
'label': False, |
|||
'total': True, |
|||
} |
|||
result_acc.append(res2) |
|||
print 'FIN: ',datetime.datetime.now() |
|||
return result_acc |
|||
report_sxw.report_sxw('report.wizard.reporte.comprobacion.dos.col', |
|||
'account.account', |
|||
'l10n_ve_account_financial_report/report/balance_full_2_cols.rml', |
|||
parser=account_balance, |
|||
header=False) |
@ -1,334 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import xml |
|||
import copy |
|||
from operator import itemgetter |
|||
import time |
|||
import datetime |
|||
from report import report_sxw |
|||
from tools import config |
|||
|
|||
|
|||
class account_balance(report_sxw.rml_parse): |
|||
|
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
super(account_balance, self).__init__(cr, uid, name, context) |
|||
self.sum_debit = 0.00 |
|||
self.sum_credit = 0.00 |
|||
self.sum_balance = 0.00 |
|||
self.sum_debit_fy = 0.00 |
|||
self.sum_credit_fy = 0.00 |
|||
self.sum_balance_fy = 0.00 |
|||
self.date_lst = [] |
|||
self.date_lst_string = '' |
|||
self.localcontext.update({ |
|||
'time': time, |
|||
'lines': self.lines, |
|||
'get_fiscalyear_text': self.get_fiscalyear_text, |
|||
'get_periods_and_date_text': self.get_periods_and_date_text, |
|||
'get_inf_text': self.get_informe_text, |
|||
}) |
|||
self.context = context |
|||
|
|||
|
|||
def get_fiscalyear_text(self, form): |
|||
""" |
|||
Returns the fiscal year text used on the report. |
|||
""" |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
return fiscalyear.name or fiscalyear.code |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
return "%s*" % (fiscalyear.name or fiscalyear.code) |
|||
|
|||
def get_informe_text(self, form): |
|||
""" |
|||
Returns the header text used on the report. |
|||
""" |
|||
inf_type = { |
|||
'bgen' : ' Balance General', |
|||
'bcom' : ' Balance de Comprobacion', |
|||
'edogp': 'Estado de Ganancias y Perdidas' |
|||
} |
|||
return inf_type[form['inf_type']] |
|||
|
|||
def get_periods_and_date_text(self, form): |
|||
""" |
|||
Returns the text with the periods/dates used on the report. |
|||
""" |
|||
period_obj = self.pool.get('account.period') |
|||
periods_str = None |
|||
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
|||
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
period_ids = form['periods'] |
|||
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
|||
|
|||
dates_str = None |
|||
if form['filter'] in ['bydate', 'all']: |
|||
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
|||
return {'periods':periods_str, 'date':dates_str} |
|||
|
|||
def es_especial(self, periods): |
|||
period_obj = self.pool.get('account.period') |
|||
period_brws = period_obj.browse(self.cr, self.uid, periods) |
|||
tod=0 |
|||
for p_b in period_brws: |
|||
if p_b.special: |
|||
tod = tod + 1 |
|||
if tod == len(periods): |
|||
return True |
|||
else: |
|||
return False |
|||
|
|||
|
|||
def lines(self, form, ids={}, done=None, level=0): |
|||
""" |
|||
Returns all the data needed for the report lines |
|||
(account info plus debit/credit/balance in the selected period |
|||
and the full year) |
|||
""" |
|||
tot_bin = 0.0 |
|||
tot_deb = 0.0 |
|||
tot_crd = 0.0 |
|||
tot_eje = 0.0 |
|||
if not ids: |
|||
ids = self.ids |
|||
if not ids: |
|||
return [] |
|||
if not done: |
|||
done = {} |
|||
|
|||
if form.has_key('account_list') and form['account_list']: |
|||
account_ids = form['account_list'] |
|||
del form['account_list'] |
|||
res = {} |
|||
result_acc = [] |
|||
accounts_levels = {} |
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
# Get the fiscal year |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
|
|||
# |
|||
# Get the accounts |
|||
# |
|||
def _get_children_and_consol(cr, uid, ids, level, context={}): |
|||
aa_obj = self.pool.get('account.account') |
|||
ids2=[] |
|||
temp=[] |
|||
read_data= aa_obj.read(cr, uid, ids,['id','child_id','level','type'], context) |
|||
for data in read_data: |
|||
if data['child_id'] and data['level'] < level and data['type']!='consolidation': |
|||
#ids2.append([data['id'],'Label', 'Total']) |
|||
ids2.append([data['id'],True, False]) |
|||
temp=[] |
|||
for x in data['child_id']: |
|||
temp.append(x) |
|||
ids2 += _get_children_and_consol(cr, uid, temp, level, context) |
|||
ids2.append([data['id'],False,True]) |
|||
else: |
|||
ids2.append([data['id'],True,True]) |
|||
return ids2 |
|||
|
|||
child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
|||
if child_ids: |
|||
account_ids = child_ids |
|||
|
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
############################################################################# |
|||
# Calculate the period Debit/Credit # |
|||
# (from the selected period or all the non special periods in the fy) # |
|||
############################################################################# |
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
#~ ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
|||
if ctx['filter'] not in ['bydate','none']: |
|||
especial = self.es_especial(form['periods']) |
|||
else: |
|||
especial = False |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
if especial: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods'])]) |
|||
else: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) |
|||
|
|||
if form['filter'] in ['bydate','all','none']: |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
|
|||
if form.get('state'): |
|||
ctx['state'] = form['state'] |
|||
|
|||
accounts=[] |
|||
|
|||
val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) |
|||
c = 0 |
|||
for aa_id in account_ids: |
|||
new_acc = { |
|||
'id' :val[c].id, |
|||
'type' :val[c].type, |
|||
'code' :val[c].code, |
|||
'name' :val[c].name, |
|||
'debit' :val[c].debit, |
|||
'credit' :val[c].credit, |
|||
'parent_id' :val[c].parent_id and val[c].parent_id.id, |
|||
'level' :val[c].level, |
|||
'label' :aa_id[1], |
|||
'total' :aa_id[2], |
|||
} |
|||
c += 1 |
|||
accounts.append(new_acc) |
|||
|
|||
def missing_period(): |
|||
ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ |
|||
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
|||
|
|||
############################################################################# |
|||
# Calculate the period initial Balance # |
|||
# (fy balance minus the balance from the start of the selected period # |
|||
# to the end of the year) # |
|||
############################################################################# |
|||
|
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
|
|||
if form['filter'] in ['byperiod', 'all']: |
|||
ctx['periods'] = form['periods'] |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) |
|||
if not ctx['periods']: |
|||
missing_period() |
|||
elif form['filter'] in ['bydate']: |
|||
ctx['date_from'] = fiscalyear.date_start |
|||
ctx['date_to'] = form['date_from'] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) |
|||
elif form['filter'] == 'none': |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) |
|||
|
|||
period_balanceinit = {} |
|||
for acc in account_obj.browse(self.cr, self.uid, [x[0] for x in account_ids], ctx): |
|||
if especial: |
|||
period_balanceinit[acc['id']] = 0.0 |
|||
else: |
|||
period_balanceinit[acc['id']] = acc.balance |
|||
|
|||
# |
|||
# Generate the report lines (checking each account) |
|||
# |
|||
tot = {} |
|||
for account in accounts: |
|||
account_id = account['id'] |
|||
|
|||
if account_id in done: |
|||
pass |
|||
|
|||
done[account_id] = 1 |
|||
|
|||
accounts_levels[account_id] = account['level'] |
|||
|
|||
# |
|||
# Check if we need to include this level |
|||
# |
|||
if not form['display_account_level'] or account['level'] <= form['display_account_level']: |
|||
# |
|||
# Copy the account values |
|||
# |
|||
res = { |
|||
'id' : account_id, |
|||
'type' : account['type'], |
|||
'code': account['code'], |
|||
'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], |
|||
'level': account['level'], |
|||
'balanceinit': period_balanceinit[account_id], |
|||
'debit': account['debit'], |
|||
'credit': account['credit'], |
|||
'balance': period_balanceinit[account_id]+account['debit']-account['credit'], |
|||
'parent_id': account['parent_id'], |
|||
'bal_type': '', |
|||
'label': account['label'], |
|||
'total': account['total'], |
|||
} |
|||
# |
|||
# Round the values to zero if needed (-0.000001 ~= 0) |
|||
# |
|||
if abs(res['balance']) < 0.5 * 10**-4: |
|||
res['balance'] = 0.0 |
|||
|
|||
# |
|||
# Check whether we must include this line in the report or not |
|||
# |
|||
if form['display_account'] == 'con_movimiento' and account['parent_id']: |
|||
# Include accounts with movements |
|||
if abs(res['debit']) >= 0.5 * 10**-int(2) or abs(res['credit']) >= 0.5 * 10**-int(2): |
|||
result_acc.append(res) |
|||
elif form['display_account'] == 'con_balance' and account['parent_id']: |
|||
# Include accounts with balance |
|||
if abs(res['balance']) >= 0.5 * 10**-4: |
|||
result_acc.append(res) |
|||
else: |
|||
# Include all accounts |
|||
result_acc.append(res) |
|||
if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): |
|||
tot[res['id']] = True |
|||
tot_bin += res['balanceinit'] |
|||
tot_deb += res['debit'] |
|||
tot_crd += res['credit'] |
|||
tot_eje += res['balance'] |
|||
if form['tot_check']: |
|||
str_label = form['lab_str'] |
|||
res2 = { |
|||
'type' : 'view', |
|||
'name': 'TOTAL %s'%(str_label), |
|||
'balanceinit': tot_bin, |
|||
'debit': tot_deb, |
|||
'credit': tot_crd, |
|||
'balance': tot_eje, |
|||
'label': False, |
|||
'total': True, |
|||
} |
|||
result_acc.append(res2) |
|||
|
|||
return result_acc |
|||
|
|||
report_sxw.report_sxw('report.wizard.reporte.comprobacion.cuatro.col', |
|||
'wizard.reporte.comprobacion', |
|||
'l10n_ve_account_financial_report/report/balance_full_4_cols_h.rml', |
|||
parser=account_balance, |
|||
header=False) |
@ -1,398 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import xml |
|||
import copy |
|||
from operator import itemgetter |
|||
import time |
|||
import datetime |
|||
from report import report_sxw |
|||
from tools import config |
|||
|
|||
|
|||
class account_mayor_analitico(report_sxw.rml_parse): |
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
super(account_mayor_analitico, self).__init__(cr, uid, name, context) |
|||
self.sum_debit = 0.00 |
|||
self.sum_credit = 0.00 |
|||
self.sum_balance = 0.00 |
|||
self.sum_debit_fy = 0.00 |
|||
self.sum_credit_fy = 0.00 |
|||
self.sum_balance_fy = 0.00 |
|||
self.date_lst = [] |
|||
self.date_lst_string = '' |
|||
self.localcontext.update({ |
|||
'time': time, |
|||
'lines': self.lines, |
|||
'get_fiscalyear_text': self.get_fiscalyear_text, |
|||
'get_periods_and_date_text': self.get_periods_and_date_text, |
|||
'get_inf_text': self.get_informe_text, |
|||
'set_fecha': self.set_fecha, |
|||
}) |
|||
self.context = context |
|||
|
|||
def set_fecha(self, fecha): |
|||
f = fecha.split('-') |
|||
date = datetime.date(int(f[0]),int(f[1]),int(f[2])) |
|||
return str(date.strftime("%d/%m/%Y")) |
|||
|
|||
def _get_mayor_detalle(self, account, form): |
|||
res = [] |
|||
|
|||
if account['type'] != 'view': |
|||
if form['filter'] in ('bydate','none'): |
|||
#Para filtrar por 'fechas' o 'sin filtro', este porque se envia el año fiscal por fecha. |
|||
where = """where aml.date between '%s' and '%s' and aa.id = %s and aml.state <> 'draft'"""%(form['date_from'],form['date_to'],account['id']) |
|||
elif form['filter'] == 'byperiod': |
|||
#Para filtrar por periodos |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """where aml.period_id in %s and aa.id = %s and aml.state <> 'draft'"""%(periodos,account['id']) |
|||
else: |
|||
#Para filtrar por periodos y fechas |
|||
periodos = str(form['periods']).replace("[","(").replace("]",")") |
|||
where = """where aml.period_id in %s and aml.date between '%s' and '%s' and aa.id = %s and aml.state <> 'draft'"""%(periodos,form['date_from'],form['date_to'],account['id']) |
|||
if form.get('state'): |
|||
estado = " and am.state = '%s'"%form['state'] |
|||
where = where + estado |
|||
sql_detalle = """select aml.id as id, aj.name as diario, aa.name as descripcion, |
|||
(select name from res_partner where aml.partner_id = id) as partner, |
|||
aa.code as cuenta, aml.name as name, |
|||
aml.ref as ref, |
|||
case when aml.debit is null then 0.00 else aml.debit end as debit, |
|||
case when aml.credit is null then 0.00 else aml.credit end as credit, |
|||
(select code from account_analytic_account where aml.analytic_account_id = id) as analitica, |
|||
aml.date as fecha, ap.name as periodo, |
|||
am.name as asiento |
|||
from account_move_line aml |
|||
inner join account_journal aj on aj.id = aml.journal_id |
|||
inner join account_account aa on aa.id = aml.account_id |
|||
inner join account_period ap on ap.id = aml.period_id |
|||
inner join account_move am on am.id = aml.move_id """ + where +\ |
|||
""" order by fecha""" |
|||
|
|||
self.cr.execute(sql_detalle) |
|||
resultat = self.cr.dictfetchall() |
|||
balance = account['balanceinit'] |
|||
#~ print balance |
|||
for det in resultat: |
|||
print "det", det |
|||
balance += det['debit'] - det['credit'] |
|||
res.append({ |
|||
'id': det['id'], |
|||
'date': det['fecha'], |
|||
'journal':det['diario'], |
|||
'partner':det['partner'], |
|||
'name':det['name'], |
|||
'entry':det['asiento'], |
|||
'ref': det['ref'], |
|||
'debit': det['debit'], |
|||
'credit': det['credit'], |
|||
'analytic': det['analitica'], |
|||
'period': det['periodo'], |
|||
'balance': balance, |
|||
}) |
|||
return res |
|||
|
|||
def get_fiscalyear_text(self, form): |
|||
""" |
|||
Returns the fiscal year text used on the report. |
|||
""" |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
return fiscalyear.name or fiscalyear.code |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
return "%s*" % (fiscalyear.name or fiscalyear.code) |
|||
|
|||
def get_informe_text(self, form): |
|||
""" |
|||
Returns the header text used on the report. |
|||
""" |
|||
inf_type = { |
|||
'bgen' : ' Balance General', |
|||
'bcom' : ' Balance de Comprobacion', |
|||
'edogp': 'Estado de Ganancias y Perdidas', |
|||
'bml': ' Mayor Analitico' |
|||
} |
|||
return inf_type[form['inf_type']] |
|||
|
|||
def get_periods_and_date_text(self, form): |
|||
""" |
|||
Returns the text with the periods/dates used on the report. |
|||
""" |
|||
period_obj = self.pool.get('account.period') |
|||
periods_str = None |
|||
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
|||
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
period_ids = form['periods'] |
|||
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
|||
|
|||
dates_str = None |
|||
if form['filter'] in ['bydate', 'all']: |
|||
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
|||
return {'periods':periods_str, 'date':dates_str} |
|||
|
|||
def es_especial(self, periods): |
|||
period_obj = self.pool.get('account.period') |
|||
period_brws = period_obj.browse(self.cr, self.uid, periods) |
|||
tod=0 |
|||
for p_b in period_brws: |
|||
if p_b.special: |
|||
tod = tod + 1 |
|||
if tod == len(periods): |
|||
return True |
|||
else: |
|||
return False |
|||
|
|||
|
|||
def lines(self, form, ids={}, done=None, level=0): |
|||
""" |
|||
Returns all the data needed for the report lines |
|||
(account info plus debit/credit/balance in the selected period |
|||
and the full year) |
|||
""" |
|||
tot_bin = 0.0 |
|||
tot_deb = 0.0 |
|||
tot_crd = 0.0 |
|||
tot_eje = 0.0 |
|||
if not ids: |
|||
ids = self.ids |
|||
if not ids: |
|||
return [] |
|||
if not done: |
|||
done = {} |
|||
|
|||
if form.has_key('account_list') and form['account_list']: |
|||
account_ids = form['account_list'] |
|||
del form['account_list'] |
|||
res = {} |
|||
result_acc = [] |
|||
accounts_levels = {} |
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
# Get the fiscal year |
|||
fiscalyear = None |
|||
if form.get('fiscalyear'): |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
|||
else: |
|||
fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
|||
|
|||
# |
|||
# Get the accounts |
|||
# |
|||
def _get_children_and_consol(cr, uid, ids, level, context={}): |
|||
aa_obj = self.pool.get('account.account') |
|||
ids2=[] |
|||
temp=[] |
|||
read_data= aa_obj.read(cr, uid, ids,['id','child_id','level','type'], context) |
|||
for data in read_data: |
|||
if data['child_id'] and data['level'] < level and data['type']!='consolidation': |
|||
#ids2.append([data['id'],'Label', 'Total']) |
|||
ids2.append([data['id'],True, False]) |
|||
temp=[] |
|||
for x in data['child_id']: |
|||
temp.append(x) |
|||
ids2 += _get_children_and_consol(cr, uid, temp, level, context) |
|||
ids2.append([data['id'],False,True]) |
|||
else: |
|||
ids2.append([data['id'],True,True]) |
|||
return ids2 |
|||
|
|||
child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
|||
if child_ids: |
|||
account_ids = child_ids |
|||
|
|||
account_obj = self.pool.get('account.account') |
|||
period_obj = self.pool.get('account.period') |
|||
fiscalyear_obj = self.pool.get('account.fiscalyear') |
|||
|
|||
############################################################################# |
|||
# Calculate the period Debit/Credit # |
|||
# (from the selected period or all the non special periods in the fy) # |
|||
############################################################################# |
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
#~ ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
|||
if ctx['filter'] not in ['bydate','none']: |
|||
especial = self.es_especial(form['periods']) |
|||
else: |
|||
especial = False |
|||
if form['filter'] in ['byperiod', 'all']: |
|||
if especial: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods'])]) |
|||
else: |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) |
|||
|
|||
if form['filter'] in ['bydate','all','none']: |
|||
ctx['date_from'] = form['date_from'] |
|||
ctx['date_to'] = form['date_to'] |
|||
|
|||
if form.get('state'): |
|||
ctx['state'] = form['state'] |
|||
|
|||
accounts=[] |
|||
|
|||
val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) |
|||
c = 0 |
|||
for aa_id in account_ids: |
|||
new_acc = { |
|||
'id' :val[c].id, |
|||
'type' :val[c].type, |
|||
'code' :val[c].code, |
|||
'name' :val[c].name, |
|||
'debit' :val[c].debit, |
|||
'credit' :val[c].credit, |
|||
'parent_id' :val[c].parent_id and val[c].parent_id.id, |
|||
'level' :val[c].level, |
|||
'label' :aa_id[1], |
|||
'total' :aa_id[2], |
|||
} |
|||
c += 1 |
|||
accounts.append(new_acc) |
|||
|
|||
def missing_period(): |
|||
ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ |
|||
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
|||
|
|||
############################################################################# |
|||
# Calculate the period initial Balance # |
|||
# (fy balance minus the balance from the start of the selected period # |
|||
# to the end of the year) # |
|||
############################################################################# |
|||
|
|||
ctx = self.context.copy() |
|||
ctx['filter'] = form.get('filter','all') |
|||
ctx['fiscalyear'] = fiscalyear.id |
|||
|
|||
if form['filter'] in ['byperiod', 'all']: |
|||
ctx['periods'] = form['periods'] |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) |
|||
if not ctx['periods']: |
|||
missing_period() |
|||
elif form['filter'] in ['bydate']: |
|||
ctx['date_from'] = fiscalyear.date_start |
|||
ctx['date_to'] = form['date_from'] |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) |
|||
elif form['filter'] == 'none': |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) |
|||
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
|||
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) |
|||
|
|||
period_balanceinit = {} |
|||
for acc in account_obj.browse(self.cr, self.uid, [x[0] for x in account_ids], ctx): |
|||
if especial: |
|||
period_balanceinit[acc['id']] = 0.0 |
|||
else: |
|||
period_balanceinit[acc['id']] = acc.balance |
|||
|
|||
# |
|||
# Generate the report lines (checking each account) |
|||
# |
|||
tot = {} |
|||
for account in accounts: |
|||
account_id = account['id'] |
|||
|
|||
if account_id in done: |
|||
pass |
|||
|
|||
done[account_id] = 1 |
|||
|
|||
accounts_levels[account_id] = account['level'] |
|||
|
|||
# |
|||
# Check if we need to include this level |
|||
# |
|||
if not form['display_account_level'] or account['level'] <= form['display_account_level']: |
|||
# |
|||
# Copy the account values |
|||
# |
|||
res = { |
|||
'id' : account_id, |
|||
'type' : account['type'], |
|||
'code': account['code'], |
|||
'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], |
|||
'level': account['level'], |
|||
'balanceinit': period_balanceinit[account_id], |
|||
'debit': account['debit'], |
|||
'credit': account['credit'], |
|||
'balance': period_balanceinit[account_id]+account['debit']-account['credit'], |
|||
'parent_id': account['parent_id'], |
|||
'bal_type': '', |
|||
'label': account['label'], |
|||
'total': account['total'], |
|||
} |
|||
# |
|||
# Round the values to zero if needed (-0.000001 ~= 0) |
|||
# |
|||
if abs(res['balance']) < 0.5 * 10**-4: |
|||
res['balance'] = 0.0 |
|||
|
|||
# |
|||
# Check whether we must include this line in the report or not |
|||
# |
|||
if form['display_account'] == 'con_movimiento' and account['parent_id']: |
|||
# Include accounts with movements |
|||
if abs(res['debit']) >= 0.5 * 10**-int(2) or abs(res['credit']) >= 0.5 * 10**-int(2): |
|||
if res['type'] != 'view' and res['code']!='0': |
|||
res['mayor'] = self._get_mayor_detalle(res,form) |
|||
result_acc.append(res) |
|||
elif form['display_account'] == 'con_balance' and account['parent_id']: |
|||
# Include accounts with balance |
|||
if abs(res['balance']) >= 0.5 * 10**-4: |
|||
if res['type'] != 'view' and res['code']!='0': |
|||
res['mayor'] = self._get_mayor_detalle(res,form) |
|||
result_acc.append(res) |
|||
else: |
|||
# Include all accounts |
|||
if res['type'] != 'view' and res['code']!='0': |
|||
res['mayor'] = self._get_mayor_detalle(res,form) |
|||
result_acc.append(res) |
|||
if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): |
|||
tot[res['id']] = True |
|||
tot_bin += res['balanceinit'] |
|||
tot_deb += res['debit'] |
|||
tot_crd += res['credit'] |
|||
tot_eje += res['balance'] |
|||
if form['tot_check']: |
|||
str_label = form['lab_str'] |
|||
res2 = { |
|||
'type' : 'view', |
|||
'name': 'TOTAL %s'%(str_label), |
|||
'balanceinit': tot_bin, |
|||
'debit': tot_deb, |
|||
'credit': tot_crd, |
|||
'balance': tot_eje, |
|||
'label': False, |
|||
'total': True, |
|||
} |
|||
result_acc.append(res2) |
|||
|
|||
return result_acc |
|||
|
|||
report_sxw.report_sxw('report.wizard.reporte.comprobacion.mayor.analitico', 'wizard.reporte.comprobacion', 'l10n_ve_account_financial_report/report/mayor_analitico.rml', parser=account_mayor_analitico, header=False) |
@ -1,228 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(27.94cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1.5cm" y1="1.5cm" width="24.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.5cm" y="27.0cm">[[ company.name ]] RIF: [[ company.partner_id.vat[2] ]]-[[ company.partner_id.vat[3:-1] ]]-[[ company.partner_id.vat[-1] ]]</drawString> |
|||
<drawString x="20.7cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1.0cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="25.5cm" y="1.0cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1.3cm 26.9cm 26.5cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY_LINE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="9.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
|
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN_NEW" |
|||
fontName="Courier" |
|||
fontSize="7.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle name="TITLES_NEW" |
|||
fontName="Courier" |
|||
fontSize="7.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="23cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Año Fiscal: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periodos: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Fecha Intervalo: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
<spacer length="0.5cm"/> |
|||
<section> |
|||
<para style="TITLE_LEFT_ALIGN"> [[ repeatIn(lines(data['form']), 'a') ]] </para> |
|||
<blockTable colWidths="3.0cm,7.0cm,4.0cm,4.0cm,4.0cm,4.0cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Cuenta</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Descripcion</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Inicial</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debe</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Haber</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Final</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ a['type']=='view' and a['name'].upper() or a['name'].title() ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
<section> |
|||
<blockTable colWidths="4.0cm,7.0cm,3.0cm,4.0cm,4.0cm,4.0cm" style="BODY_LINE" repeatRows="1"> |
|||
[[ (a['type'] <> 'view') or removeParentNode('blockTable') ]] |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Fecha - Periodo</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Referencia</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Cuenta Analitica</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debe</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Haber</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Balance</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW">[[ repeatIn(a['analisis'], 'm') ]] |
|||
<font>[[ set_fecha(m['date']) ]] - [[ m['period'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES_NEW"> |
|||
<font>[[ m['ref'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ m['analytic'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['debit'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['credit'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['balance'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</section> |
|||
</section> |
|||
|
|||
</story> |
|||
</document> |
@ -1,132 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(27.94cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1.5cm" y1="1.5cm" width="24.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.5cm" y="27.0cm">[[ company.name ]] RIF: [[ company.partner_id.vat[2] ]]-[[ company.partner_id.vat[3:-1] ]]-[[ company.partner_id.vat[-1] ]]</drawString> |
|||
<drawString x="20.7cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1.0cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="25.5cm" y="1.0cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1.3cm 26.9cm 26.5cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<!-- |
|||
<blockAlignment value="LEFT"/> |
|||
--> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TITLE_CENTER_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="CENTER" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="9.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="23cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Año Fiscal: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periodos: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Fecha Intervalo: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<blockTable colWidths="4.0cm,10.0cm,6.0cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Cuenta</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Descripcion</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Actual</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]] |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font> |
|||
<font>[[ a['type']=='view' and a['name'].upper() or a['name'].title() ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</story> |
|||
</document> |
@ -1,132 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1cm" y1="2cm" width="19.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.0cm" y="27.0cm">[[ company.name ]]</drawString> |
|||
<drawString x="14.5cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="18.5cm" y="1cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1cm 26.9cm 20.0cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<blockAlignment value="LEFT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="9.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="19cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Año Fiscal: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periodos: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Fecha Intervalo: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<blockTable colWidths="3.0cm,8.0cm,4.0cm,4.0cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Code</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Account</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debit</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Credit</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]] |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
|
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font> |
|||
<font>[[ a['name'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
|
|||
</tr> |
|||
</blockTable> |
|||
</story> |
|||
</document> |
@ -1,148 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1cm" y1="2cm" width="19.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.0cm" y="27.0cm">[[ company.name ]]</drawString> |
|||
<drawString x="14.5cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="18.5cm" y="1cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1cm 26.9cm 20.0cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<blockAlignment value="LEFT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Helvetica-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Helvetica-Bold" |
|||
fontSize="9" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Helvetica-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="19cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Fiscal year: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periods range: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Date: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<blockTable colWidths="2.5cm,6.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Code</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Account</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Initial</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debit</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Credit</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Balance</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]] |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font> |
|||
<font>[[ a['name'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</story> |
|||
</document> |
@ -1,151 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(27.94cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1.5cm" y1="1.5cm" width="24.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.5cm" y="27.0cm">[[ company.name ]] RIF: [[ company.partner_id.vat[2] ]]-[[ company.partner_id.vat[3:-1] ]]-[[ company.partner_id.vat[-1] ]]</drawString> |
|||
<drawString x="20.7cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1.0cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="25.5cm" y="1.0cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1.3cm 26.9cm 26.5cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<!-- |
|||
<blockAlignment value="LEFT"/> |
|||
--> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="9.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="23cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Año Fiscal: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periodos: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Fecha Intervalo: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<blockTable colWidths="3.0cm,7.0cm,4.0cm,4.0cm,4.0cm,4.0cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Cuenta</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Descripcion</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Anterior</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debe</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Haber</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Actual</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]] |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font> |
|||
<font>[[ a['type']=='view' and a['name'].upper() or a['name'].title() ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</story> |
|||
</document> |
@ -1,148 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="1cm" y1="2cm" width="19.0cm" height="25cm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.0cm" y="27.0cm">[[ company.name ]]</drawString> |
|||
<drawString x="14.5cm" y="27.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="18.5cm" y="1cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<lines>1cm 26.9cm 20.0cm 26.9cm</lines> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<blockAlignment value="LEFT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="7.5" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="7.5" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="19cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Fiscal year: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periods range: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Date: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<blockTable colWidths="2.5cm,6.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Code</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Account</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Initial</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debit</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Credit</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Balance</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]] |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font> |
|||
<font>[[ a['name'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</story> |
|||
</document> |
@ -1,245 +0,0 @@ |
|||
<?xml version="1.0"?> |
|||
<document filename="test.pdf"> |
|||
<template pageSize="(279.4mm,215.9mm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
|||
<pageTemplate id="first"> |
|||
<frame id="first" x1="10mm" y1="10mm" width="259.4mm" height="195.9mm"/> |
|||
<pageGraphics> |
|||
<setFont name="Helvetica-Bold" size="9"/> |
|||
|
|||
<!--COL 1--> |
|||
<drawString x="1.5cm" y="21.0cm">[[ company.name ]] RIF: [[ company.partner_id.vat[2] ]]-[[ company.partner_id.vat[3:-1] ]]-[[ company.partner_id.vat[-1] ]]</drawString> |
|||
<drawString x="20.7cm" y="21.0cm">[[ get_inf_text(data['form']) ]] - [[ company.currency_id.name ]]</drawString> |
|||
|
|||
<!--COL 2--> |
|||
<setFont name="Helvetica" size="8"/> |
|||
<drawString x="1.0cm" y="1.0cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString> |
|||
<drawString x="27.0cm" y="1.0cm">Page <pageNumber/></drawString> |
|||
|
|||
<lineMode width="0.7"/> |
|||
<!-- <lines>1.3cm 26.9cm 26.5cm 26.9cm</lines> --> |
|||
<setFont name="Helvetica" size="8"/> |
|||
|
|||
</pageGraphics> |
|||
|
|||
</pageTemplate> |
|||
</template> |
|||
<stylesheet> |
|||
<blockTableStyle id="BODY_LINE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="BODY_STRIKE"> |
|||
<blockValign value="TOP"/> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockTopPadding length="1.0"/> |
|||
<blockBottomPadding length="1.0"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/> |
|||
</blockTableStyle> |
|||
<blockTableStyle id="TOP_TABLE"> |
|||
<!-- |
|||
<blockAlignment value="LEFT"/> |
|||
--> |
|||
<blockAlignment value="RIGHT"/> |
|||
<blockValign value="TOP"/> |
|||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/> |
|||
</blockTableStyle> |
|||
|
|||
<initialize> |
|||
<paraStyle name="all" alignment="justify"/> |
|||
</initialize> |
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle |
|||
name="TOP_TITLE" |
|||
fontName="Courier-Bold" |
|||
fontSize="9.0" |
|||
leftIndent="0.0" |
|||
alignment="LEFT"/> |
|||
<paraStyle name="TITLES" |
|||
fontName="Courier-Bold" |
|||
fontSize="8.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
|
|||
<paraStyle |
|||
name="TITLE_LEFT_ALIGN_NEW" |
|||
fontName="Courier" |
|||
fontSize="7.0" |
|||
leading="10" |
|||
alignment="RIGHT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
<paraStyle name="TITLES_NEW" |
|||
fontName="Courier" |
|||
fontSize="7.0" |
|||
leading="10" |
|||
alignment="LEFT" |
|||
spaceBefore="0.0" |
|||
spaceAfter="0.0"/> |
|||
</stylesheet> |
|||
<images/> |
|||
<story> |
|||
<para>[[setLang(user.context_lang)]]</para> |
|||
<blockTable colWidths="23cm" style="TOP_TABLE" repeatRows="1"> |
|||
<tr> |
|||
<td> |
|||
<para style="TOP_TITLE">Año Fiscal: [[ get_fiscalyear_text(data['form']) or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Periodos: [[ get_periods_and_date_text(data['form'])['periods'] or removeParentNode('para') ]]</para> |
|||
<para style="TOP_TITLE">Fecha Intervalo: [[ get_periods_and_date_text(data['form'])['date'] or removeParentNode('para') ]]</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
|
|||
<section> |
|||
<para style="TITLE_LEFT_ALIGN"> [[ repeatIn(lines(data['form']), 'a') ]] </para> |
|||
<blockTable colWidths="3.0cm,10.0cm,3.0cm,3.0cm,3.0cm,3.0cm" style="BODY" repeatRows="1"> |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Cuenta</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Descripcion</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Inicial</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debe</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Haber</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Saldo Final</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<i>[[a['label']==True and a['code'] or '' ]]</i> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES"> |
|||
<font>[[ a['type']=='view' and a['name'].upper() or a['name'].title() ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>[[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
<section> |
|||
<blockTable colWidths="4.0cm,7.0cm,3.0cm,3.0cm,3.0cm,3.0cm,3.0cm" style="BODY_LINE" repeatRows="1"> |
|||
[[ (a['type'] <> 'view') or removeParentNode('blockTable') ]] |
|||
<tr noRowsplits="1"> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN"> |
|||
<font>Fecha Periodo</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES">Referencia</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Asiento Diario</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Empresa</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Debe</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Haber</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN">Balance</para> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW">[[ repeatIn(a['mayor'], 'm') ]] |
|||
<font>[[ set_fecha(m['date']) ]]</font> |
|||
</para> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ m['period'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLES_NEW"> |
|||
<font>[[ m['name'] ]] [[ m['ref'] and (' - Ref %s'%m['ref']) or '' ]] </font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ m['entry'] ]]</font> |
|||
</para> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ m['journal'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ m['partner'] ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['debit'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['credit'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
<td> |
|||
<para style="TITLE_LEFT_ALIGN_NEW"> |
|||
<font>[[ formatLang(m['balance'], digits=2) or '0,00' ]]</font> |
|||
</para> |
|||
</td> |
|||
</tr> |
|||
</blockTable> |
|||
</section> |
|||
</section> |
|||
|
|||
</story> |
|||
</document> |
@ -1,20 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import wizard_account_balance_4_report |
|||
#~ import wizard_account_libro_mayor_report |
|||
|
|||
|
@ -1,144 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- |
|||
Balance de Comprobacion |
|||
--> |
|||
<record id="wizard_reporte_comprobacion_view" model="ir.ui.view"> |
|||
<field name="name">Wizard Report Balance</field> |
|||
<field name="model">wizard.reporte.comprobacion</field> |
|||
<field name="type">form</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="General Account Balance [ Initial | Debit | Credit | Balance ]"> |
|||
<group width='800' height='600'> |
|||
<field name="company_id"/> |
|||
<newline/> |
|||
<group colspan="4"> |
|||
<field name="inf_type"/> |
|||
<field name="asentado"/> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Cuentas Contables a incluir" colspan="4"/> |
|||
<field name="account_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]"/> |
|||
<newline/> |
|||
<field name="analytic_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id),('type','!=','view')]" attrs="{'invisible':[('inf_type','<>','bac')]}"/> |
|||
<field name="display_account" required="True" attrs="{'invisible':[('inf_type','in',('bac','bml'))]}"/> |
|||
<field name="display_account_level" attrs="{'invisible':[('inf_type','in',('bac','bml'))],'required':[('inf_type','not in',('bac','bml'))]}"/> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Filtros" colspan="4"/> |
|||
<field name="fiscalyear" on_change="onchange_filter(fiscalyear,filter)"/> |
|||
<field name="filter" required="True"/> |
|||
<newline/> |
|||
<group attrs="{'invisible':[('filter','=','none')]}" colspan="4"> |
|||
<group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4"> |
|||
<separator string="Filtro por Fecha" colspan="4"/> |
|||
<field name="date_from" attrs="{'required':[('filter','in',('bydate','all'))]}"/> |
|||
<field name="date_to" attrs="{'required':[('filter','in',('bydate','all'))]}"/> |
|||
</group> |
|||
<group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4"> |
|||
<separator string="Filtro por Periodo" colspan="4"/> |
|||
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
<group colspan="4" attrs="{'invisible':[('inf_type','in',('bml','bac'))]}"> |
|||
<separator string="Total" colspan="4"/> |
|||
<field name="tot_check"/> |
|||
<field name="lab_str" attrs="{'required':[('tot_check','=','True'),('inf_type','not in',('bml','bac'))]}"/> |
|||
</group> |
|||
<group> |
|||
<button name="print_report" string="Print" type="object"/> |
|||
</group> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_wizard_reporte_comprobacion" model="ir.actions.act_window"> |
|||
<field name="name">Reporte Balance Con Wizard</field> |
|||
<field name="res_model">wizard.reporte.comprobacion</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="wizard_reporte_comprobacion_view"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
id="menu_wizard_reporte_comprobacion" |
|||
name="Mayor Analitico de Cuentas" |
|||
parent="account.final_accounting_reports" |
|||
sequence="99" |
|||
action="action_wizard_reporte_comprobacion"/> |
|||
|
|||
<!-- |
|||
Libro Mayor Analitico |
|||
|
|||
|
|||
<record id="wizard_reporte_mayor_analitico" model="ir.ui.view"> |
|||
<field name="name">Wizard Reporte Mayor Analitico</field> |
|||
<field name="model">wizard.mayor.analitico</field> |
|||
<field name="type">form</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Reporte Libro Mayor Analitico"> |
|||
<group width='800' height='600'> |
|||
<field name="company_id"/> |
|||
<newline/> |
|||
<group colspan="4"> |
|||
<separator string="Accounts to include" colspan="4"/> |
|||
<field name="account_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]"/> |
|||
<field name="display_account" required="True"/> |
|||
<field name="display_account_level" required="True" /> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Period" colspan="4"/> |
|||
<field name="fiscalyear" on_change="onchange_filter(fiscalyear,filter)"/> |
|||
<newline/> |
|||
<field name="filter" required="True"/> |
|||
<newline/> |
|||
<group attrs="{'invisible':[('filter','=','none')]}" colspan="4"> |
|||
<group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4"> |
|||
<separator string="Date Filter" colspan="4"/> |
|||
<field name="date_from" attrs="{'required':[('filter','in',('bydate','all'))]}"/> |
|||
<field name="date_to" attrs="{'required':[('filter','in',('bydate','all'))]}"/> |
|||
</group> |
|||
<group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4"> |
|||
<separator string="Filter on Periods" colspan="4"/> |
|||
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]" |
|||
attrs="{'required':[('filter','in',('byperiod','all'))]}"/> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Total" colspan="4"/> |
|||
<field name="tot_check"/> |
|||
<field name="lab_str"/> |
|||
<field name="inf_type"/> |
|||
</group> |
|||
<group> |
|||
<button name="print_report" string="Print" type="object"/> |
|||
</group> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_wizard_reporte_mayor_analitico" model="ir.actions.act_window"> |
|||
<field name="name">Wizard Mayor Analitico</field> |
|||
<field name="res_model">wizard.mayor.analitico</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="wizard_reporte_mayor_analitico"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
id="menu_wizard_reporte_mayor_analitico" |
|||
name="Libro Mayor Analitico" |
|||
parent="account.final_accounting_reports" |
|||
sequence="100" |
|||
action="action_wizard_reporte_mayor_analitico"/> |
|||
--> |
|||
</data> |
|||
</openerp> |
@ -1,153 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# Coded by: Humberto Arocha humberto@openerp.com.ve |
|||
# Angelica Barrios angelicaisabelb@gmail.com |
|||
# Jordi Esteve <jesteve@zikzakmedia.com> |
|||
# Javier Duran <javieredm@gmail.com> |
|||
# Planified by: Humberto Arocha |
|||
# Finance by: HELADOS GILDA, C.A. http://www.heladosgilda.com.ve |
|||
# Audited by: Humberto Arocha hbto@vauxoo.com |
|||
############################################################################# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import wizard |
|||
import pooler |
|||
import time |
|||
from tools.translate import _ |
|||
|
|||
options_form = '''<?xml version="1.0"?> |
|||
<form string="General Account Balance [ Debit | Credit ]"> |
|||
<field name="company_id"/> |
|||
<newline/> |
|||
<group colspan="4"> |
|||
<separator string="Accounts to include" colspan="4"/> |
|||
<field name="account_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]"/> |
|||
<field name="display_account" required="True"/> |
|||
<field name="display_account_level" required="True" /> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Period" colspan="4"/> |
|||
<field name="fiscalyear"/> |
|||
<newline/> |
|||
<field name="state" required="True"/> |
|||
<newline/> |
|||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4"> |
|||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> |
|||
<separator string="Date Filter" colspan="4"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
</group> |
|||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> |
|||
<separator string="Filter on Periods" colspan="4"/> |
|||
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Total" colspan="4"/> |
|||
<field name="tot_check"/> |
|||
<field name="lab_str"/> |
|||
<field name="inf_type"/> |
|||
|
|||
</group> |
|||
</form>''' |
|||
|
|||
options_fields = { |
|||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, |
|||
'account_list': {'string': 'Root accounts', 'type':'many2many', 'relation':'account.account', 'required':True ,'domain':[]}, |
|||
'state':{ |
|||
'string':"Date/Period Filter", |
|||
'type':'selection', |
|||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], |
|||
'default': lambda *a:'none' |
|||
}, |
|||
'fiscalyear': { |
|||
'string':'Fiscal year', |
|||
'type':'many2one', |
|||
'relation':'account.fiscalyear', |
|||
'help':'Keep empty to use all open fiscal years to compute the balance' |
|||
}, |
|||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods in the fiscal year if empty'}, |
|||
'display_account':{'string':"Display accounts ", 'type':'selection', 'selection':[('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')]}, |
|||
'display_account_level':{'string':"Up to level", 'type':'integer', 'default': lambda *a: 0, 'help': 'Display accounts up to this level (0 to show all)'}, |
|||
'date_from': {'string':"Start date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, |
|||
'date_to': {'string':"End date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, |
|||
'tot_check': {'string':'Show Total', 'type':'boolean'}, |
|||
'lab_str': {'string': 'Description', 'type': 'char', 'size': 128}, |
|||
'inf_type':{ |
|||
'string':"Tipo Informe", |
|||
'type':'selection', |
|||
'selection':[('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')], |
|||
'default': lambda *a:'bgen', |
|||
'required':True |
|||
}, |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
class wizard_report(wizard.interface): |
|||
|
|||
def _get_defaults(self, cr, uid, data, context={}): |
|||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) |
|||
if user.company_id: |
|||
company_id = user.company_id.id |
|||
else: |
|||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
|||
data['form']['company_id'] = company_id |
|||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') |
|||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) |
|||
data['form']['context'] = context |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_state(self, cr, uid, data, context): |
|||
if data['form']['state'] == 'bydate': |
|||
self._check_date(cr, uid, data, context) |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_date(self, cr, uid, data, context): |
|||
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']) |
|||
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'])) |
|||
else: |
|||
return 'report' |
|||
else: |
|||
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) |
|||
|
|||
|
|||
states = { |
|||
|
|||
'init': { |
|||
'actions': [_get_defaults], |
|||
'result': {'type':'form', 'arch': options_form, 'fields': options_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} |
|||
}, |
|||
'report': { |
|||
'actions': [_check_state], |
|||
'result': {'type':'print', 'report':'account.account.balance.gene.2', 'state':'end'} |
|||
} |
|||
} |
|||
wizard_report('account.balance.gene.2.report') |
|||
|
@ -1,186 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
from osv import osv,fields |
|||
from tools.translate import _ |
|||
import pooler |
|||
import time |
|||
|
|||
class wizard_reporte_comprobacion(osv.osv_memory): |
|||
_name = "wizard.reporte.comprobacion" |
|||
|
|||
_columns = { |
|||
'company_id': fields.many2one('res.company', 'Company', required=True), |
|||
'account_list': fields.many2many ('account.account', 'rel_wizard_account', 'account_list', 'account_id', 'Cuentas Contables', required=True), |
|||
'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([('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'), |
|||
'date_to': fields.date('End date'), |
|||
'tot_check': fields.boolean('Show Total'), |
|||
'lab_str': fields.char('Description', size= 128), |
|||
'inf_type': fields.selection([('bml', 'Mayor Analitico')], 'Tipo Informe', required=True), |
|||
'asentado': fields.selection([('posted', 'Todos los asientos asentados'), ('todo', 'Todos los asientos')], 'Movimientos destino', required=True), |
|||
'analytic_list': fields.many2many('account.analytic.account', 'rel_wizard_account_analytic', 'analytic_list', 'account_analytic_id', 'Cuentas Analiticas'), |
|||
} |
|||
|
|||
_defaults = { |
|||
'date_from': lambda *a: time.strftime('%Y-%m-%d'), |
|||
'date_to': lambda *a: time.strftime('%Y-%m-%d'), |
|||
'filter': lambda *a:'byperiod', |
|||
'display_account_level': lambda *a: 0, |
|||
'inf_type': lambda *a:'bml', |
|||
'company_id': lambda *a: 1, |
|||
'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), |
|||
'display_account': lambda *a:'con_movimiento', |
|||
'asentado': lambda *a:'todo', |
|||
} |
|||
|
|||
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 = {} |
|||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) |
|||
if user.company_id: |
|||
company_id = user.company_id.id |
|||
else: |
|||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
|||
data['form']['company_id'] = company_id |
|||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') |
|||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) |
|||
data['form']['context'] = context |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_state(self, cr, uid, data, context=None): |
|||
if context is None: |
|||
context = {} |
|||
if data['form']['filter'] == 'bydate': |
|||
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' = 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_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 osv.except_osv(_('UserError'),'No existe periodo fiscal') |
|||
|
|||
def esta_en_lista(self, cuenta_id, lista_cuentas): |
|||
for i in lista_cuentas: |
|||
if cuenta_id == i: |
|||
return True |
|||
return False |
|||
|
|||
def limpiar_hijos(self, cr, uid, ids, data): |
|||
accounts = [] |
|||
accounts = data |
|||
aa_obj = self.pool.get("account.account") |
|||
new_account_list = [] |
|||
for aa_brw in aa_obj.browse(cr,uid,accounts): |
|||
eliminar = False |
|||
parent_id_cur = aa_brw.parent_id |
|||
while parent_id_cur: |
|||
if self.esta_en_lista(parent_id_cur.id, accounts): |
|||
parent_id_cur = False |
|||
eliminar = True |
|||
else: |
|||
parent_id_cur = parent_id_cur.parent_id |
|||
if not eliminar: |
|||
new_account_list.append(aa_brw.id) |
|||
return new_account_list |
|||
|
|||
def todos_periodos(self, cr, uid, fiscalyear): |
|||
date = self.pool.get('account.fiscalyear').read(cr, uid, fiscalyear, ['date_start','date_stop']) |
|||
return date['date_start'],date['date_stop'] |
|||
|
|||
def get_cuentas_analiticas(self, cr, uid, lista_analitica): |
|||
if lista_analitica != []: |
|||
return lista_analitica |
|||
else: |
|||
return self.pool.get('account.analytic.account').search(cr, uid, [('type','<>','view')]) |
|||
|
|||
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]) |
|||
|
|||
if data['form']['filter'] == 'byperiod': |
|||
if data['form']['periods'] == []: |
|||
raise osv.except_osv(_('Error !'),('Debe agregar al menos un periodo')) |
|||
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']['periods'] |
|||
data['form']['date_from'],data['form']['date_to'] = self.todos_periodos(cr,uid,data['form']['fiscalyear']) |
|||
else: |
|||
if data['form']['periods'] == []: |
|||
raise osv.except_osv(_('Error !'),('Debe agregar al menos un periodo')) |
|||
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')) |
|||
|
|||
if data.has_key('form') and data['form']: |
|||
form = data['form'] |
|||
if form.has_key('account_list') and form['account_list']: |
|||
form['account_list'] = self.limpiar_hijos(cr, uid, ids, form['account_list']) |
|||
|
|||
if str(data['form']['asentado']).strip() == 'posted': |
|||
data['form']['state'] = 'posted' |
|||
del data['form']['asentado'] |
|||
|
|||
if data['form']['inf_type'] == 'bml': |
|||
data['form']['tot_check'] = False |
|||
data['form']['display_account_level'] = 0 |
|||
data['form']['display_account'] = 'con_movimiento' |
|||
return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.reporte.comprobacion.mayor.analitico', 'datas': data} |
|||
elif data['form']['inf_type'] == 'bac': |
|||
data['form']['tot_check'] = False |
|||
data['form']['display_account_level'] = 0 |
|||
data['form']['display_account'] = 'con_movimiento' |
|||
data['form']['analytic_list'] = self.get_cuentas_analiticas(cr, uid,data['form']['analytic_list']) |
|||
return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.reporte.comprobacion.analisis.cuentas', 'datas': data} |
|||
elif data['form']['inf_type'] == 'bgen': |
|||
return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.reporte.comprobacion.un.col', 'datas': data} |
|||
else: |
|||
return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.reporte.comprobacion.cuatro.col', 'datas': data} |
|||
|
|||
wizard_reporte_comprobacion() |
@ -1,153 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
########################################################################### |
|||
# Module Writen to OpenERP, Open Source Management Solution |
|||
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
|||
# All Rights Reserved |
|||
###############Credits###################################################### |
|||
# Coded by: Humberto Arocha humberto@openerp.com.ve |
|||
# Angelica Barrios angelicaisabelb@gmail.com |
|||
# Jordi Esteve <jesteve@zikzakmedia.com> |
|||
# Javier Duran <javieredm@gmail.com> |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
############################################################################## |
|||
|
|||
import wizard |
|||
import pooler |
|||
import time |
|||
from tools.translate import _ |
|||
|
|||
options_form = '''<?xml version="1.0"?> |
|||
<form string="General Account Balance [ Debit - Credit ] (One Column)"> |
|||
<field name="company_id"/> |
|||
<newline/> |
|||
<group colspan="4"> |
|||
<separator string="Accounts to include" colspan="4"/> |
|||
<field name="account_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]"/> |
|||
<field name="display_account" required="True"/> |
|||
<field name="display_account_level" required="True" /> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Period" colspan="4"/> |
|||
<field name="fiscalyear"/> |
|||
<newline/> |
|||
<field name="state" required="True"/> |
|||
<newline/> |
|||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4"> |
|||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> |
|||
<separator string="Date Filter" colspan="4"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
</group> |
|||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> |
|||
<separator string="Filter on Periods" colspan="4"/> |
|||
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Total" colspan="4"/> |
|||
<field name="tot_check"/> |
|||
<field name="lab_str"/> |
|||
<field name="inf_type"/> |
|||
|
|||
</group> |
|||
</form>''' |
|||
|
|||
options_fields = { |
|||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, |
|||
'account_list': {'string': 'Root accounts', 'type':'many2many', 'relation':'account.account', 'required':True ,'domain':[]}, |
|||
'state':{ |
|||
'string':"Date/Period Filter", |
|||
'type':'selection', |
|||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], |
|||
'default': lambda *a:'none' |
|||
}, |
|||
'fiscalyear': { |
|||
'string':'Fiscal year', |
|||
'type':'many2one', |
|||
'relation':'account.fiscalyear', |
|||
'help':'Keep empty to use all open fiscal years to compute the balance' |
|||
}, |
|||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods in the fiscal year if empty'}, |
|||
'display_account':{'string':"Display accounts ", 'type':'selection', 'selection':[('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')]}, |
|||
'display_account_level':{'string':"Up to level", 'type':'integer', 'default': lambda *a: 0, 'help': 'Display accounts up to this level (0 to show all)'}, |
|||
'date_from': {'string':"Start date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, |
|||
'date_to': {'string':"End date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, |
|||
'tot_check': {'string':'Show Total', 'type':'boolean'}, |
|||
'lab_str': {'string': 'Description', 'type': 'char', 'size': 128}, |
|||
'inf_type':{ |
|||
'string':"Tipo Informe", |
|||
'type':'selection', |
|||
'selection':[('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')], |
|||
'default': lambda *a:'bgen', |
|||
'required':True |
|||
}, |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
class wizard_report(wizard.interface): |
|||
|
|||
def _get_defaults(self, cr, uid, data, context={}): |
|||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) |
|||
if user.company_id: |
|||
company_id = user.company_id.id |
|||
else: |
|||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
|||
data['form']['company_id'] = company_id |
|||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') |
|||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) |
|||
data['form']['context'] = context |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_state(self, cr, uid, data, context): |
|||
if data['form']['state'] == 'bydate': |
|||
self._check_date(cr, uid, data, context) |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_date(self, cr, uid, data, context): |
|||
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']) |
|||
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'])) |
|||
else: |
|||
return 'report' |
|||
else: |
|||
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) |
|||
|
|||
|
|||
states = { |
|||
|
|||
'init': { |
|||
'actions': [_get_defaults], |
|||
'result': {'type':'form', 'arch': options_form, 'fields': options_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} |
|||
}, |
|||
'report': { |
|||
'actions': [_check_state], |
|||
'result': {'type':'print', 'report':'account.account.balance.gene', 'state':'end'} |
|||
} |
|||
} |
|||
wizard_report('account.balance.gene.report') |
|||
|
@ -1,128 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import wizard |
|||
import pooler |
|||
import time |
|||
from tools.translate import _ |
|||
|
|||
options_form = '''<?xml version="1.0"?> |
|||
<form string="Full Account Balance"> |
|||
<field name="company_id"/> |
|||
<newline/> |
|||
<group colspan="4"> |
|||
<separator string="Accounts to include" colspan="4"/> |
|||
<field name="account_list" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]"/> |
|||
<field name="display_account" required="True"/> |
|||
<field name="display_account_level" required="True" /> |
|||
</group> |
|||
<group colspan="4"> |
|||
<separator string="Period" colspan="4"/> |
|||
<field name="fiscalyear"/> |
|||
<newline/> |
|||
<field name="state" required="True"/> |
|||
<newline/> |
|||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4"> |
|||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> |
|||
<separator string="Date Filter" colspan="4"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
</group> |
|||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> |
|||
<separator string="Filter on Periods" colspan="4"/> |
|||
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
</form>''' |
|||
|
|||
options_fields = { |
|||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, |
|||
'account_list': {'string': 'Root accounts', 'type':'many2many', 'relation':'account.account', 'required':True ,'domain':[]}, |
|||
'state':{ |
|||
'string':"Date/Period Filter", |
|||
'type':'selection', |
|||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], |
|||
'default': lambda *a:'none' |
|||
}, |
|||
'fiscalyear': { |
|||
'string':'Fiscal year', |
|||
'type':'many2one', |
|||
'relation':'account.fiscalyear', |
|||
'help':'Keep empty to use all open fiscal years to compute the balance' |
|||
}, |
|||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods in the fiscal year if empty'}, |
|||
'display_account':{'string':"Display accounts ", 'type':'selection', 'selection':[('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')]}, |
|||
'display_account_level':{'string':"Up to level", 'type':'integer', 'default': lambda *a: 0, 'help': 'Display accounts up to this level (0 to show all)'}, |
|||
'date_from': {'string':"Start date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, |
|||
'date_to': {'string':"End date", 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, |
|||
} |
|||
|
|||
|
|||
class wizard_report(wizard.interface): |
|||
|
|||
def _get_defaults(self, cr, uid, data, context={}): |
|||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) |
|||
if user.company_id: |
|||
company_id = user.company_id.id |
|||
else: |
|||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
|||
data['form']['company_id'] = company_id |
|||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') |
|||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) |
|||
if (data['model'] == 'account.account'): |
|||
data['form']['account_list'] = data['ids'] |
|||
data['form']['context'] = context |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_state(self, cr, uid, data, context): |
|||
if data['form']['state'] == 'bydate': |
|||
self._check_date(cr, uid, data, context) |
|||
return data['form'] |
|||
|
|||
|
|||
def _check_date(self, cr, uid, data, context): |
|||
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']) |
|||
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'])) |
|||
else: |
|||
return 'report' |
|||
else: |
|||
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) |
|||
|
|||
|
|||
states = { |
|||
|
|||
'init': { |
|||
'actions': [_get_defaults], |
|||
'result': {'type':'form', 'arch': options_form, 'fields': options_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} |
|||
}, |
|||
'report': { |
|||
'actions': [_check_state], |
|||
'result': {'type':'print', 'report':'account.balance.full', 'state':'end'} |
|||
} |
|||
} |
|||
wizard_report('account.balance.full.report') |
@ -1,59 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<report |
|||
auto="False" |
|||
id="wizard_reporte_comprobacion_cuatro_col" |
|||
menu="True" |
|||
model="wizard.reporte.comprobacion" |
|||
name="wizard.reporte.comprobacion.cuatro.col" |
|||
rml="l10n_ve_account_financial_report/report/balance_full_4_cols_h.rml" |
|||
string="Balance de Comprobacion Cuatro Columnas" |
|||
header="False" |
|||
/> |
|||
<report |
|||
auto="False" |
|||
id="wizard_reporte_comprobacion_dos_col" |
|||
menu="True" |
|||
model="wizard.reporte.comprobacion" |
|||
name="wizard.reporte.comprobacion.dos.col" |
|||
rml="l10n_ve_account_financial_report/report/balance_full_2_cols.rml" |
|||
string="Balance de Comprobacion Dos Columnas" |
|||
header="False" |
|||
/> |
|||
<report |
|||
auto="False" |
|||
id="wizard_reporte_comprobacion_un_col" |
|||
menu="True" |
|||
model="wizard.reporte.comprobacion" |
|||
name="wizard.reporte.comprobacion.un.col" |
|||
rml="l10n_ve_account_financial_report/report/balance_full.rml" |
|||
string="Balance de Comprobacion Una Columna" |
|||
header="False" |
|||
/> |
|||
|
|||
# Reporte mayor analitico |
|||
<report |
|||
auto="False" |
|||
id="wizard_mayor_analitico_reporte" |
|||
menu="False" |
|||
model="wizard.reporte.comprobacion" |
|||
name="wizard.reporte.comprobacion.mayor.analitico" |
|||
rml="l10n_ve_account_financial_report/report/mayor_analitico.rml" |
|||
string="Mayor Analitico" |
|||
header="False" |
|||
/> |
|||
|
|||
# Reporte analisis de cuentas |
|||
<report |
|||
auto="False" |
|||
id="wizard_analisis_cuentas_reporte" |
|||
menu="False" |
|||
model="wizard.reporte.comprobacion" |
|||
name="wizard.reporte.comprobacion.analisis.cuentas" |
|||
rml="l10n_ve_account_financial_report/report/analisis_cuentas.rml" |
|||
string="Analisis de Cuentas" |
|||
header="False" |
|||
/> |
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue