0

code:

<openerp>
  <data>
    <template id="report_saleorder_insurance_inherit" inherit_id="sale.report_saleorder_document">
      <xpath expr="//div[@class='row']/div[@class='col-xs-4 pull-right']/table/tr[2]" position="after">
        <tr>
          <td>Insurance</td>
          <td class="text-right">
            <span t-field="o.amount_insurance" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
          </td>
        </tr>
      </xpath>
    </template>
  </data>
</openerp>

this code should add an additional row to the sales order costs, but after updating nothing shows. I have added the xml to the __openerp__.py file and restarted the service after that. The module updates without any errors. I am at a loss as to why it is not working. Did I forget something?

The xpath should add a row inside this part of the core xml: (taken from report_saleorder.xml)

<div class="row">
  <div class="col-xs-4 pull-right">
    <table class="table table-condensed">
      <tr class="border-black">
        <td>
          <strong>Total Without Taxes</strong>
        </td>
        <td class="text-right">
          <span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
        </td>
      </tr>
      <tr>
        <td>Taxes</td>
        <td class="text-right">
          <span t-field="o.amount_tax" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
        </td>
      </tr>
      <tr class="border-black">
        <td>
          <strong>Total</strong>
        </td>
        <td class="text-right">
          <span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
        </td>
      </tr>
    </table>
  </div>
</div>
forvas
  • 9,801
  • 7
  • 62
  • 158
ThomasS
  • 705
  • 1
  • 11
  • 30
  • I tried your xpath and it works correctly. Make sure you are updating the module – ChesuCR Jul 30 '15 at 11:02
  • I did update the module (even reinstalled it) and when I check the Technical Data of my module it shows that the view has been created but still for some reason nothing is shown on the sales order page. – ThomasS Jul 30 '15 at 11:28
  • 1
    Try creating a new sale order and print it. Some reports are saved in the database (in the `ir_attachment` table). After the first time that the report is printed, Odoo recovers the report already printed the first time from the database and you cannot see the changes – ChesuCR Jul 30 '15 at 11:46
  • You are welcome! I wrote my comment as an answer. Could you mark it as a correct answer? Thanks! :-) – ChesuCR Jul 31 '15 at 08:33

1 Answers1

0

Try creating a new sale order and print it. Some reports are saved in the database (in the ir_attachment table). After the first time that the report is printed, Odoo recovers the report already printed the first time from the database and you cannot see the changes

ChesuCR
  • 9,352
  • 5
  • 51
  • 114