Skip to Content
Menu
This question has been flagged
4 Replies
4575 Zobrazenia

Say I want to take the field 'company_id' from product.template model and append it to POS orderline similar to additional note in orderline. 

I want to call 'company_id' directly on the xml file instead of passing it through a js function.

How can I achieve this?

Avatar
Zrušiť
Autor

Can I do anything with "t-att-data-id"?

Autor Best Answer

It was apparently,


<t><t t-esc="line.get_product().company_id"/></t>


It was not working due to some spelling mistakes in manifest file. Thank you for all the help.

Avatar
Zrušiť
Best Answer

You can do this using the view inheritance mechanism in Odoo. View inheritance allows you to customize the functionality of the view without altering the core view xml. In your case, you will need to define a custom view that inherits from the view you are trying to change and add a <field name="<field name>"/> in the appropriate position in the xml.

You will find the following link useful: 

View Inheritance

Avatar
Zrušiť
Autor

That's how we'd normally do it, but I was talking about the case of POS templates, for example,

<?xml version="1.0" encoding="UTF-8"?>

<templates id="point_of_sale.template" xml:space="preserve">

<!--<templates id="template" xml:space="preserve">-->

<t t-extend="Orderline">

<t t-jquery=".info-list" t-operation="append">

<t t-if="line."" WHAT TO DO HERE INSTEAD OF PASSING JS FUNCTION">

<li class="info orderline-brand">

<i class='fa fa-tag' role="img" aria-label="Brand" title="Brand"/>

<t t-esc="line."" WHAT TO DO HERE INSTEAD OF PASSING JS FUNCTION" />

</li>

</t>

</t>

</t>

</templates>

Related Posts Replies Zobrazenia Aktivita
1
feb 22
5158
3
nov 19
9539
0
aug 20
2431
0
dec 19
2859
2
jún 24
1540