Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to customize contact widget in qweb reports?

By
Karthik Arumugam
on 10/28/15, 5:51 AM 2,658 views

Any body please help me to customize contact widget in that is used in t-field options in qweb reports

very general question, please be more specific... what kind of customization? add field? change look?

Temur
on 10/28/15, 7:51 AM
2

Temur

--Temur--
2894
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 10/28/15, 7:52 AM

first step:

you can customize it by inheriting base.contact template in XML, for example here is how to add additional field "my_field" just before address in address widget:

<template id="contact" inherit_id="base.contact">
<xpath expr="//address/div" position="after">
<div t-if="object.my_field and 'my_field' in fields"
class='css_editable_mode_hidden'>
<div itemprop="my_field" t-esc="object.my_field"
style="margin-top:4px;margin-bottom:4px;font-size:10px;"/>
</div>
</xpath>
</template>

second step:

then in your qweb template, add "my_field" to fields list:

... t-field-options='{"widget": "contact", "fields": ["address","my_field","name",...],...

if your template is a new one, you need simply add my_field to "fields" list as shown above, if you extending some existing template, then you can inherit it and replace existing widget entry, using position="replace" property in xpath tag...

Thanks for helping me Temur.

Karthik Arumugam
on 10/29/15, 1:17 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/28/15, 5:51 AM
Seen: 2658 times
Last updated: 10/28/15, 7:59 AM