diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 576b62470e6..8eefe75838f 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -94,7 +94,7 @@ - + diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 4d2a417e52e..b904aba298f 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -179,20 +179,14 @@ class general_ledger(report_sxw.rml_parse, common_report_header): if res_lines and self.init_balance: #FIXME: replace the label of lname with a string translatable sql = """ - SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' 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, + 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 period_code, - sum(case when a.currency_id is not null then - l.amount_currency - else - 0.0 - end) as amount_currency, '' AS currency_code, NULL AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, '' AS partner_name FROM account_move_line l LEFT JOIN account_move m on (l.move_id=m.id) - LEFT JOIN account_account a ON (l.account_id=a.id) 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) @@ -215,8 +209,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header): l['amount_currency'] = abs(l['amount_currency']) * -1 if l['amount_currency'] != None: self.tot_currency = self.tot_currency + l['amount_currency'] - self.cr.execute("select distinct currency_id from account_invoice") - l['cur_id']=self.cr.fetchall() return res def _sum_debit_account(self, account): diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index e0359249657..d3da592e085 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -518,7 +518,7 @@ [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + [[ (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 '']] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 6892a1fd4bd..56624256300 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -508,7 +508,7 @@ [[ 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.symbol or '' ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] @@ -550,7 +550,7 @@ [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + [[ (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 '']] diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 554b12aecfc..92d84e05c26 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -37,7 +37,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): # 'sum_debit': self._sum_debit, # 'sum_credit': self._sum_credit, 'get_currency': self._get_currency, - 'sum_currency_amount_account': self._sum_currency_amount_account, 'comma_me': self.comma_me, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, @@ -161,10 +160,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): r['progress'] = sum full_account.append(r) return full_account - - def _get_currency(self): - self.cr.execute("select distinct currency_id from account_invoice") - return self.cr.fetchall() def _get_intial_balance(self, partner): move_state = ['draft','posted'] @@ -395,10 +390,16 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): return 'Receivable and Payable Accounts' return '' - def _sum_currency_amount_account(self, account): - self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s" %(account.id)) + def _sum_currency_amount_account(self, account, form): + self._set_get_account_currency_code(account.id) + self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() - return total[0] or 0.0 + if self.account_currency: + return_field = str(total[0]) + self.account_currency + return return_field + else: + currency_total = self.tot_currency = 0.0 + return currency_total def _display_initial_balance(self, data): if self.initial_balance: diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index b6d4b216bbb..b3dec993cdb 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -470,7 +470,7 @@ [[ display_currency(data) == False or removeParentNode('section') ]] - + [[ p.ref ]] - [[ p.name ]] @@ -484,16 +484,13 @@ [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] - - [[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] -
[[data['form']['initial_balance']==True or removeParentNode('section') ]] - + Initial Balance @@ -507,9 +504,6 @@ [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] - - [[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] -
@@ -659,7 +653,7 @@ - [[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] diff --git a/addons/account/wizard/account_report_account_balance.py b/addons/account/wizard/account_report_account_balance.py index 6b8c4371dd2..1c3743bf3c7 100644 --- a/addons/account/wizard/account_report_account_balance.py +++ b/addons/account/wizard/account_report_account_balance.py @@ -32,17 +32,6 @@ class account_balance_report(osv.osv_memory): 'journal_ids': [], } - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): - mod_obj = self.pool.get('ir.model.data') - res = super(account_balance_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) - doc = etree.XML(res['arch']) - nodes = doc.xpath("//field[@name='journal_ids']") - for node in nodes: - node.set('readonly', '1') - node.set('required', '0') - res['arch'] = etree.tostring(doc) - return res - def _print_report(self, cr, uid, ids, data, context=None): data = self.pre_print_report(cr, uid, ids, data, context=context) return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data} diff --git a/addons/account/wizard/account_report_account_balance_view.xml b/addons/account/wizard/account_report_account_balance_view.xml index 9438a6f9216..38f456f7d15 100644 --- a/addons/account/wizard/account_report_account_balance_view.xml +++ b/addons/account/wizard/account_report_account_balance_view.xml @@ -10,6 +10,9 @@ + + +