[IMP] finished refactoring of this report + corrected some bugs
bzr revid: qdp-launchpad@tinyerp.com-20100624101145-k5il24808t13yq3t
This commit is contained in:
parent
cc4688f481
commit
ab578523a1
|
@ -40,12 +40,9 @@ class general_ledger(rml_parse.rml_parse):
|
|||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or []
|
||||
#new_ids = ids
|
||||
else:
|
||||
new_ids.append(data['form']['Account_list'])
|
||||
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
|
||||
new_ids.append(data['form']['chart_account_id'])
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
super(general_ledger, self).set_context(objects, data, new_ids, report_type)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
|
@ -81,7 +78,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
if form['state'] == 'byperiod':
|
||||
if form['filter'] == 'filter_period':
|
||||
## This function will return the most aged date
|
||||
periods = form['periods']
|
||||
#periods = form['periods'][0][2]
|
||||
|
@ -98,36 +95,10 @@ class general_ledger(rml_parse.rml_parse):
|
|||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
elif form['state'] == 'bydate':
|
||||
elif form['filter'] == 'filter_date':
|
||||
borne_min = form['date_from']
|
||||
borne_max = form['date_to']
|
||||
elif form['state'] == 'all':
|
||||
periods = form['periods']
|
||||
#periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
"""
|
||||
else:
|
||||
periods_id = ','.join(map(str, periods))
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
period_min = res[0]['start_date']
|
||||
period_max = res[0]['stop_date']
|
||||
date_min = form['date_from']
|
||||
date_max = form['date_to']
|
||||
if period_min<date_min:
|
||||
borne_min = period_min
|
||||
else :
|
||||
borne_min = date_min
|
||||
if date_max<period_max:
|
||||
borne_max = period_max
|
||||
else :
|
||||
borne_max = date_max
|
||||
elif form['state'] == 'none':
|
||||
elif form['filter'] == 'filter_no':
|
||||
sql = """
|
||||
SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """
|
||||
self.cr.execute(sql)
|
||||
|
@ -141,46 +112,26 @@ class general_ledger(rml_parse.rml_parse):
|
|||
return self.date_borne
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
#
|
||||
|
||||
res = []
|
||||
ctx = self.context.copy()
|
||||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods']
|
||||
#ctx['periods'] = form['periods'][0][2]
|
||||
|
||||
else:
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
##
|
||||
#
|
||||
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.query = form['query_get']
|
||||
if account and account.child_consol_ids: # add ids of consolidated childs also of selected account
|
||||
ctx['consolidate_childs'] = True
|
||||
ctx['account_id'] = account.id
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
for child_id in ids_acc:
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc):
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid, [('account_id','=',child_account.id)], context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid, [('account_id','=',child_account.id)], context=ctx)) <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
|
@ -191,10 +142,11 @@ class general_ledger(rml_parse.rml_parse):
|
|||
res.append(child_account)
|
||||
##
|
||||
if not len(res):
|
||||
|
||||
return [account]
|
||||
else:
|
||||
## We will now compute solde initiaux
|
||||
if not form['soldeinit']:
|
||||
return res
|
||||
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)
|
||||
|
@ -215,20 +167,18 @@ class general_ledger(rml_parse.rml_parse):
|
|||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
|
||||
return res
|
||||
|
||||
def lines(self, account, form):
|
||||
""" Return all the account_move_line of account with their account code counterparts """
|
||||
|
||||
# First compute all counterpart strings for every move_id where this account appear
|
||||
# First compute all counterpart strings for every move_id where this account appear.
|
||||
# Currently, the counterpart info is used only in landscape mode
|
||||
sql = """
|
||||
SELECT m1.move_id,
|
||||
array_to_string(ARRAY(SELECT DISTINCT a.code FROM account_move_line m2 LEFT JOIN account_account a ON (m2.account_id=a.id) WHERE m2.move_id = m1.move_id AND m2.account_id<>%%s), ', ') AS counterpart
|
||||
FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s AND l.date<=%%s AND l.date>=%%s GROUP BY move_id) m1
|
||||
FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s GROUP BY move_id) m1
|
||||
""" % self.query
|
||||
self.cr.execute(sql, (account.id, account.id, self.date_borne['max_date'], self.date_borne['min_date']))
|
||||
self.cr.execute(sql, (account.id, account.id))
|
||||
counterpart_res = self.cr.dictfetchall()
|
||||
counterpart_accounts = {}
|
||||
for i in counterpart_res:
|
||||
|
@ -236,10 +186,10 @@ class general_ledger(rml_parse.rml_parse):
|
|||
del counterpart_res
|
||||
|
||||
# Then select all account_move_line of this account
|
||||
if form['sortbydate'] == 'sort_date':
|
||||
sql_sort='l.date'
|
||||
if form['sortby'] == 'sort_journal_partner':
|
||||
sql_sort='j.code, p.name'
|
||||
else:
|
||||
sql_sort='j.code'
|
||||
sql_sort='l.date'
|
||||
sql = """
|
||||
SELECT l.id, l.date, j.code, l.amount_currency,l.ref, l.name, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id, l.partner_id,
|
||||
m.name AS move_name, m.id AS move_id,
|
||||
|
@ -252,9 +202,9 @@ class general_ledger(rml_parse.rml_parse):
|
|||
LEFT JOIN res_partner p on (l.partner_id=p.id)
|
||||
LEFT JOIN account_invoice i on (m.id =i.move_id)
|
||||
JOIN account_journal j on (l.journal_id=j.id)
|
||||
WHERE %s AND l.account_id = %%s AND l.date<=%%s AND l.date>=%%s ORDER by %s
|
||||
WHERE %s AND l.account_id = %%s ORDER by %s
|
||||
""" % (self.query, sql_sort)
|
||||
self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date']))
|
||||
self.cr.execute(sql, (account.id,))
|
||||
res = self.cr.dictfetchall()
|
||||
account_sum = 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -266,8 +216,6 @@ class general_ledger(rml_parse.rml_parse):
|
|||
l['ref'] = '%s: %s'%(inv_types[l['invoice_type']],l['invoice_number'])
|
||||
l['partner'] = l['partner_name'] or ''
|
||||
account_sum = l['debit'] - l ['credit']
|
||||
#c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
#l['date'] = time.strftime("%d-%m-%Y",c)
|
||||
l['progress'] = account_sum
|
||||
l['line_corresp'] = counterpart_accounts[l['move_id']]
|
||||
# Modification du amount Currency
|
||||
|
@ -302,9 +250,6 @@ class general_ledger(rml_parse.rml_parse):
|
|||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('soldeinit', False):
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
</stylesheet>
|
||||
<story>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="date">Date</para></td>
|
||||
<td><para style="P3">Partner</para></td>
|
||||
|
@ -102,46 +102,45 @@
|
|||
<td><para style="P4">Crebit</para></td>
|
||||
<td><para style="P9">Balance</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P3">[[ repeatIn(lines(o, data['form']), 'line') ]] <font>[[ formatLang(line['date'],date=True) ]]</font></para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['debit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['credit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['progress']) ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
|
||||
|
||||
</blockTable>
|
||||
|
||||
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P3">[[ repeatIn(lines(o, data['form']), 'line') ]] <font>[[ formatLang(line['date'],date=True) ]]</font></para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['debit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['credit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['progress']) ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
|
||||
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="date">Date</para></td>
|
||||
<td><para style="P3">Partner</para></td>
|
||||
|
@ -155,18 +154,18 @@
|
|||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<para>[[repeatIn(get_children_accounts(a,data['form']), 'o')]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '' ]] [[ o.name or '' ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[ formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u> [[ formatLang(sum_currency_amount_account(a, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_currency_amount_account(a, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
|
@ -193,7 +192,4 @@
|
|||
</blockTable>
|
||||
</section>
|
||||
</story>
|
||||
|
||||
|
||||
|
||||
</document>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<story>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
|
||||
<blockTable colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="P12"><font color="white"> </font></para><para style="date">Date</para></td>
|
||||
<td><para style="P12"><font color="white"> </font></para><para style="P2">JNRL</para></td>
|
||||
|
@ -104,7 +104,7 @@
|
|||
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="404.0,375.0,69.0,72.0,64.0,59.00" style="Table5">
|
||||
|
@ -165,7 +165,7 @@
|
|||
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,166.0,90.0,60.0,378.0,50.0,69.0,72.0,64.0" style="tbl_content">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,166.0,90.0,60.0,378.0,50.0,69.0,72.0,64.0" style="tbl_content">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="405.0,435.0,69.0,72.0,64.0" style="Table5">
|
||||
|
|
|
@ -29,14 +29,14 @@ class account_common_report(osv.osv_memory):
|
|||
_description = "Common Report"
|
||||
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.account', 'Chart of account', required=True, domain = [('parent_id','=',False)]),
|
||||
'chart_account_id': fields.many2one('account.account', 'Chart of account', required=True, domain = [('parent_id','=',False)]),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
|
||||
'filter': fields.selection([('filter_no','No filters'), ('filter_date','Date'), ('filter_period','Periods')],"Filter by:", required=True),
|
||||
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
'period_ids': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods'),
|
||||
#not used. Do we really need it? 'period_ids': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods'),
|
||||
|
||||
'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
|
||||
|
||||
|
@ -92,7 +92,7 @@ class account_common_report(osv.osv_memory):
|
|||
# 'amount_currency' : True,
|
||||
'journal_ids': _get_all_journal,
|
||||
'filter': 'filter_no',
|
||||
'account_id': _get_account,
|
||||
'chart_account_id': _get_account,
|
||||
}
|
||||
|
||||
def _build_context(self, cr, uid, ids, data, context = None):
|
||||
|
@ -109,14 +109,17 @@ class account_common_report(osv.osv_memory):
|
|||
return result
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context):
|
||||
raise _('not implemented')
|
||||
raise (_('Error'), _('not implemented'))
|
||||
|
||||
def check_report(self, cr, uid, ids, context=None):
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
obj_acc_move_line = self.pool.get('account.move.line')
|
||||
data = {}
|
||||
data['ids'] = context.get('active_ids',[])
|
||||
data['model'] = context.get('active_model', 'ir.ui.menu')
|
||||
data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id'])[0]
|
||||
used_context = self._build_context(cr, uid, ids, data, context)
|
||||
query_line = obj_acc_move_line._query_get(cr, uid,
|
||||
obj='account_move_line', context=used_context)
|
||||
obj='l', context=used_context)
|
||||
return self._print_report(cr, uid, ids, data, query_line, context)
|
||||
account_common_report()
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<form string="Select Date-Period">
|
||||
|
||||
<group colspan="4" col="6">
|
||||
<field name="account_id" colspan="2" widget='selection'/>
|
||||
<field name="chart_account_id" colspan="2" widget='selection'/>
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="filter"/>
|
||||
</group>
|
||||
|
|
|
@ -34,16 +34,19 @@ class account_report_general_ledger(osv.osv_memory):
|
|||
'landscape': fields.boolean("Landscape Mode"),
|
||||
'soldeinit': fields.boolean("Include initial balances"),
|
||||
'amount_currency': fields.boolean("With Currency"),
|
||||
#'state': fields.selection([('bydate','By Date'), ('byperiod','By Period'), ('all','By Date and Period'), ('none','No Filter')],"Date/Period Filter"),
|
||||
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort By'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'display_account' : 'bal_all',
|
||||
'landscape': True,
|
||||
'amount_currency' : True,
|
||||
'sortby': 'sort_date',
|
||||
}
|
||||
|
||||
def _print_report(self, cr, uid, ids, context=None):
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context=None):
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_account', 'landscape', 'soldeinit', 'amount_currency', 'sortby'])[0])
|
||||
data['form']['query_get'] = query_line
|
||||
if data['form']['landscape'] == True:
|
||||
return { 'type': 'ir.actions.report.xml', 'report_name': 'account.general.ledger_landscape', 'datas': data, 'nodestroy':True, }
|
||||
else:
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<field name="landscape"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="sortby"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue