From 55c3fdb4743178a989779eb6a246ce968dad15fd Mon Sep 17 00:00:00 2001 From: "Guewen Baconnier @ Camptocamp" Date: Mon, 17 Dec 2012 16:37:44 +0100 Subject: [PATCH] [FIX] formatting, rml fixes --- analytic_hours_block/hours_block.py | 6 +-- analytic_hours_block/hours_block_menu.xml | 10 ++--- analytic_hours_block/report/hours_block.py | 2 + analytic_hours_block/report/hours_block.rml | 40 +++++++++---------- .../security/hours_block_security.xml | 2 +- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/analytic_hours_block/hours_block.py b/analytic_hours_block/hours_block.py index 256c2baf..df3c2476 100644 --- a/analytic_hours_block/hours_block.py +++ b/analytic_hours_block/hours_block.py @@ -86,8 +86,8 @@ class AccountHoursBlock(orm.Model): aal_obj = self.pool.get('account.analytic.line') pricelist_obj = self.pool.get('product.pricelist') for block in self.browse(cr, uid, ids, context=context): - result[block.id] = {'amount_hours_block' : 0.0, - 'amount_hours_block_done' : 0.0} + result[block.id] = {'amount_hours_block': 0.0, + 'amount_hours_block_done': 0.0} # Compute amount bought for line in block.invoice_id.invoice_line: @@ -269,7 +269,7 @@ class AccountHoursBlock(orm.Model): string="Total", store=True, readonly=True), - 'state':fields.related( + 'state': fields.related( 'invoice_id','state', type='selection', selection=[ diff --git a/analytic_hours_block/hours_block_menu.xml b/analytic_hours_block/hours_block_menu.xml index 0dff97be..c4969041 100644 --- a/analytic_hours_block/hours_block_menu.xml +++ b/analytic_hours_block/hours_block_menu.xml @@ -2,13 +2,11 @@ - - #--------------------------------------------------------------------------------------------------------- - # Hours block menu - #--------------------------------------------------------------------------------------------------------- - + - Hours Block + Hours Blocks account.hours.block form tree,form diff --git a/analytic_hours_block/report/hours_block.py b/analytic_hours_block/report/hours_block.py index 906c694b..8807ad51 100644 --- a/analytic_hours_block/report/hours_block.py +++ b/analytic_hours_block/report/hours_block.py @@ -21,6 +21,7 @@ import time from openerp.report import report_sxw +from openerp.tools import DEFAULT_SERVER_DATE_FORMAT class account_hours_block(report_sxw.rml_parse): @@ -28,6 +29,7 @@ class account_hours_block(report_sxw.rml_parse): super(account_hours_block, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, + 'date_format': DEFAULT_SERVER_DATE_FORMAT, 'analytic_lines': self._get_analytic_lines, }) self.context = context diff --git a/analytic_hours_block/report/hours_block.rml b/analytic_hours_block/report/hours_block.rml index 1b66efa9..7f9344e4 100644 --- a/analytic_hours_block/report/hours_block.rml +++ b/analytic_hours_block/report/hours_block.rml @@ -10,13 +10,13 @@ Maintenance And Support Summary - [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]] + [[ formatLang(time.strftime(date_format), date=True) ]] Page 0.6cm 27.9cm 20.3cm 27.9cm - + @@ -35,7 +35,7 @@ - + @@ -165,7 +165,7 @@ - Description : + Description: [[ o.name ]] @@ -173,15 +173,15 @@ - Report Date : + Report Date: - [[ time.strftime("%d.%m.%Y", time.localtime()) ]] + [[ formatLang(time.strftime(date_format), date=True) ]] - Invoice Date : + Invoice Date: [[ o.date_invoice and formatLang(o.date_invoice, date=True) or '' ]] @@ -189,8 +189,8 @@ - Amount bought : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] - Quantity of hours bought : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] + Amount bought: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] + Quantity of hours bought: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] [[ o.amount_hours_block ]] @@ -198,9 +198,8 @@ - - Amount used : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] - Quantity of hours used : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] + Amount used: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] + Quantity of hours used: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] [[ round(o.amount_hours_block_done, 2) ]] @@ -208,10 +207,9 @@ - - Remaining amount : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] - Remaining hours : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] - + Remaining amount: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]] + Remaining hours: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]] + [[ o.amount_hours_block and round(o.amount_hours_block_delta, 2) or '' ]] @@ -239,23 +237,23 @@ Deduced - + - [[ repeatIn(analytic_lines(o),'l') ]] + [[ repeatIn(analytic_lines(o), 'l') ]] - [[ l.date and formatLang(l.date, date=True) or '' ]] + [[ l.date if formatLang(l.date, date=True) else '' ]] [[ l.name or '' ]] - [[ round(l.unit_amount or '0.0', 2) ]] + [[ round(l.unit_amount, 2) or '0.0' ]] [[ l.to_invoice.customer_name ]] - [[ round((l.unit_amount and l.to_invoice) and (l.unit_amount - (l.unit_amount * l.to_invoice.factor) / 100 ) or '0.0', 2) ]] + [[ round((l.unit_amount and l.to_invoice) and (l.unit_amount - (l.unit_amount * l.to_invoice.factor) / 100 ), 2) or '0.0' ]] diff --git a/analytic_hours_block/security/hours_block_security.xml b/analytic_hours_block/security/hours_block_security.xml index 3f9ff31e..81c50c4d 100644 --- a/analytic_hours_block/security/hours_block_security.xml +++ b/analytic_hours_block/security/hours_block_security.xml @@ -7,5 +7,5 @@ [] - +