Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4 Odpovědi
4586 Zobrazení

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šit
Autor

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

Autor Nejlepší odpověď

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šit
Nejlepší odpověď

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šit
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 Odpovědi Zobrazení Aktivita
1
úno 22
5171
3
lis 19
9563
0
srp 20
2431
0
pro 19
2872
2
čvn 24
1551