Se rendre au contenu
Menu
Cette question a été signalée
4 Réponses
4570 Vues

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
Ignorer
Auteur

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

Auteur Meilleure réponse

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur

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>

Publications associées Réponses Vues Activité
1
févr. 22
5155
3
nov. 19
9537
0
août 20
2431
0
déc. 19
2858
2
juin 24
1536