Browse Source

[FIX] formatting, rml fixes

pull/2/head
Guewen Baconnier @ Camptocamp 12 years ago
parent
commit
55c3fdb474
  1. 6
      analytic_hours_block/hours_block.py
  2. 10
      analytic_hours_block/hours_block_menu.xml
  3. 2
      analytic_hours_block/report/hours_block.py
  4. 32
      analytic_hours_block/report/hours_block.rml

6
analytic_hours_block/hours_block.py

@ -86,8 +86,8 @@ class AccountHoursBlock(orm.Model):
aal_obj = self.pool.get('account.analytic.line') aal_obj = self.pool.get('account.analytic.line')
pricelist_obj = self.pool.get('product.pricelist') pricelist_obj = self.pool.get('product.pricelist')
for block in self.browse(cr, uid, ids, context=context): 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 # Compute amount bought
for line in block.invoice_id.invoice_line: for line in block.invoice_id.invoice_line:
@ -269,7 +269,7 @@ class AccountHoursBlock(orm.Model):
string="Total", string="Total",
store=True, store=True,
readonly=True), readonly=True),
'state':fields.related(
'state': fields.related(
'invoice_id','state', 'invoice_id','state',
type='selection', type='selection',
selection=[ selection=[

10
analytic_hours_block/hours_block_menu.xml

@ -2,13 +2,11 @@
<openerp> <openerp>
<data> <data>
#---------------------------------------------------------------------------------------------------------
# Hours block menu
#---------------------------------------------------------------------------------------------------------
<!--
Hours block menu
-->
<record model="ir.actions.act_window" id="action_all_block_hour"> <record model="ir.actions.act_window" id="action_all_block_hour">
<field name="name">Hours Block</field>
<field name="name">Hours Blocks</field>
<field name="res_model">account.hours.block</field> <field name="res_model">account.hours.block</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>

2
analytic_hours_block/report/hours_block.py

@ -21,6 +21,7 @@
import time import time
from openerp.report import report_sxw from openerp.report import report_sxw
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class account_hours_block(report_sxw.rml_parse): 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) super(account_hours_block, self).__init__(cr, uid, name, context=context)
self.localcontext.update({ self.localcontext.update({
'time': time, 'time': time,
'date_format': DEFAULT_SERVER_DATE_FORMAT,
'analytic_lines': self._get_analytic_lines, 'analytic_lines': self._get_analytic_lines,
}) })
self.context = context self.context = context

32
analytic_hours_block/report/hours_block.rml

@ -10,7 +10,7 @@
<drawString x="17.7cm" y="28.1cm">Maintenance And Support Summary</drawString> <drawString x="17.7cm" y="28.1cm">Maintenance And Support Summary</drawString>
<setFont name="Helvetica" size="9"/> <setFont name="Helvetica" size="9"/>
<drawString x="1.0cm" y="2cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
<drawString x="1.0cm" y="2cm"> [[ formatLang(time.strftime(date_format), date=True) ]]</drawString>
<drawString x="17.7cm" y="2cm">Page <pageNumber/></drawString> <drawString x="17.7cm" y="2cm">Page <pageNumber/></drawString>
<lineMode width="0.7"/> <lineMode width="0.7"/>
@ -165,7 +165,7 @@
<blockTable colWidths="258.0,259.0" style="Table1" repeatRows="1"> <blockTable colWidths="258.0,259.0" style="Table1" repeatRows="1">
<tr> <tr>
<td> <td>
<para style="P12a">Description :</para>
<para style="P12a">Description: </para>
</td> </td>
<td> <td>
<para style="P2">[[ o.name ]]</para> <para style="P2">[[ o.name ]]</para>
@ -173,15 +173,15 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<para style="P12a">Report Date : </para>
<para style="P12a">Report Date: </para>
</td> </td>
<td> <td>
<para style="P2">[[ time.strftime("%d.%m.%Y", time.localtime()) ]]</para>
<para style="P2">[[ formatLang(time.strftime(date_format), date=True) ]]</para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<para style="P12a">Invoice Date : </para>
<para style="P12a">Invoice Date: </para>
</td> </td>
<td> <td>
<para style="P2">[[ o.date_invoice and formatLang(o.date_invoice, date=True) or '' ]]</para> <para style="P2">[[ o.date_invoice and formatLang(o.date_invoice, date=True) or '' ]]</para>
@ -189,8 +189,8 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<para style="P12a">Amount bought : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Quantity of hours bought : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Amount bought: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Quantity of hours bought: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
</td> </td>
<td> <td>
<para style="P2">[[ o.amount_hours_block ]]</para> <para style="P2">[[ o.amount_hours_block ]]</para>
@ -198,9 +198,8 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<!-- <para style="P12a">[[ o.type == 'hours' and "Quantity of hours" or "Amount"]] used : </para> -->
<para style="P12a">Amount used : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Quantity of hours used : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Amount used: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Quantity of hours used: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
</td> </td>
<td> <td>
<para style="P2">[[ round(o.amount_hours_block_done, 2) ]]</para> <para style="P2">[[ round(o.amount_hours_block_done, 2) ]]</para>
@ -208,9 +207,8 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<!-- <para style="P12a">Remaining [[ o.type == 'hours' and "hours" or "amount"]] : </para> -->
<para style="P12a">Remaining amount : [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Remaining hours : [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Remaining amount: [[ (o.type == 'amount' or removeParentNode('para')) and '' ]]</para>
<para style="P12a">Remaining hours: [[ (o.type == 'hours' or removeParentNode('para')) and '' ]]</para>
</td> </td>
<td> <td>
@ -241,21 +239,21 @@
</tr> </tr>
<tr> <tr>
[[ repeatIn(analytic_lines(o),'l') ]]
[[ repeatIn(analytic_lines(o), 'l') ]]
<td> <td>
<para style="P2">[[ l.date and formatLang(l.date, date=True) or '' ]]</para>
<para style="P2">[[ l.date if formatLang(l.date, date=True) else '' ]]</para>
</td> </td>
<td> <td>
<para style="P2">[[ l.name or '' ]]</para> <para style="P2">[[ l.name or '' ]]</para>
</td> </td>
<td> <td>
<para style="P2c">[[ round(l.unit_amount or '0.0', 2) ]]</para>
<para style="P2c">[[ round(l.unit_amount, 2) or '0.0' ]]</para>
</td> </td>
<td> <td>
<para style="P2c">[[ l.to_invoice.customer_name ]]</para> <para style="P2c">[[ l.to_invoice.customer_name ]]</para>
</td> </td>
<td> <td>
<para style="P2c">[[ round((l.unit_amount and l.to_invoice) and (l.unit_amount - (l.unit_amount * l.to_invoice.factor) / 100 ) or '0.0', 2) ]]</para>
<para style="P2c">[[ round((l.unit_amount and l.to_invoice) and (l.unit_amount - (l.unit_amount * l.to_invoice.factor) / 100 ), 2) or '0.0' ]]</para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>

Loading…
Cancel
Save