From 7d7ae4b0fea22b16a140c0c83e8f54dd7ce07623 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 25 Jul 2011 14:14:16 +0530 Subject: [PATCH 01/26] [FIX] Invoice company change (Multi-company) lp bug: https://launchpad.net/bugs/812843 fixed bzr revid: ara@tinyerp.com-20110725084416-ct30t2i2s2feze0k --- openerp/addons/base/ir/ir.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir.xml b/openerp/addons/base/ir/ir.xml index 1280ad5f5e7..ea3103f9b9a 100644 --- a/openerp/addons/base/ir/ir.xml +++ b/openerp/addons/base/ir/ir.xml @@ -1748,7 +1748,7 @@ Property multi-company - ['|',('company_id','=',user.company_id.id),('company_id','=',False)] + ['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)] From b9c10b045cf1406a4f65d9060ce4c52295f8ff18 Mon Sep 17 00:00:00 2001 From: "Dhara (OpenERP)" <> Date: Mon, 12 Sep 2011 21:38:09 -0700 Subject: [PATCH 02/26] [IMP] currency position for report bzr revid: dhara_openerp-20110913043809-2gq0chqs4m0yq1nq --- openerp/addons/base/res/res_currency.py | 7 ++++--- openerp/addons/base/res/res_currency_view.xml | 1 + openerp/report/report_sxw.py | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py index 3b7e427a923..271c7dd68c0 100644 --- a/openerp/addons/base/res/res_currency.py +++ b/openerp/addons/base/res/res_currency.py @@ -62,12 +62,13 @@ class res_currency(osv.osv): 'active': fields.boolean('Active'), 'company_id':fields.many2one('res.company', 'Company'), 'date': fields.date('Date'), - 'base': fields.boolean('Base') - + 'base': fields.boolean('Base'), + 'position_on_report': fields.selection([('after','After Amount'),('before','Before Amount')], 'Symbol position in reports', help="Determines where the currency symbol is printed within reports, after or before the amount.") } _defaults = { 'active': lambda *a: 1, - 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c) + 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c), + 'position_on_report' : 'after', } _order = "name" diff --git a/openerp/addons/base/res/res_currency_view.xml b/openerp/addons/base/res/res_currency_view.xml index 8d747c882b1..efd9f8043bb 100644 --- a/openerp/addons/base/res/res_currency_view.xml +++ b/openerp/addons/base/res/res_currency_view.xml @@ -42,6 +42,7 @@ + diff --git a/openerp/report/report_sxw.py b/openerp/report/report_sxw.py index 210a54760c4..81d83026543 100644 --- a/openerp/report/report_sxw.py +++ b/openerp/report/report_sxw.py @@ -264,7 +264,7 @@ class rml_parse(object): d = obj._field.digits[1] or DEFAULT_DIGITS return d - def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False): + def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False): """ Assuming 'Account' decimal.precision=3: formatLang(value) -> digits=2 (default) @@ -302,7 +302,9 @@ class rml_parse(object): date = datetime(*value.timetuple()[:6]) return date.strftime(date_format) - return self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) + res = self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) + res = currency_obj and currency_obj.position_on_report and (currency_obj.position_on_report == 'after' and '%s %s'%(res,currency_obj.symbol) or '%s %s'%(currency_obj.symbol, res) ) or res + return res def repeatIn(self, lst, name,nodes_parent=False): ret_lst = [] From 51d48726073de3f65a2a46574446a4573cbc56aa Mon Sep 17 00:00:00 2001 From: "Dhara (OpenERP)" <> Date: Mon, 12 Sep 2011 21:39:47 -0700 Subject: [PATCH 03/26] [IMP] currency position for report bzr revid: dhara_openerp-20110913043947-u7h84s12f6iel79y --- .../report/account_aged_partner_balance.rml | 42 +++++++++---------- addons/account/report/account_balance.rml | 2 +- .../account/report/account_balance_sheet.rml | 12 +++--- .../account_balance_sheet_horizontal.rml | 8 ++-- .../report/account_central_journal.rml | 8 ++-- .../report/account_general_journal.rml | 12 +++--- .../account/report/account_general_ledger.rml | 10 ++--- .../account_general_ledger_landscape.rml | 10 ++--- addons/account/report/account_journal.rml | 18 ++++---- .../report/account_partner_balance.rml | 8 ++-- .../account/report/account_partner_ledger.rml | 12 +++--- .../report/account_partner_ledger_other.rml | 12 +++--- .../account/report/account_print_invoice.rml | 12 +++--- .../account/report/account_print_overdue.rml | 10 ++--- .../report/account_profit_horizontal.rml | 12 +++--- addons/account/report/account_profit_loss.rml | 16 +++---- addons/account/report/account_tax_code.rml | 6 +-- addons/account/report/account_tax_report.rml | 2 +- .../report/crossovered_analytic.rml | 4 +- .../report/analytic_account_budget_report.rml | 14 +++---- .../account_budget/report/budget_report.rml | 12 +++--- .../report/crossovered_budget_report.rml | 12 +++--- addons/purchase/report/order.rml | 8 ++-- addons/sale/report/sale_order.rml | 8 ++-- 24 files changed, 135 insertions(+), 135 deletions(-) diff --git a/addons/account/report/account_aged_partner_balance.rml b/addons/account/report/account_aged_partner_balance.rml index c76aba31763..3f2a05b7652 100644 --- a/addons/account/report/account_aged_partner_balance.rml +++ b/addons/account/report/account_aged_partner_balance.rml @@ -196,25 +196,25 @@ Account Total - [[ formatLang(get_direction('6')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_direction('6'), currency_obj=company.currency_id) ]] - [[ formatLang(get_for_period('4')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_for_period('4'), currency_obj=company.currency_id) ]] - [[ formatLang(get_for_period('3')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_for_period('3'), currency_obj=company.currency_id) ]] - [[ formatLang(get_for_period('2')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_for_period('2'), currency_obj=company.currency_id) ]] - [[ formatLang(get_for_period('1')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_for_period('1'), currency_obj=company.currency_id) ]] - [[ formatLang(get_for_period('0')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_for_period('0'), currency_obj=company.currency_id) ]] - [[ formatLang(get_total('5')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_total('5'), currency_obj=company.currency_id) ]] @@ -224,25 +224,25 @@ [[ partner['name'] ]] - [[ formatLang(partner['direction']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['direction'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['4'])]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['4'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['3'])]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['3'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['2']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['2'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['1']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['1'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['0']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['0'], currency_obj=company.currency_id) ]] - [[ formatLang(partner['total']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(partner['total'], currency_obj=company.currency_id) ]] @@ -251,25 +251,25 @@ [[ not_partner['name'] ]] - [[ formatLang(not_partner['direction']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['direction'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['4'])]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['4'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['3'])]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['3'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['2']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['2'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['1']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['1'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['0']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['0'], currency_obj=company.currency_id) ]] - [[ formatLang(not_partner['total']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(not_partner['total'], currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 3d971862bdc..491740b4673 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -296,7 +296,7 @@ [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ '..'*(a['level']-1) ]][[ a['name'] ]] [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['debit']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[formatLang(a['debit']) ]] [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font')]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['credit']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['credit']) ]] - [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['balance']) ]] [[ company.currency_id.symbol ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['balance']) ]] [[ company.currency_id.symbol ]] + [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['balance'], currency_obj=company.currency_id) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['balance'], currency = company.currency_id) ]] diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml index 205bfff497b..d72376c4f1a 100644 --- a/addons/account/report/account_balance_sheet.rml +++ b/addons/account/report/account_balance_sheet.rml @@ -240,8 +240,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]] [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] - [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] - [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] + [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency = company.currency_id) ]] + [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance'], currency = company.currency_id) ]] @@ -250,7 +250,7 @@ Balance: - [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_cr(), currency = company.currency_id) ]] @@ -282,8 +282,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]] [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] - [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] - [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] + [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency = company.currency_id) ]] + [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance'], currency = company.currency_id) ]] @@ -292,7 +292,7 @@ Balance: - [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_dr(), currency = company.currency_id) ]] diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml index 7e4f9f844a5..8f902352498 100644 --- a/addons/account/report/account_balance_sheet_horizontal.rml +++ b/addons/account/report/account_balance_sheet_horizontal.rml @@ -202,7 +202,7 @@ [[ '. '*(a['level1']-1) ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name1'] ]] - [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance1']) ]] [[ company.currency_id.symbol ]] + [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance1'], currency_obj=company.currency_id) ]] [[ repeatIn(get_lines(), 'a') ]] [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['code'] ]][[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Bold_9'}) or removeParentNode('font') ]] @@ -213,7 +213,7 @@ [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]] [[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Right_9_Bold'}) or removeParentNode('font') ]] - [[(a['code'] and a['name']) and formatLang(a['balance']) or removeParentNode('font')]] [[ company.currency_id.symbol ]] + [[(a['code'] and a['name']) and formatLang(a['balance'], currency_obj=company.currency_id) or removeParentNode('font')]] @@ -223,13 +223,13 @@ Balance: - [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_cr(), currency_obj=company.currency_id) ) ]] Balance: - [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_dr(), currency_obj=company.currency_id) ) ]] diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 33566083652..2233ddb3f2e 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -299,7 +299,7 @@ [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id) ) ]] [[ company.currency_id.symbol ]] + [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id ) ]] [[ display_currency(data) or removeParentNode('blockTable') ]] @@ -308,7 +308,7 @@ [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id) ) ]] [[ company.currency_id.symbol ]] + [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id ) ]] @@ -320,7 +320,7 @@ [[ line['name'] ]] [[ formatLang(line['debit']) ]] [[ formatLang(line['credit'])]] - [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) ]] [[ display_currency(data) or removeParentNode('blockTable') ]] @@ -329,7 +329,7 @@ [[ line['name'] ]] [[ formatLang(line['debit']) ]] [[ formatLang(line['credit'])]] - [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) ]] [[ (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_journal.rml b/addons/account/report/account_general_journal.rml index f4cc13069c8..0af13022a07 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -273,7 +273,7 @@ [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] - [[ formatLang( sum_debit()- sum_credit()) ]] [[ company.currency_id.symbol ]] + [[ formatLang( sum_debit()- sum_credit(), currency_obj=company.currency_id) ]] [[ display_currency(data) or removeParentNode('blockTable') ]] @@ -290,7 +290,7 @@ [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] - [[ formatLang( sum_credit()- sum_debit()) ]] [[ company.currency_id.symbol ]] + [[ formatLang( sum_credit()- sum_debit(), currency_obj=company.currency_id) ]] @@ -311,7 +311,7 @@ [[ formatLang(sum_credit_period(o.id)) ]] - [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id)) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id), currency_obj=company.currency_id) ]] @@ -337,7 +337,7 @@ [[ formatLang(sum_credit_period(o.id)) ]] - [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id)) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id), currency_obj=company.currency_id) ]] @@ -358,7 +358,7 @@ [[ formatLang(line['credit']) ]] - [[ formatLang(line['credit']-line['debit'] ) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) ]] @@ -371,7 +371,7 @@ [[ line['name'] ]] [[ formatLang(line['debit'] )]] [[ formatLang(line['credit']) ]] - [[ formatLang(line['credit']-line['debit'] ) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) ]] [[ (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.rml b/addons/account/report/account_general_ledger.rml index 15614444822..de62baed742 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -476,10 +476,10 @@ [[ 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'),currency_obj=company.currency_id) ]] - [[ 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'),currency_obj=o.currency_id) or '' ]] @@ -515,7 +515,7 @@ [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['progress'], digits=get_digits(dp='Account'),currency_obj=company.currency_id) ]] [[ (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 '']] @@ -572,7 +572,7 @@ [[ 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'),currency_obj=company.currency_id) ]] @@ -608,7 +608,7 @@ [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['progress'], digits=get_digits(dp='Account'),currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index ac100c3ecd0..ad5aef790d8 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -505,10 +505,10 @@ [[ 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'), currency = company.currency_id) ]] - [[ 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'),currency_obj=o.currency_id) or '' ]] @@ -547,7 +547,7 @@ [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['progress'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] [[ (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 '']] @@ -607,7 +607,7 @@ [[ 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'), currency_obj=company.currency_id) ]] @@ -646,7 +646,7 @@ [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['progress'], digits=get_digits(dp='Account'),currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 9b0ac55bb56..9d305bae36b 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -247,8 +247,8 @@ - [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ company.currency_id.symbol ]] - [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] @@ -258,8 +258,8 @@ [[ line.account_id.code ]] [[ line.partner_id and strip_name(line.partner_id.name,17) ]] [[ strip_name(line.name,27) ]] - [[ formatLang(line.debit) ]] [[ company.currency_id.symbol ]] - [[ formatLang(line.credit) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] @@ -282,8 +282,8 @@ - [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ company.currency_id.symbol ]] - [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] @@ -295,9 +295,9 @@ [[ line.account_id.code ]] [[ line.partner_id and strip_name(line.partner_id.name,15) ]] [[ strip_name(line.name,17) ]] - [[ formatLang(line.debit) ]] [[ company.currency_id.symbol ]] - [[ formatLang(line.credit) ]] [[ company.currency_id.symbol ]] - [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + [[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]] diff --git a/addons/account/report/account_partner_balance.rml b/addons/account/report/account_partner_balance.rml index 6425d6a4db6..7052c2efb8f 100644 --- a/addons/account/report/account_partner_balance.rml +++ b/addons/account/report/account_partner_balance.rml @@ -241,16 +241,16 @@ [[ formatLang(sum_debit()) ]] [[ formatLang(sum_credit()) ]] - [[ formatLang((sum_debit()-sum_credit())) ]] [[ company.currency_id.symbol ]] - [[ formatLang(sum_litige()) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit()-sum_credit()), currency_obj=company.currency_id) ]] + [[ formatLang(sum_litige(), currency_obj=company.currency_id) ]] [[ repeatIn(lines(), 'a') ]][[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ a['ref'] ]] [[ a['type']==3 and a['code'] ]] [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ a['name'] ]] [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['debit']) ]] [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['credit']) ]] - [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance']) ]] [[ company.currency_id.symbol ]] - [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['enlitige'] or 0.0) ]] [[ company.currency_id.symbol ]] + [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance'], currency_obj=company.currency_id) ]] + [[ (a['type']==3 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['enlitige'] or 0.0, currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index c1ef9b22502..1b423ad1e99 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -477,7 +477,7 @@ [[ formatLang((sum_credit_partner(p))) ]] - [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) ]] @@ -497,7 +497,7 @@ [[ formatLang(get_intial_balance(p)[0][1]) ]] - [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) ]] @@ -528,7 +528,7 @@ [[ formatLang((line['credit'])) ]] - [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] + [[ formatLang((line['progress']), currency_obj=company.currency_id) ]] @@ -581,7 +581,7 @@ [[ formatLang((sum_credit_partner(p))) ]] - [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) ]] @@ -604,7 +604,7 @@ [[ formatLang(get_intial_balance(p)[0][1]) ]] - [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) ]] @@ -640,7 +640,7 @@ [[ formatLang((line['credit'])) ]] - [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] + [[ formatLang((line['progress']), currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 2f58fc8ec95..97ba9b554d9 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -482,7 +482,7 @@ [[ formatLang((sum_credit_partner(p))) ]] - [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) ]] @@ -502,7 +502,7 @@ [[ formatLang(get_intial_balance(p)[0][1]) ]] - [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) ]] @@ -533,7 +533,7 @@ [[ formatLang((line['credit'])) ]] - [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] + [[ formatLang((line['progress']), currency_obj=company.currency_id) ]] @@ -590,7 +590,7 @@ [[ formatLang((sum_credit_partner(p))) ]] - [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) ]] @@ -613,7 +613,7 @@ [[ formatLang(get_intial_balance(p)[0][1]) ]] - [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] + [[ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) ]] @@ -649,7 +649,7 @@ [[ formatLang((line['credit'])) ]] - [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] + [[ formatLang((line['progress']), currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_print_invoice.rml b/addons/account/report/account_print_invoice.rml index 0350fbf7379..db8f752a56d 100644 --- a/addons/account/report/account_print_invoice.rml +++ b/addons/account/report/account_print_invoice.rml @@ -263,7 +263,7 @@ [[ formatLang(l.discount, dp='Account') ]] - [[ formatLang(l.price_subtotal, dp='Account') ]] [[ o.currency_id.symbol ]] + [[ formatLang(l.price_subtotal, dp='Account', currency_obj=o.currency_id) ]] @@ -309,7 +309,7 @@ Net Total: - [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]] @@ -322,7 +322,7 @@ Taxes: - [[ formatLang(o.amount_tax, dp='Account') ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_tax, dp='Account', currency_obj=o.currency_id) ]] @@ -335,7 +335,7 @@ Total: - [[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]] @@ -368,10 +368,10 @@ [[ t.name ]] - [[ formatLang(t.base, dp='Account') ]] [[ o.currency_id.symbol ]] + [[ formatLang(t.base, dp='Account', currency_obj=o.currency_id) ]] - [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] + [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]] diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 0797d544f9b..25ccad25377 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -219,7 +219,7 @@ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] - [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] + [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and formatLang(line['debit'] - line['credit'], currency_obj=company.currency_id) ] [[ line['blocked'] and 'X' or '' ]] @@ -244,7 +244,7 @@ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]] - [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)), currency_obj=company.currency_id) ]] @@ -264,7 +264,7 @@ Balance : - [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]] @@ -279,10 +279,10 @@ - Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]]. + Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]]. - \ No newline at end of file + diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml index 6c70bb47310..7737fc8769c 100644 --- a/addons/account/report/account_profit_horizontal.rml +++ b/addons/account/report/account_profit_horizontal.rml @@ -221,7 +221,7 @@ - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance'])) ]] [[ company.currency_id.symbol ]] + [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance']), currency_obj=company.currency_id) ]] @@ -234,7 +234,7 @@ - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code1'] and a['name1']) and formatLang(abs(a['balance1'])) or removeParentNode('font') ]] [[ company.currency_id.symbol ]] + [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code1'] and a['name1']) and formatLang(abs(a['balance1']), currency_obj=company.currency_id) or removeParentNode('font') ]] @@ -247,7 +247,7 @@ [[ final_result()['type'] == 'Net Profit' and final_result()['type'] or '' ]] - [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance'])) ]] [[ company.currency_id.symbol ]] + [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]] @@ -256,7 +256,7 @@ [[ final_result()['type'] == 'Net Loss' and final_result()['type'] or '' ]] - [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(abs(final_result()['balance'])) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and company.currency_id.symbol ]] + [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]] @@ -267,13 +267,13 @@ Total: - [[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]] + [[ formatLang(abs(sum_dr()), currency_obj=company.currency_id) ]] Total: - [[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]] + [[ formatLang(abs(sum_cr()), currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml index 2b29f479478..4fc2d73c3d6 100644 --- a/addons/account/report/account_profit_loss.rml +++ b/addons/account/report/account_profit_loss.rml @@ -228,8 +228,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] + [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance, currency_obj=company.currency_id) ]] + [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance, currency_obj=company.currency_id) ]] @@ -241,7 +241,7 @@ [[ final_result()['type'] == 'Net Profit' and final_result()['type'] or removeParentNode('blockTable') ]] - [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(final_result()['balance']) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and company.currency_id.symbol ]] + [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]] @@ -251,7 +251,7 @@ Total: - [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_dr(), currency_obj=company.currency_id) ]] @@ -277,8 +277,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] + [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance, currency_obj=company.currency_id) ]] + [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance, currency_obj=company.currency_id) ]] @@ -290,7 +290,7 @@ [[ final_result()['type'] == 'Net Loss' and final_result()['type'] or removeParentNode('blockTable') ]] - [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(final_result()['balance']) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and company.currency_id.symbol ]] + [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]] @@ -300,7 +300,7 @@ Total: - [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_cr(), currency_obj=company.currency_id) ]] diff --git a/addons/account/report/account_tax_code.rml b/addons/account/report/account_tax_code.rml index 7489ac72a39..10a7c76a821 100644 --- a/addons/account/report/account_tax_code.rml +++ b/addons/account/report/account_tax_code.rml @@ -129,10 +129,10 @@ [[ line['name'] ]] - [[ formatLang(line['debit']) ]] [[ company.currency_id.symbol]] + [[ formatLang(line['debit'], currency_obj=company.currency_id) ]] - [[ formatLang(line['credit']) ]] [[ company.currency_id.symbol]] + [[ formatLang(line['credit'], currency_obj=company.currency_id) ]] @@ -141,4 +141,4 @@ - \ No newline at end of file + diff --git a/addons/account/report/account_tax_report.rml b/addons/account/report/account_tax_report.rml index de4aa415fef..f489ee1143e 100644 --- a/addons/account/report/account_tax_report.rml +++ b/addons/account/report/account_tax_report.rml @@ -153,7 +153,7 @@ [[ repeatIn(get_lines(data['form']['based_on'], data['form']['company_id']), 'o') ]][[ (o['level']) ]] [[ (len(o['level'])<5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ o['code'] ]] [[ o['name'] ]] [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]] [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['credit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]] - [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]] + [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]] diff --git a/addons/account_analytic_plans/report/crossovered_analytic.rml b/addons/account_analytic_plans/report/crossovered_analytic.rml index 6e331ed1b83..f374aa5a2c2 100644 --- a/addons/account_analytic_plans/report/crossovered_analytic.rml +++ b/addons/account_analytic_plans/report/crossovered_analytic.rml @@ -240,7 +240,7 @@ [[ formatLang(a['ref_qty']) ]] - [[ formatLang(a['ref_amt']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(a['ref_amt'], currency_obj=company.currency_id) ]] 100.00% @@ -288,7 +288,7 @@ [[formatLang(a['qty']) ]] - [[ formatLang(a['amt']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(a['amt'], currency_obj=company.currency_id) ]] [[ formatLang(a['perc']) ]]% diff --git a/addons/account_budget/report/analytic_account_budget_report.rml b/addons/account_budget/report/analytic_account_budget_report.rml index a8b957f52a5..ba89c7ed1ea 100644 --- a/addons/account_budget/report/analytic_account_budget_report.rml +++ b/addons/account_budget/report/analytic_account_budget_report.rml @@ -185,13 +185,13 @@ [['.....' *(a['status']-1) ]] [[ (a['status']==1 and (setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ a['name'] ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo']) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo'], currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln']) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln'], currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac']) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac'], currency_obj=company.currency_id) ]] [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['perc']) ]]% @@ -205,13 +205,13 @@ [[ repeatIn(funct_total(data['form']),'b') ]] Total: - [[ formatLang(b['tot_theo']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_theo'], currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_pln']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_pln'], currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_prac']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_prac'], currency_obj=company.currency_id) ]] [[ formatLang(b['tot_perc']) ]]% @@ -223,4 +223,4 @@ - \ No newline at end of file + diff --git a/addons/account_budget/report/budget_report.rml b/addons/account_budget/report/budget_report.rml index 0533042822a..4d82e8d8c1d 100644 --- a/addons/account_budget/report/budget_report.rml +++ b/addons/account_budget/report/budget_report.rml @@ -148,13 +148,13 @@ [['.....' *(a['status']-1) ]][[ (a['status']==1 and (setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ a['name'] ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['perc'], digits=2) ]]% @@ -168,13 +168,13 @@ [[ repeatIn(funct_total(data['form']),'b') ]]Total: - [[ formatLang(b['tot_theo'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_pln'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_prac'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) ]] [[ formatLang(b['tot_perc'], digits=2) ]]% diff --git a/addons/account_budget/report/crossovered_budget_report.rml b/addons/account_budget/report/crossovered_budget_report.rml index 63db53ab5ce..b4e8e963b7d 100644 --- a/addons/account_budget/report/crossovered_budget_report.rml +++ b/addons/account_budget/report/crossovered_budget_report.rml @@ -163,13 +163,13 @@ [['.....' *(a['status']-1) ]][[ (a['status']==1 and (setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ a['name'] ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['theo'], dp='Account', currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['pln'], dp='Account', currency_obj=company.currency_id) ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['prac'], dp='Account', currency_obj=company.currency_id) ]] [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['perc'],digits=2) ]]% @@ -183,13 +183,13 @@ [[ repeatIn(funct_total(data['form']),'b') ]] Total : - [[ formatLang(b['tot_theo'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_theo'], dp='Account', currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_pln'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_pln'], dp='Account', currency_obj=company.currency_id) ]] - [[ formatLang(b['tot_prac'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_prac'], dp='Account', currency_obj=company.currency_id) ]] [[ formatLang(b['tot_perc'],digits=2) ]]% diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 4b143d0f961..188f969e07c 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -293,7 +293,7 @@ [[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]] - [[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]] @@ -339,7 +339,7 @@ Net Total : - [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]] @@ -352,7 +352,7 @@ Taxes : - [[ formatLang(o.amount_tax, dp='Purchase Price') ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_tax, dp='Purchase Price', currency_obj=o.pricelist_id.currency_id) ]] @@ -365,7 +365,7 @@ Total : - [[ formatLang(o.amount_total, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Purchase Price') , currency_obj=o.pricelist_id.currency_id) ]] diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml index 00ebb50472e..a6902f79047 100644 --- a/addons/sale/report/sale_order.rml +++ b/addons/sale/report/sale_order.rml @@ -283,7 +283,7 @@ [[ formatLang(line.discount) ]] - [[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'), currency_obj=o.pricelist_id.currency_id) ]] @@ -329,7 +329,7 @@ Net Total : - [[ formatLang(o.amount_untaxed, dp='Sale Price') ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] @@ -342,7 +342,7 @@ Taxes : - [[ formatLang(o.amount_tax, dp='Sale Price') ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(o.amount_tax, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] @@ -355,7 +355,7 @@ Total : - [[ formatLang(o.amount_total, dp='Sale Price') ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(o.amount_total, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] From eb1fc58eb88fee927f7f5b5b421a5f776e13d517 Mon Sep 17 00:00:00 2001 From: "Dhara (OpenERP)" <> Date: Tue, 20 Sep 2011 18:35:11 -0700 Subject: [PATCH 04/26] Balance sign field for accouting report bzr revid: dhara_openerp-20110921013511-05czzq3ggdv9197f --- addons/account/account.py | 2 +- addons/account/account_view.xml | 1 + addons/account/report/account_balance_sheet.py | 2 +- .../account/report/account_financial_report.py | 2 +- addons/account/report/account_profit_loss.py | 16 ++++++++++++---- addons/account/report/account_profit_loss.rml | 8 ++++---- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 61e1fb021a9..a3748e8a167 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -139,7 +139,7 @@ class account_account_type(osv.osv): 'Balance' will generally be used for cash accounts. 'Detail' will copy each existing journal item of the previous year, even the reconciled ones. 'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""), - 'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'), + 'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'), 'report_type':fields.selection([ ('none','/'), ('income','Profit & Loss (Income Accounts)'), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 1055a4a164a..c6e1c58557d 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -749,6 +749,7 @@ + diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index b1e51e6fc46..ce9e3c51f06 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -136,7 +136,7 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header) 'code': account.code, 'name': account.name, 'level': account.level, - 'balance':account.balance, + 'balance': account.balance != 0 and account.balance * account.user_type.sign or account.balance, 'type': account.type, } currency = account.currency_id and account.currency_id or account.company_id.currency_id diff --git a/addons/account/report/account_financial_report.py b/addons/account/report/account_financial_report.py index 6b0ada74708..87b7fab7b8d 100644 --- a/addons/account/report/account_financial_report.py +++ b/addons/account/report/account_financial_report.py @@ -70,7 +70,7 @@ class report_account_common(report_sxw.rml_parse, common_report_header): flag = False vals = { 'name': account.code + ' ' + account.name, - 'balance': account.balance, + 'balance': account.balance != 0 and account.balance * account.user_type.sign or account.balance, 'type': 'account', 'level': 6, 'account_type': account.type, diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 4c8896ee630..27182cdbd21 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -141,11 +141,15 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): 'code': cal_list['expense'][i].code, 'name': cal_list['expense'][i].name, 'level': cal_list['expense'][i].level, - 'balance':cal_list['expense'][i].balance, + 'balance': cal_list['expense'][i].balance != 0 and \ + cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign or \ + cal_list['expense'][i].balance, 'code1': cal_list['income'][i].code, 'name1': cal_list['income'][i].name, 'level1': cal_list['income'][i].level, - 'balance1':cal_list['income'][i].balance, + 'balance1': cal_list['income'][i].balance != 0 and \ + cal_list['income'][i].balance * cal_list['income'][i].user_type.sign or \ + cal_list['income'][i].balance, } self.result_temp.append(temp) else: @@ -158,7 +162,9 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): 'code1': cal_list['income'][i].code, 'name1': cal_list['income'][i].name, 'level1': cal_list['income'][i].level, - 'balance1':cal_list['income'][i].balance, + 'balance1': cal_list['income'][i].balance != 0 and \ + cal_list['income'][i].balance * cal_list['income'][i].user_type.sign \ + or cal_list['income'][i].balance, } self.result_temp.append(temp) if i < len(cal_list['expense']): @@ -166,7 +172,9 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): 'code': cal_list['expense'][i].code, 'name': cal_list['expense'][i].name, 'level': cal_list['expense'][i].level, - 'balance':cal_list['expense'][i].balance, + 'balance': cal_list['expense'][i].balance != 0 and \ + cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign \ + or cal_list['expense'][i].balance, 'code1': '', 'name1': '', 'level1': False, diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml index f0c549e7412..0679e65f4ba 100644 --- a/addons/account/report/account_profit_loss.rml +++ b/addons/account/report/account_profit_loss.rml @@ -228,8 +228,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] + [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]] + [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]] @@ -277,8 +277,8 @@ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] + [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]] + [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]] From cdef8d8f8f4142c5eacfd912675b28d7ddb532c5 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 21 Sep 2011 09:45:09 +0200 Subject: [PATCH 05/26] [FIX] correctly handle 'false' domain on listview dataset: filter it out bzr revid: xmo@openerp.com-20110921074509-2gkgp3ai4ly1vwdf --- addons/web/static/src/js/view_list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 0a27704b741..eeda44c4c99 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -415,8 +415,8 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# */ do_search: function (domains, contexts, groupbys) { return this.rpc('/web/session/eval_domain_and_context', { - domains: [this.dataset.get_domain()].concat(domains), - contexts: [this.dataset.get_context()].concat(contexts), + domains: _([this.dataset.get_domain()].concat(domains)).compact(), + contexts: _([this.dataset.get_context()].concat(contexts)).compact(), group_by_seq: groupbys }, $.proxy(this, 'do_actual_search')); }, From 7b80bd155c948e2b009f4238aa88fe11d34d69cf Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 21 Sep 2011 10:16:51 +0200 Subject: [PATCH 06/26] [FIX] issues with missing window.console object in Firefox 3.6 when Firebug is not active bzr revid: xmo@openerp.com-20110921081651-a4usbx7flv91xko5 --- addons/web/static/src/js/chrome.js | 2 -- addons/web/static/src/js/core.js | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 8a8962fd27b..fd3ea690245 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -581,7 +581,6 @@ openerp.web.Header = openerp.web.Widget.extend(/** @lends openerp.web.Header# * this._super(parent); this.qs = "?" + jQuery.param.querystring(); this.$content = $(); - console.debug("initializing header with id", this.element_id); this.update_promise = $.Deferred().resolve(); }, start: function() { @@ -963,7 +962,6 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie this.session.start(); this.login.start(); this.menu.start(); - console.debug("The openerp client has been initialized."); }, on_logged: function() { if(this.action_manager) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index a33fca458d0..e26e01e5b29 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -1,7 +1,10 @@ /*--------------------------------------------------------- * OpenERP Web core *--------------------------------------------------------*/ - +var console; +if (!console) { + console = {log: function () {}}; +} if (!console.debug) { console.debug = console.log; } @@ -943,7 +946,6 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg * If that's not the case this method will simply return `false`. */ do_action: function(action, on_finished) { - console.log('Widget.do_action', action, on_finished); if (this.widget_parent) { return this.widget_parent.do_action(action, on_finished); } From 8df96caa72fc55820f85bbd7a2055a36624020ac Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 21 Sep 2011 12:41:36 +0200 Subject: [PATCH 07/26] [imp] refactored datetime components to allow usage in the search view bzr revid: nicolas.vanhoren@openerp.com-20110921104136-pu8yvny228jyi5so --- addons/web/static/src/js/core.js | 5 +- addons/web/static/src/js/view_form.js | 91 ++++++++++++++++++--------- addons/web/static/src/xml/base.xml | 17 ++--- 3 files changed, 76 insertions(+), 37 deletions(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index a33fca458d0..fc4e3b4c2c4 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -771,7 +771,6 @@ openerp.web.SessionAware = openerp.web.CallbackEnabled.extend(/** @lends openerp * // stuff that you want to init before the rendering * }, * start: function() { - * this._super(); * // stuff you want to make after the rendering, `this.$element` holds a correct value * this.$element.find(".my_button").click(/* an example of event binding * /); * @@ -915,6 +914,8 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg * @returns {jQuery.Deferred} */ start: function() { + /* The default implementation is only useful for retro-compatibility, it is + not necessary to call it using _super() when using Widget for new components. */ if (!this.$element) { var tmp = document.getElementById(this.element_id); this.$element = tmp ? $(tmp) : undefined; @@ -922,7 +923,7 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg return $.Deferred().done().promise(); }, /** - * Destroys the current widget, also destory all its children before destroying itself. + * Destroys the current widget, also destroy all its children before destroying itself. */ stop: function() { _.each(_.clone(this.widget_children), function(el) { diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 31779648f3b..e2a83679da7 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1121,16 +1121,13 @@ openerp.web.form.FieldFloat = openerp.web.form.FieldChar.extend({ } }); -openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ - init: function(view, node) { - this._super(view, node); - this.template = "FieldDate"; - this.jqueryui_object = 'datetimepicker'; - }, +openerp.web.DateTimeWidget = openerp.web.Widget.extend({ + template: "web.datetimepicker", + jqueryui_object: 'datetimepicker', + type_of_date: "datetime", start: function() { var self = this; - this._super.apply(this, arguments); - this.$element.find('input').change(this.on_ui_change); + this.$element.find('input').change(this.on_change); this.picker({ onSelect: this.on_picker_select, changeMonth: true, @@ -1158,7 +1155,7 @@ openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ }, set_value: function(value) { value = this.parse(value); - this._super(value); + this.value = value; this.$element.find('input').val(value ? this.format_client(value) : ''); }, get_value: function() { @@ -1167,24 +1164,22 @@ openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ set_value_from_ui: function() { var value = this.$element.find('input').val() || false; this.value = this.parse_client(value); - this._super(); }, - update_dom: function() { - this._super.apply(this, arguments); + set_readonly: function(readonly) { + this.readonly = readonly; this.$element.find('input').attr('disabled', this.readonly); - this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', this.readonly); + this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly); }, - validate: function() { - this.invalid = false; + is_valid: function(required) { var value = this.$element.find('input').val(); if (value === "") { - this.invalid = this.required; + return !required; } else { try { this.parse_client(value); - this.invalid = false; + return true; } catch(e) { - this.invalid = true; + return false; } } }, @@ -1193,24 +1188,64 @@ openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ }, parse: openerp.web.auto_str_to_date, parse_client: function(v) { - return openerp.web.parse_value(v, this.field); + return openerp.web.parse_value(v, {"widget": this.type_of_date}); }, format: function(val) { - return openerp.web.auto_date_to_str(val, this.field.type); + return openerp.web.auto_date_to_str(val, this.type_of_date); }, format_client: function(v) { - return openerp.web.format_value(v, this.field); + return openerp.web.format_value(v, {"widget": this.type_of_date}); + }, + on_change: function() { + if (this.is_valid()) { + this.set_value_from_ui(); + } + } +}); + +openerp.web.DateWidget = openerp.web.DateTimeWidget.extend({ + jqueryui_object: 'datepicker', + type_of_date: "date", + on_picker_select: function(text, instance) { + this._super(text, instance); + this.$element.find('.oe_datepicker').hide(); + } +}); + +openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ + template: "EmptyComponent", + build_widget: function() { + return new openerp.web.DateTimeWidget(this); + }, + start: function() { + var self = this; + this._super.apply(this, arguments); + this.datewidget = this.build_widget(); + this.datewidget.on_change.add(this.on_ui_change); + this.datewidget.appendTo(this.$element); + }, + set_value: function(value) { + this._super(value); + this.datewidget.set_value(value); + }, + get_value: function() { + return this.datewidget.get_value(); + }, + update_dom: function() { + this._super.apply(this, arguments); + this.datewidget.set_readonly(this.readonly); + }, + validate: function() { + this.invalid = !this.datewidget.is_valid(this.required); + }, + focus: function() { + this.datewidget.focus(); } }); openerp.web.form.FieldDate = openerp.web.form.FieldDatetime.extend({ - init: function(view, node) { - this._super(view, node); - this.jqueryui_object = 'datepicker'; - }, - on_picker_select: function(text, instance) { - this._super(text, instance); - this.$element.find('.oe_datepicker').hide(); + build_widget: function() { + return new openerp.web.DateWidget(this); } }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index da5f2e0638e..d2b2f618eec 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -800,13 +800,16 @@ > - - - -