diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index c04da9dec65..fc4d350ea36 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -17,12 +17,12 @@ - - - + + + - + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[formatLang(sum_debit_account(o)) ]] - [[formatLang(sum_credit_account(o)) ]] - [[formatLang(sum_balance_account(o)) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and sum_currency_amount_account(o) +o.currency_id.code or '' ]] + [[ formatLang(sum_debit_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 ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] @@ -292,9 +292,9 @@ [[ line['move'] ]] [[ line['lname'] ]] [[ strip_name(line['line_corresp'].replace(', ',','),40) ]] - [[ formatLang(line['debit']) ]] - [[ formatLang(line['credit']) ]] - [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] + [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] + [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] [[ formatLang(line['amount_currency'] or '')]] [[ line['currency_code'] or '' ]] @@ -327,9 +327,9 @@ [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[formatLang(sum_debit_account(o)) ]] - [[formatLang(sum_credit_account(o)) ]] - [[formatLang(sum_balance_account(o)) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_debit_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 ]] @@ -352,9 +352,9 @@ [[ line['move'] ]] [[ line['lname'] ]] [[ strip_name(line['line_corresp'],15) ]] - [[ formatLang(line['debit']) ]] - [[ formatLang(line['credit']) ]] - [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['debit'], dp='Account') ]] + [[ formatLang(line['credit'], dp='Account') ]] + [[ formatLang(line['progress'], dp='Account') ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 5a240619594..6ce8813fabb 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -58,7 +58,9 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): def set_context(self, objects, data, ids, report_type=None): obj_move = self.pool.get('account.move.line') self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {})) - self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) + ctx2 = data['form'].get('used_context',{}).copy() + ctx2.update({'initial_bal': True}) + self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2) self.reconcil = data['form'].get('reconcil', True) self.initial_balance = data['form'].get('initial_balance', True) self.result_selection = data['form'].get('result_selection', 'customer') diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index 37bb5297cb1..f6d4ec3d88e 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -137,17 +137,17 @@ - - - + - + Account Entry diff --git a/addons/account_budget/__init__.py b/addons/account_budget/__init__.py index 4eea62cb2d8..56a00fb9ba4 100644 --- a/addons/account_budget/__init__.py +++ b/addons/account_budget/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,11 +15,11 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## -import crossovered_budget +import account_budget import report import wizard diff --git a/addons/account_budget/__openerp__.py b/addons/account_budget/__openerp__.py index b023e7e1124..dfe1640a290 100644 --- a/addons/account_budget/__openerp__.py +++ b/addons/account_budget/__openerp__.py @@ -50,16 +50,16 @@ Three reports are available: 'security/ir.model.access.csv', 'security/account_budget_security.xml', 'wizard/account_budget_spread_view.xml', - 'crossovered_budget_view.xml', - 'crossovered_budget_report.xml', - 'crossovered_budget_workflow.xml', + 'account_budget_view.xml', + 'account_budget_report.xml', + 'account_budget_workflow.xml', 'wizard/account_budget_analytic_view.xml', 'wizard/account_budget_report_view.xml', 'wizard/account_budget_spread_view.xml', 'wizard/account_budget_crossovered_summary_report_view.xml', 'wizard/account_budget_crossovered_report_view.xml', ], - 'demo_xml': ['crossovered_budget_demo.xml'], + 'demo_xml': ['account_budget_demo.xml'], 'test':[ 'test/account_budget.yml', 'test/account_budget_report.yml', diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/account_budget.py similarity index 95% rename from addons/account_budget/crossovered_budget.py rename to addons/account_budget/account_budget.py index af67b669d34..99c90badf60 100644 --- a/addons/account_budget/crossovered_budget.py +++ b/addons/account_budget/account_budget.py @@ -24,6 +24,8 @@ import datetime from osv import osv, fields from tools.translate import _ +import decimal_precision as dp + def strToDate(dt): dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10])) return dt_date @@ -241,10 +243,10 @@ class crossovered_budget_lines(osv.osv): 'date_from': fields.date('Start Date', required=True), 'date_to': fields.date('End Date', required=True), 'paid_date': fields.date('Paid Date'), - 'planned_amount': fields.float('Planned Amount', required=True, digits=(16,2)), - 'practical_amount': fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)), - 'theoritical_amount': fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)), - 'percentage': fields.function(_perc, method=True, string='Percentage', type='float'), + 'planned_amount':fields.float('Planned Amount', required=True, digits_compute=dp.get_precision('Account')), + 'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits_compute=dp.get_precision('Account')), + 'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits_compute=dp.get_precision('Account')), + 'percentage':fields.function(_perc, method=True, string='Percentage', type='float'), 'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } @@ -259,4 +261,4 @@ class account_analytic_account(osv.osv): account_analytic_account() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_budget/crossovered_budget_demo.xml b/addons/account_budget/account_budget_demo.xml similarity index 100% rename from addons/account_budget/crossovered_budget_demo.xml rename to addons/account_budget/account_budget_demo.xml diff --git a/addons/account_budget/crossovered_budget_report.xml b/addons/account_budget/account_budget_report.xml similarity index 100% rename from addons/account_budget/crossovered_budget_report.xml rename to addons/account_budget/account_budget_report.xml diff --git a/addons/account_budget/crossovered_budget_view.xml b/addons/account_budget/account_budget_view.xml similarity index 100% rename from addons/account_budget/crossovered_budget_view.xml rename to addons/account_budget/account_budget_view.xml diff --git a/addons/account_budget/crossovered_budget_workflow.xml b/addons/account_budget/account_budget_workflow.xml similarity index 100% rename from addons/account_budget/crossovered_budget_workflow.xml rename to addons/account_budget/account_budget_workflow.xml diff --git a/addons/account_budget/report/crossovered_budget_report.rml b/addons/account_budget/report/crossovered_budget_report.rml index 9ef3dc716af..e297c8b3ca2 100644 --- a/addons/account_budget/report/crossovered_budget_report.rml +++ b/addons/account_budget/report/crossovered_budget_report.rml @@ -148,16 +148,16 @@ [['.....' *(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') ]] [[ '%.2f' % a['theo'] ]] [[ 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')) ]] [[ company.currency_id.symbol ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ '%.2f' % a['pln'] ]] [[ 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')) ]] [[ company.currency_id.symbol ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ '%.2f' % a['prac'] ]] [[ 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')) ]] [[ company.currency_id.symbol ]] - [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ '%.2f' % a['perc'] ]]% + [[ (a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]] [[ formatLang(a['perc'], digits=2) ]]% @@ -168,16 +168,16 @@ [[ repeatIn(funct_total(data['form']),'b') ]]Total: - [[ formatLang(b['tot_theo']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_theo'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ formatLang(b['tot_pln']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_pln'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ formatLang(b['tot_prac']) ]] [[ company.currency_id.symbol ]] + [[ formatLang(b['tot_prac'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ '%.2f' % b['tot_perc'] ]]% + [[ formatLang(b['tot_perc'], digits=2) ]]% @@ -185,4 +185,4 @@ - \ No newline at end of file + diff --git a/addons/decimal_precision/decimal_precision.py b/addons/decimal_precision/decimal_precision.py index 4077a019ee2..1986eb8c441 100644 --- a/addons/decimal_precision/decimal_precision.py +++ b/addons/decimal_precision/decimal_precision.py @@ -46,11 +46,11 @@ class decimal_precision(osv.osv): def write(self, cr, uid, ids, data, *args, **argv): res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv) - for obj in self.pool.obj_list(): - for colname,col in self.pool.get(obj)._columns.items(): - if isinstance(col, fields.float): - col.digits_change(cr) self.precision_get.clear_cache(cr.dbname) + for obj in self.pool.obj_list(): + for colname, col in self.pool.get(obj)._columns.items(): + if isinstance(col, (fields.float, fields.function)): + col.digits_change(cr) return res decimal_precision() @@ -62,4 +62,3 @@ def get_precision(application): return (16, res) return change_digit - diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 67aae0f1b91..615b5cee009 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -283,7 +283,7 @@ mrp.routing.search mrp.routing - tree + search diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml index 3f44ef2afb3..a4eab5aa86d 100644 --- a/addons/sale/report/sale_order.rml +++ b/addons/sale/report/sale_order.rml @@ -312,7 +312,7 @@ Net Total : - [[ formatLang(o.amount_untaxed ) ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]] @@ -325,7 +325,7 @@ Taxes : - [[ formatLang(o.amount_tax ) ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]] @@ -338,7 +338,7 @@ Total : - [[ formatLang(o.amount_total ) ]] [[ o.pricelist_id.currency_id. symbol ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]] @@ -361,4 +361,4 @@ - \ No newline at end of file + diff --git a/addons/sale_layout/report/report_sale_layout.py b/addons/sale_layout/report/report_sale_layout.py index 20ad66313a2..3e61a6cd3e9 100755 --- a/addons/sale_layout/report/report_sale_layout.py +++ b/addons/sale_layout/report/report_sale_layout.py @@ -1,5 +1,5 @@ ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -14,21 +14,22 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## import time -import pooler from report import report_sxw rml_parents = { - 'tr':1, - 'li':1, + 'tr': 1, + 'li': 1, 'story': 0, 'section': 0 } + + class sale_order_1(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(sale_order_1, self).__init__(cr, uid, name, context) @@ -39,98 +40,94 @@ class sale_order_1(report_sxw.rml_parse): }) self.context = context -# + def sale_order_lines(self, sale_order): + result = [] + sub_total = {} + info = [] + order_lines = [] + res = {} - def sale_order_lines(self,sale_order): - result =[] - sub_total={} - info=[] - order_lines=[] - res={} - list_in_seq=[] ids = self.pool.get('sale.order.line').search(self.cr, self.uid, [('order_id', '=', sale_order.id)]) - for id in range(0,len(ids)): - order = self.pool.get('sale.order.line').browse(self.cr, self.uid,ids[id], self.context.copy()) + for id in range(0, len(ids)): + order = self.pool.get('sale.order.line').browse(self.cr, self.uid, ids[id], self.context.copy()) order_lines.append(order) - - i=1 - j=0 - sum_flag={} - sum_flag[j]=-1 + + i = 1 + j = 0 + sum_flag = {} + sum_flag[j] = -1 for entry in order_lines: - res={} + res = {} - if entry.layout_type=='article': - res['tax_id']=', '.join(map(lambda x: x.name, entry.tax_id)) or '' - res['name']=entry.name - res['product_uom_qty']="%.2f"%(entry.product_uos and entry.product_uos_qty or entry.product_uom_qty or 0.00) - res['product_uom']=entry.product_uos and entry.product_uos.name or entry.product_uom.name - res['price_unit']="%.2f"%(entry.price_unit or 0.00) - res['discount']="%.2f"%(entry.discount and entry.discount or 0.00) - res['price_subtotal']="%.2f"%(entry.price_subtotal and entry.price_subtotal or 0.00) - sub_total[i]= entry.price_subtotal and entry.price_subtotal - i=i+1 - res['note']=entry.notes or '' - res['currency']=sale_order.pricelist_id.currency_id.name - res['layout_type']=entry.layout_type - + if entry.layout_type == 'article': + res['tax_id'] = ', '.join(map(lambda x: x.name, entry.tax_id)) or '' + res['name'] = entry.name + res['product_uom_qty'] = entry.product_uos and entry.product_uos_qty or entry.product_uom_qty or 0.00 + res['product_uom'] = entry.product_uos and entry.product_uos.name or entry.product_uom.name + res['price_unit'] = entry.price_unit or 0.00 + res['discount'] = entry.discount and entry.discount or 0.00 + res['price_subtotal'] = entry.price_subtotal and entry.price_subtotal or 0.00 + sub_total[i] = entry.price_subtotal and entry.price_subtotal + i = i + 1 + res['note'] = entry.notes or '' + res['currency'] = sale_order.pricelist_id.currency_id.name + res['layout_type'] = entry.layout_type else: + res['product_uom_qty'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_id'] = '' + res['layout_type'] = entry.layout_type + res['note'] = entry.notes or '' + res['product_uom'] = '' - res['product_uom_qty']='' - res['price_unit']='' - res['discount']='' - res['tax_id']='' - res['layout_type']=entry.layout_type - res['note']=entry.notes or '' - res['product_uom']='' - - if entry.layout_type=='subtotal': - res['name']=entry.name - sum=0 - sum_id=0 - if sum_flag[j]==-1: - temp=1 + if entry.layout_type == 'subtotal': + res['name'] = entry.name + sum = 0 + sum_id = 0 + if sum_flag[j] == -1: + temp = 1 else: - temp=sum_flag[j] + temp = sum_flag[j] - for sum_id in range(temp,len(sub_total)+1): - sum+=sub_total[sum_id] - sum_flag[j+1]= sum_id +1 + for sum_id in range(temp, len(sub_total)+1): + sum += sub_total[sum_id] + sum_flag[j+1] = sum_id +1 - j=j+1 - res['price_subtotal']="%.2f"%(sum) - res['currency']=sale_order.pricelist_id.currency_id.name - res['quantity']='' - res['price_unit']='' - res['discount']='' - res['tax_id']='' - res['product_uom']='' - elif entry.layout_type=='title': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.layout_type=='text': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.layout_type=='line': - res['product_uom_qty']='__________' - res['price_unit']='______________' - res['discount']='___________' - res['tax_id']='_________________' - res['product_uom']='_____' - res['name']='_______________________________________' - res['price_subtotal']='_________' - res['currency']='_______' - elif entry.layout_type=='break': - res['layout_type']=entry.layout_type - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' + j = j + 1 + res['price_subtotal'] = sum + res['currency'] = sale_order.pricelist_id.currency_id.name + res['quantity'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_id'] = '' + res['product_uom'] = '' + elif entry.layout_type == 'title': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.layout_type == 'text': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.layout_type == 'line': + res['product_uom_qty'] = '__________' + res['price_unit'] = '______________' + res['discount'] = '___________' + res['tax_id'] = '_________________' + res['product_uom'] = '_____' + res['name'] = '_______________________________________' + res['price_subtotal'] = '_________' + res['currency'] = '_______' + elif entry.layout_type == 'break': + res['layout_type'] = entry.layout_type + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' else: - res['name']=entry.name - res['price_subtotal']='' - res['currency']=sale_order.pricelist_id.currency_id.name + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = sale_order.pricelist_id.currency_id.name result.append(res) return result diff --git a/addons/sale_layout/report/report_sale_layout.rml b/addons/sale_layout/report/report_sale_layout.rml index d33d424a8a2..b01affd5329 100755 --- a/addons/sale_layout/report/report_sale_layout.rml +++ b/addons/sale_layout/report/report_sale_layout.rml @@ -318,13 +318,13 @@ [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ a['product_uom'] ]] - [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]] [[ a['price_unit'] ]] + [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]] [[ formatLang(a['price_unit'], digits=get_digits(dp='Sale Price')) ]] - [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ a['discount'] ]] + [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['discount'], digits=get_digits(dp='Sale Price')) ]] - [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ a['price_subtotal'] ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ a['layout_type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ formatLang(a['price_subtotal'], digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id.symbol ]] @@ -397,7 +397,7 @@ Taxes : - [[ formatLang(o.amount_tax ) ]] [[ o.pricelist_id.currency_id.symbol ]] + [[ formatLang(o.amount_tax, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id.symbol ]]