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

How can i browse this m2m record?

By
David Arnold
on 6/24/14, 11:20 AM 713 views

<code>company.partner_id.property_fiscal_attribute[0].attribute_use_id.name</code>

results the name of the attribute_use_id of the first property_fiscal_attribute of the company.partner_id

 

How can I get a [] of the IDs of property_fiscal_attribute where attribute_use_id.name = "foo" ?

<code>

company.partner_id.property_fiscal_attribute.browse()
company.partner_id.property_fiscal_attribute.search()

</code>

result in an error `'record_browse_list' has no attribute 'browse'` - can anyone help out? Thanks

 

Hello to India Thank you for your help! I think this is almost it, as python complains that attribute_use_id is not aglobal variable... How to make python understand that it is bound to the property_fiscal_attribute?

David Arnold
on 6/24/14, 12:35 PM

either you edited, or i din't see it: "x.attribute_use_id.name" :-D Thanks!

David Arnold
on 6/24/14, 12:38 PM
1

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 6/24/14, 12:11 PM

David,

You should do this kind of smart code!

res = [x.id for x in company.partner_id.property_fiscal_attribute if x.attribute_use_id.name == 'foo']

If res has some value, it means there is a record which matches foo, [] otherwise.

This should help.

Thanks.

 

0
David Arnold
On 6/24/14, 12:42 PM

Thank you! Saved my sanity for today ;-)

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: 6/24/14, 11:20 AM
Seen: 713 times
Last updated: 3/16/15, 8:10 AM