Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4435 มุมมอง

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

ผู้เขียน

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

คำตอบที่ดีที่สุด

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.

 

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you! Saved my sanity for today ;-)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
7668
1
มิ.ย. 16
7423
Get first record from another object? แก้ไขแล้ว
1
มี.ค. 15
15005
6
มิ.ย. 17
42291
On_change with self.pool.get and browse แก้ไขแล้ว
1
มิ.ย. 17
6768