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. 40
      analytic_hours_block/report/hours_block.rml
  5. 2
      analytic_hours_block/security/hours_block_security.xml

6
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=[

10
analytic_hours_block/hours_block_menu.xml

@ -2,13 +2,11 @@
<openerp>
<data>
#---------------------------------------------------------------------------------------------------------
# Hours block menu
#---------------------------------------------------------------------------------------------------------
<!--
Hours block menu
-->
<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="view_type">form</field>
<field name="view_mode">tree,form</field>

2
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

40
analytic_hours_block/report/hours_block.rml

@ -10,13 +10,13 @@
<drawString x="17.7cm" y="28.1cm">Maintenance And Support Summary</drawString>
<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>
<lineMode width="0.7"/>
<lines>0.6cm 27.9cm 20.3cm 27.9cm</lines>
<setFont name="Helvetica" size="8"/>
</pageGraphics>
</pageGraphics>
</pageTemplate>
</template>
@ -35,7 +35,7 @@
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
@ -165,7 +165,7 @@
<blockTable colWidths="258.0,259.0" style="Table1" repeatRows="1">
<tr>
<td>
<para style="P12a">Description :</para>
<para style="P12a">Description: </para>
</td>
<td>
<para style="P2">[[ o.name ]]</para>
@ -173,15 +173,15 @@
</tr>
<tr>
<td>
<para style="P12a">Report Date : </para>
<para style="P12a">Report Date: </para>
</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>
</tr>
<tr>
<td>
<para style="P12a">Invoice Date : </para>
<para style="P12a">Invoice Date: </para>
</td>
<td>
<para style="P2">[[ o.date_invoice and formatLang(o.date_invoice, date=True) or '' ]]</para>
@ -189,8 +189,8 @@
</tr>
<tr>
<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>
<para style="P2">[[ o.amount_hours_block ]]</para>
@ -198,9 +198,8 @@
</tr>
<tr>
<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>
<para style="P2">[[ round(o.amount_hours_block_done, 2) ]]</para>
@ -208,10 +207,9 @@
</tr>
<tr>
<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>
<para style="P2">[[ o.amount_hours_block and round(o.amount_hours_block_delta, 2) or '' ]]</para>
@ -239,23 +237,23 @@
<para style="P12a">Deduced</para>
</td>
</tr>
<tr>
[[ repeatIn(analytic_lines(o),'l') ]]
[[ repeatIn(analytic_lines(o), 'l') ]]
<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>
<para style="P2">[[ l.name or '' ]]</para>
</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>
<para style="P2c">[[ l.to_invoice.customer_name ]]</para>
</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>
</tr>
</blockTable>

2
analytic_hours_block/security/hours_block_security.xml

@ -7,5 +7,5 @@
<field eval="True" name="global"/>
<field name="domain_force">[]</field>
</record>
</data></openerp>
Loading…
Cancel
Save