Browse Source

[PEP8]

pull/7/merge
Yanina Aular 11 years ago
parent
commit
edb2e45c4b
  1. 4
      account_financial_report/model/__init__.py
  2. 2
      account_financial_report/report/__init__.py
  3. 9
      account_financial_report/report/parser.py
  4. 2
      account_financial_report/wizard/__init__.py
  5. 60
      account_financial_report/wizard/wizard.py

4
account_financial_report/model/__init__.py

@ -4,7 +4,7 @@
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Credits######################################################
# Coded by: Humberto Arocha <hbto@vauxoo.com>
# Planified by: Rafael Silva <rsilvam@vauxoo.com>
# Audited by: Nhomar Hernandez <nhomar@vauxoo.com>
@ -21,7 +21,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
##########################################################################
import account_financial_report
import res_company

2
account_financial_report/report/__init__.py

@ -3,7 +3,7 @@
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Credits######################################################
# Coded by: Humberto Arocha humberto@openerp.com.ve
# Angelica Barrios angelicaisabelb@gmail.com
# Jordi Esteve <jesteve@zikzakmedia.com>

9
account_financial_report/report/parser.py

@ -38,6 +38,7 @@ from osv import osv
import pdb
from openerp.tools.safe_eval import safe_eval as eval
class account_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -348,12 +349,12 @@ class account_balance(report_sxw.rml_parse):
################################################################
# Get the accounts #
################################################################
all_account_ids = _get_children_and_consol(self.cr, self.uid, account_ids, 100, self.context)
all_account_ids = _get_children_and_consol(
self.cr, self.uid, account_ids, 100, self.context)
account_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form[
'display_account_level'] and form['display_account_level'] or 100, self.context)
credit_account_ids = _get_children_and_consol(
self.cr, self.uid, credit_account_ids, 100, self.context, change_sign=True)
@ -499,7 +500,8 @@ class account_balance(report_sxw.rml_parse):
#~ Not black
dict_not_black = {}
for i in account_not_black:
dict_not_black[i.id] = {'obj': i, 'debit': 0.0, 'credit':0.0, 'balance':0.0}
dict_not_black[i.id] = {
'obj': i, 'debit': 0.0, 'credit': 0.0, 'balance': 0.0}
if form['inf_type'] == 'BS':
dict_not_black.get(i.id)['balanceinit'] = 0.0
@ -534,7 +536,6 @@ class account_balance(report_sxw.rml_parse):
#
###############################################################
for aa_id in account_ids:
id = aa_id[0]

2
account_financial_report/wizard/__init__.py

@ -3,7 +3,7 @@
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Credits######################################################
# Coded by: Humberto Arocha humberto@openerp.com.ve
# Angelica Barrios angelicaisabelb@gmail.com
# Jordi Esteve <jesteve@zikzakmedia.com>

60
account_financial_report/wizard/wizard.py

@ -3,7 +3,7 @@
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Credits######################################################
# Coded by: Humberto Arocha humberto@openerp.com.ve
# Angelica Barrios angelicaisabelb@gmail.com
# Jordi Esteve <jesteve@zikzakmedia.com>
@ -31,6 +31,7 @@ import pooler
import time
from tools.translate import _
class wizard_report(osv.osv_memory):
_name = "wizard.report"
@ -87,7 +88,8 @@ class wizard_report(osv.osv_memory):
res = {'value': {}}
p_obj = self.pool.get("account.period")
all_periods = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear),('special','=',False)],context=context)
all_periods = p_obj.search(cr, uid, [('fiscalyear_id', '=', fiscalyear), (
'special', '=', False)], context=context)
s = set(periods[0][2])
t = set(all_periods)
go = periods[0][2] and s.issubset(t) or False
@ -109,7 +111,8 @@ class wizard_report(osv.osv_memory):
context = {}
context['company_id'] = company_id
res = {'value': {}}
cur_id = self.pool.get('res.company').browse(cr,uid,company_id,context=context).currency_id.id
cur_id = self.pool.get('res.company').browse(
cr, uid, company_id, context=context).currency_id.id
res['value'].update({'currency_id': cur_id})
return res
@ -122,8 +125,10 @@ class wizard_report(osv.osv_memory):
if not company_id:
return res
cur_id = self.pool.get('res.company').browse(cr,uid,company_id,context=context).currency_id.id
fy_id = self.pool.get('account.fiscalyear').find(cr, uid,context=context)
cur_id = self.pool.get('res.company').browse(
cr, uid, company_id, context=context).currency_id.id
fy_id = self.pool.get('account.fiscalyear').find(
cr, uid, context=context)
res['value'].update({'fiscalyear': fy_id})
res['value'].update({'currency_id': cur_id})
res['value'].update({'account_list': []})
@ -135,29 +140,39 @@ class wizard_report(osv.osv_memory):
if context is None:
context = {}
res = {'value': {}}
if not afr_id: return res
if not afr_id:
return res
afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context)
res['value'].update({'currency_id':afr_brw.currency_id and afr_brw.currency_id.id or afr_brw.company_id.currency_id.id})
res['value'].update({
'currency_id': afr_brw.currency_id and afr_brw.currency_id.id or afr_brw.company_id.currency_id.id})
res['value'].update({'inf_type': afr_brw.inf_type or 'BS'})
res['value'].update({'columns': afr_brw.columns or 'five'})
res['value'].update({'display_account':afr_brw.display_account or 'bal_mov'})
res['value'].update({'display_account_level':afr_brw.display_account_level or 0})
res['value'].update({'fiscalyear':afr_brw.fiscalyear_id and afr_brw.fiscalyear_id.id})
res['value'].update({'account_list':[acc.id for acc in afr_brw.account_ids]})
res['value'].update({
'display_account': afr_brw.display_account or 'bal_mov'})
res['value'].update({
'display_account_level': afr_brw.display_account_level or 0})
res['value'].update({
'fiscalyear': afr_brw.fiscalyear_id and afr_brw.fiscalyear_id.id})
res['value'].update({'account_list': [
acc.id for acc in afr_brw.account_ids]})
res['value'].update({'periods': [p.id for p in afr_brw.period_ids]})
res['value'].update({'analytic_ledger':afr_brw.analytic_ledger or False})
res['value'].update({
'analytic_ledger': afr_brw.analytic_ledger or False})
res['value'].update({'tot_check': afr_brw.tot_check or False})
res['value'].update({'lab_str':afr_brw.lab_str or _('Write a Description for your Summary Total')})
res['value'].update({'lab_str': afr_brw.lab_str or _(
'Write a Description for your Summary Total')})
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)
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]
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)
@ -176,7 +191,8 @@ class wizard_report(osv.osv_memory):
context = {}
if data['form']['date_from'] > data['form']['date_to']:
raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial'))
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
@ -186,7 +202,8 @@ class wizard_report(osv.osv_memory):
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']))
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:
@ -220,7 +237,8 @@ class wizard_report(osv.osv_memory):
del data['form']['date_from']
del data['form']['date_to']
data['form']['periods'] = self.period_span(cr, uid, data['form']['periods'], data['form']['fiscalyear'])
data['form']['periods'] = self.period_span(cr, uid, data[
'form']['periods'], data['form']['fiscalyear'])
elif data['form']['filter'] == 'bydate':
self._check_date(cr, uid, data)
@ -231,7 +249,8 @@ class wizard_report(osv.osv_memory):
del data['form']['periods']
else:
self._check_date(cr, uid, data)
lis2 = str(data['form']['periods']).replace("[","(").replace("]",")")
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
@ -239,7 +258,8 @@ class wizard_report(osv.osv_memory):
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 interseccion entre el periodo y fecha es vacio'))
raise osv.except_osv(_('Error !'), _(
'La interseccion entre el periodo y fecha es vacio'))
if data['form']['columns'] == 'one':
name = 'afr.1cols'

Loading…
Cancel
Save