Odoo Help


show many2many field in Report

Voathnak Lim
on 9/11/13, 1:30 AM 3,570 views

I need the show a list of Language name in model language.language in Report of product.

and here is my many2many field.

'product_marketing_languages_ids' : fields.many2many('languages.languages', 'product_marketing_languages', 'product_id', 'language_id', 'Marketing Languages'),

and this is the model of product_marketing_languages:

class product_marketing_languages(osv.osv):
    _name = 'product.marketing.languages'
    _columns = {
        'product_id' : fields.many2one('product.product', 'Product Marketing'),
        'language_id' : fields.many2one('languages.languages', 'Language', required = True),

I have try this

[[ o.product_marketing_languages_ids,'line' ]]

and it's show : ([browse_record(languages.languages, 145), browse_record(languages.languages, 146)])

and could you tell me how to get the name field in languages.languages using lambda? could anyone help me please?

[[repeatln(objects,'o')]], [[repeatln(o.product_marketing_languages_ids,'line')]], [[line.name]], After all these commands given in your rml report you will get your answer

Abhishek H Menon
on 9/11/13, 9:37 AM
--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 9/11/13, 9:27 AM


As it shows you, it shows a list of browse records from the language.language ...

so it is two steps to achieve the names ....

[[ repeatIn(objects, 'o') ]]
    [[ repeatIn(o.product_marketing_languages_ids,'line') ]]

now the 'line' contains the language.language attributes, so if language.language contains field called [name], you can access it via:

[[ line.name ]]

personal notice:

on m2m relation the OpenERP will automatically create the third table for you... so you don't need to write the product_marketing_languages model by your self, and usually the table name ended with _rel so it could be :

'product_marketing_languages_ids' : fields.many2many('languages.languages', 'product_marketing_languages_rel', 'product_id', 'language_id', 'Marketing Languages'),

I hope this could helps you ...


Ali Ravani
On 9/11/13, 3:52 AM

hello, This are code, i hope it will help you.

<para style="terp_default_Right_9">[[ formatLang(product_marketing_languages_ids.name) ]]</para>


Thank you Ali, but this doesn't show anything.

Voathnak Lim
on 9/11/13, 4:15 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 9/11/13, 1:30 AM
Seen: 3570 times
Last updated: 3/16/15, 8:10 AM