Skip to Content
Menu
This question has been flagged
4 Replies
3858 Views

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
Discard
Author

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

Author 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
Discard
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
Discard
Author

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 Views Activity
1
Feb 22
4418
3
Nov 19
8124
0
Aug 20
2431
0
Dec 19
2235
2
Jun 24
618