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

show many2many field in Report

By
voathnak lim
on 9/11/13, 1:30 AM 2,313 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

[[repeatIn(objects,'o')]]
[[ 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
0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


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

Hello,

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

Regards...

0
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>

Thanks.

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

voathnak lim
on 9/11/13, 4:15 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

0 follower(s)

Stats

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