This question has been flagged
1 Reply
2674 Views

I have got an issue with a customization of the address row.

The following modification is running in an installed module, it basically swaps the two address blocks (Address and DeliveryAddress+FinancalAddress) so the regular address is on the left instead of right.

 <odoo>
  <data>
    <template id="address_layout" inherit_id="web.address_layout">
      <!-- Move main address to the left -->
      <xpath expr="//div[hasclass('address', 'row')]/div[1]" position="after">
        <xpath expr="//div[hasclass('address', 'row')]/t[1]" position="move" />
      </xpath>
    </template>
  </data>
</odoo>

What is does is change (https://github.com/odoo/odoo/blob/13.0/addons/web/views/report_templates.xml) from this:

<div class="address row">
<t t-if="information_block">
<t t-set="colclass" t-value="'col-5 offset-1'"/>
<div name="information_block" class="col-6">
<t t-raw="information_block"/>
</div>
</t>
<div name="address" t-att-class="colclass">
<t t-raw="address"/>
</div>
</div>

to this:

<div class="address row">
<div name="address" t-att-class="colclass">
<t t-raw="address"/>
</div>
<t t-if="information_block">
<t t-set="colclass" t-value="'col-5 offset-1'"/>
<div name="information_block" class="col-6">
<t t-raw="information_block"/>
</div>
</t>
</div>


After that the HTML generation is fine (https://odoo.local/report/html/sale.report_saleorder/3)

But in the the generated PDF the financial/delivery addresses are missing (https://odoo.local/my/orders/3?access_token=.......&report_type=pdf)

Any idea how to get this right?

Avatar
Discard
Author Best Answer

Now after some break I tried to solve it again. I would guess that the

<t t-set="colclass" t-value="'col-5 offset-1'"/>

within the

 <t t-if="information_block">

 maybe might cause that.


But anyways, I now use the following customization and it works & looks fine for me

<odoo>
<data>
<template id="address_layout" inherit_id="web.address_layout">
<xpath expr="//t[@t-set='colclass']" position="replace">
<t t-set="colclass" t-value="('col-md-5' if report_type == 'html' else 'col-5') + ' mr-auto mb-5'"/>
</xpath>
<xpath expr="//div[hasclass('address', 'row')]" position="replace">
<div class="address row">
<t t-if="information_block">
<t t-set="colclass" t-value="'col-5'"/>
</t>
<div name="address" t-att-class="colclass">
<t t-raw="address"/>
</div>
<t t-if="information_block">
<div name="information_block" class="col-5 offset-2">
<t t-raw="information_block"/>
</div>
</t>
</div>
</xpath>
</template>
</data>
</odoo>
Avatar
Discard