Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4 Replies
4569 Tampilan

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
Buang
Penulis

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

Penulis Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Penulis

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>

Post Terkait Replies Tampilan Aktivitas
1
Feb 22
5155
3
Nov 19
9537
0
Agu 20
2431
0
Des 19
2858
2
Jun 24
1536