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.

0

Understanding address for partner_id in QWeb reports

By
E.M.
on 10/17/15, 1:57 PM 1,842 views

Hi,

Could someone help me to understand the following sentence for QWeb reports? I see what it does, I just do not understand how it works. What is widget, what is contact, what is fields, what is name, what is no_marger. And why that &quot?


<address t-field="o.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}">

Thanks for sharing

1

Axel Mendoza

--Axel Mendoza--
10308
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/17/15, 7:45 PM

Hi @E.M

When you define the attribute t-field on a html node, not available for ("table", "tbody", "thead", "tfoot", "tr", "td", "li", "ul", "ol", "dl", "dt", "dd", "t"), you are saying that your t-field expression result could be modified by the values of t-field-options attribute that let you specify a number a dict items depending of every case but most important ones is the widget item that let you change the default field widget in qweb to render the field result, in your case the widget contact is assigned to the class openerp.addons.base.ir.ir_qweb.Contact that is the model 'ir.qweb.field.contact'. When you define the widget in the t-field-options dict string you are saying: Search for a model with the name prefixed with 'ir.qweb.field.' plus the t-field-options key widget value and use it to render the result of the t-field expression. In the case of the widget contact the implementation of the method record_to_html use the fields key to render the template 'contact' and in that template the 'no_marker' key is used.

That's the use of those t-field-options keys. The attribute t-field-options is a bag, a dict string that gets evaluated and passed to the default widget for the field type or for the widget option value and used to change the default render way of the field. In the case of the contact widget it operate over many2one values like o.partner_id you define it

Thanks Axel, and where is actually defined the "contact" widget? I understood that it is ir.qweb.field.contact, but how can you check what it actually does?

E.M.
on 10/19/15, 5:22 PM

The contact template is located at:
/openerp/addons/base/ir/ir_qweb.xml

Axel Mendoza
on 10/19/15, 5:29 PM

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

3 follower(s)

Stats

Asked: 10/17/15, 1:57 PM
Seen: 1842 times
Last updated: 6/9/16, 6:32 AM