diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 891d9ec92b3..b904aba298f 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -155,12 +155,12 @@ class general_ledger(report_sxw.rml_parse, common_report_header): # Then select all account_move_line of this account if self.sortby == 'sort_journal_partner': - sql_sort='j.code, p.name' + sql_sort='j.code, p.name, l.move_id' else: - sql_sort='l.date' + sql_sort='l.date, l.move_id' sql = """ SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, - m.name AS move_name, m.id AS mmove_id, + m.name AS move_name, m.id AS mmove_id,per.code as period_code, c.symbol AS currency_code, i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number, p.name AS partner_name @@ -169,6 +169,7 @@ class general_ledger(report_sxw.rml_parse, common_report_header): LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) + LEFT JOIN account_period per on (per.id=l.period_id) JOIN account_journal j on (l.journal_id=j.id) WHERE %s AND m.state IN %s AND l.account_id = %%s ORDER by %s """ %(self.query, tuple(move_state), sql_sort) @@ -179,7 +180,7 @@ class general_ledger(report_sxw.rml_parse, common_report_header): #FIXME: replace the label of lname with a string translatable sql = """ SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, - '' AS move_name, '' AS mmove_id, + '' AS move_name, '' AS mmove_id, '' AS period_code, '' AS currency_code, NULL AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, @@ -196,15 +197,12 @@ class general_ledger(report_sxw.rml_parse, common_report_header): res_init = self.cr.dictfetchall() res = res_init + res_lines account_sum = 0.0 - inv_types = { 'out_invoice': 'CI', 'in_invoice': 'SI', 'out_refund': 'OR', 'in_refund': 'SR', } for l in res: - l['move'] = l['move_name'] - if l['invoice_id']: - l['lref'] = '%s: %s'%(inv_types[l['invoice_type']], l['invoice_number']) + l['move'] = l['move_name'] != '/' and l['move_name'] or ('*'+str(l['mmove_id'])) l['partner'] = l['partner_name'] or '' account_sum += l['debit'] - l['credit'] l['progress'] = account_sum - l['line_corresp'] = l['mmove_id'] == '' and ' ' or counterpart_accounts[l['mmove_id']] + l['line_corresp'] = l['mmove_id'] == '' and ' ' or counterpart_accounts[l['mmove_id']].replace(', ',',') # Modification of amount Currency if l['credit'] > 0: if l['amount_currency'] != None: diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index fcf635e3a5c..56624256300 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -176,6 +176,7 @@ + @@ -196,6 +197,7 @@ + @@ -210,6 +212,7 @@ + @@ -229,6 +232,7 @@ + @@ -247,52 +251,54 @@ - - + + - - + + - - + + - + - + - [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] - + [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] Date - JNRL + Period + + + JRNL Partner - Ref + Ref - Move + Move Entry Label - Counterpart + Counterpart Debit @@ -307,29 +313,32 @@ Currency - - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Date - JNRL + Period + + + JRNL Partner - Ref + Ref - Move + Move Entry Label - Counterpart + Counterpart Debit @@ -343,9 +352,9 @@ - [[ repeatIn(objects, 'a') ]] + [[ repeatIn(objects, 'a') ]] General Ledger - + @@ -377,19 +386,19 @@ - [[ get_account(data) or removeParentNode('para') ]] + [[ get_account(data) or removeParentNode('para') ]] - [[ get_fiscalyear(data) or '' ]] + [[ get_fiscalyear(data) or '' ]] - [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] + [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] - [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] + [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] @@ -403,10 +412,10 @@ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] - [[ formatLang(get_start_date(data),date=True) ]] + [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] + [[ formatLang(get_end_date(data),date=True) ]] @@ -423,47 +432,50 @@ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] - [[ get_start_period(data) or removeParentNode('para') ]] + [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] + [[ get_end_period(data) or removeParentNode('para') ]] - [[ get_sortby(data) ]] + [[ get_sortby(data) ]] - [[ get_target_move(data) ]] + [[ get_target_move(data) ]] - + - [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] + [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] Date - JNRL + Period + + + JRNL Partner - Ref + Ref - Move + Move Entry Label - Counterpart + Counterpart Debit @@ -480,89 +492,95 @@
- [[ repeatIn(get_children_accounts(a), 'o') ]] - [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] + [[ repeatIn(get_children_accounts(a), 'o') ]] + [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] - [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] + [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] + [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]
- [[ repeatIn(lines(o), 'line') ]] - [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] + [[ repeatIn(lines(o), 'line') ]] + [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] - [[ formatLang(line['ldate'],date=True) ]] + [[ formatLang(line['ldate'],date=True) ]] - [[ line['lcode'] ]] + [[ line['period_code'] ]] - [[ line['partner_name'] ]] + [[ line['lcode'] ]] - [[ line['lref'] ]] + [[ strip_name(line['partner_name'],21) ]] - [[ line['move'] ]] + [[ strip_name(line['lref'],17) ]] - [[ line['lname'] ]] + [[ line['move'] ]] - [[ strip_name(line['line_corresp'].replace(', ',','),20) ]] + [[ strip_name(line['lname'],26) ]] - [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] + [[ strip_name(line['line_corresp'],18) ]] - [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] + [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + + + [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]
- [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Date - JNRL + Period + + + JRNL Partner - Ref + Ref - Move + Move Entry Label - Counterpart + Counterpart Debit @@ -577,55 +595,58 @@
[[ repeatIn(get_children_accounts(a), 'o') ]] - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] + [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] + [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]
[[ repeatIn(lines(o), 'line') ]] - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - [[ formatLang(line['ldate'],date=True) ]] + [[ formatLang(line['ldate'],date=True) ]] - [[ line['lcode'] ]] + [[ line['period_code'] ]] - [[ line['partner_name'] ]] + [[ line['lcode'] ]] - [[ line['lref'] ]] + [[ strip_name(line['partner_name'],25) ]] - [[ line['move'] ]] + [[ strip_name(line['lref'],21) ]] - [[ line['lname'] ]] + [[ line['move'] ]] - [[ strip_name(line['line_corresp'].replace(', ',','),20) ]] + [[ strip_name(line['lname'],35) ]] - [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] + [[ strip_name(line['line_corresp'],23) ]] - [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] + [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] + + + [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] @@ -633,4 +654,4 @@
- \ No newline at end of file +