No, If I display all accounts, it should shows all accounts, no matter is there is entries or not
Fiscal year: always modifiable check with l10n_be bzr revid: patelamit2003@gmail.com-20081024101105-6ipq8n108k531qg4
This commit is contained in:
parent
6ecdbc0e9d
commit
587983e6b7
|
@ -167,31 +167,34 @@ class general_ledger(rml_parse.rml_parse):
|
|||
|
||||
|
||||
## We will now compute solde initiaux
|
||||
for move in res:
|
||||
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'"
|
||||
self.cr.execute(SOLDEINIT)
|
||||
resultat = self.cr.dictfetchall()
|
||||
|
||||
if resultat[0] :
|
||||
if not len(res):
|
||||
return[account]
|
||||
else:
|
||||
for move in res:
|
||||
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
sum_debit = 0
|
||||
else:
|
||||
|
||||
sum_debit = resultat[0]['sum_debit']
|
||||
if resultat[0]['sum_credit'] == None:
|
||||
sum_credit = 0
|
||||
else:
|
||||
sum_credit = resultat[0]['sum_credit']
|
||||
|
||||
move.init_credit = sum_credit
|
||||
move.init_debit = sum_debit
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'"
|
||||
self.cr.execute(SOLDEINIT)
|
||||
resultat = self.cr.dictfetchall()
|
||||
|
||||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
if resultat[0] :
|
||||
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
sum_debit = 0
|
||||
else:
|
||||
|
||||
sum_debit = resultat[0]['sum_debit']
|
||||
if resultat[0]['sum_credit'] == None:
|
||||
sum_credit = 0
|
||||
else:
|
||||
sum_credit = resultat[0]['sum_credit']
|
||||
|
||||
move.init_credit = sum_credit
|
||||
move.init_debit = sum_debit
|
||||
|
||||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
##
|
||||
|
||||
return res
|
||||
|
|
|
@ -179,7 +179,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
|
||||
def get_children_accounts(self, account, form):
|
||||
|
||||
|
||||
print"account",account
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
#
|
||||
|
@ -223,7 +223,10 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
##
|
||||
if form['soldeinit']:
|
||||
if not len(res):
|
||||
print"==================="
|
||||
return [account]
|
||||
else:
|
||||
## We will now compute solde initiaux
|
||||
for move in res:
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'"
|
||||
|
@ -246,7 +249,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
##
|
||||
print"res",res
|
||||
return res
|
||||
|
||||
def lines(self, account, form):
|
||||
|
|
|
@ -35,7 +35,7 @@ period_form = '''<?xml version="1.0"?>
|
|||
<field name="company_id"/>
|
||||
<field name="display_account" required = "True"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear" attrs="{'readonly':[('state','=','bydate')]}"/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
|
@ -99,15 +99,7 @@ class wizard_report(wizard.interface):
|
|||
return data['form']
|
||||
|
||||
def _check_state(self, cr, uid, data, context):
|
||||
my_ids=data['ids']
|
||||
if data['model']!='account.account':
|
||||
my_ids=[data['form']['Account_list']]
|
||||
child_ids = pooler.get_pool(cr.dbname).get('account.account').search(cr, uid,[('parent_id', 'child_of',my_ids )])
|
||||
for child in child_ids :
|
||||
child_account = pooler.get_pool(cr.dbname).get('account.account').browse(cr, uid, child)
|
||||
res = pooler.get_pool(cr.dbname).get('account.move.line').search(cr, uid,[('account_id','=',child_account.id)])
|
||||
if not len(res):
|
||||
raise wizard.except_wizard('UserError',"Make sure the account you select has children accounts.")
|
||||
|
||||
if data['form']['state'] == 'bydate':
|
||||
self._check_date(cr, uid, data, context)
|
||||
data['form']['fiscalyear'] = 0
|
||||
|
|
|
@ -68,7 +68,7 @@ period_form = '''<?xml version="1.0"?>
|
|||
<form string="Select Date-Period">
|
||||
<field name="company_id" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear" attrs="{'readonly':[('state','=','bydate')]}"/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
|
||||
|
@ -145,19 +145,6 @@ def _check_date(self, cr, uid, data, context):
|
|||
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
|
||||
|
||||
def _check_state(self, cr, uid, data, context):
|
||||
|
||||
my_ids=data['ids']
|
||||
if data['model']!='account.account':
|
||||
my_ids=[data['form']['Account_list']]
|
||||
|
||||
child_ids = pooler.get_pool(cr.dbname).get('account.account').search(cr, uid,[('parent_id', 'child_of',my_ids )])
|
||||
|
||||
for child in child_ids :
|
||||
child_account = pooler.get_pool(cr.dbname).get('account.account').browse(cr, uid, child)
|
||||
res = pooler.get_pool(cr.dbname).get('account.move.line').search(cr, uid,[('account_id','=',child_account.id)])
|
||||
|
||||
if not len(res):
|
||||
raise wizard.except_wizard('UserError',"Make sure the account you select has children accounts.")
|
||||
|
||||
if data['form']['state'] == 'bydate':
|
||||
data['form']['fiscalyear'] = False
|
||||
|
|
Loading…
Reference in New Issue