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

Hello,

I have a field called "my_item" in my purchase.order

I want to put a new field in with a domain filter to filter only the records with the id that the "my_item" has.

the other field is a many2many, it can have max 3. = "my_list_ids"

<!-- Filter for my item-->
<record id="purchase_order_filter" model="ir.ui.view">
<field name="name">purchase.order.filter</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<field name="field1" position="replace">
<field name="field1" domain="[('my_item.id', 'in', 'my_list_id.new_item_ids')]"/>
</field>
</field>
</record>

How can I do that?


Thank you 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

please try if new_item_ids is o2n or m2n

>
<field name="field1" domain="[('my_item.id', 'in', my_list_id.new_item_ids.ids)]"/>

อวตาร
ละทิ้ง
ผู้เขียน

not working like this: File "/odoo10/odoo10-server/odoo/osv/expression.py", line 821, in parse

raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))

ValueError: Invalid field u'operating_unit_id' in leaf "<osv.ExtendedLeaf: (u'my_item.id', u'in', u'my_list_id.new_item_ids.ids') on my_list_id (ctx: )>"

remove qoutes

ผู้เขียน

Uncaught Error: AttributeError: object has no attribute 'new_item_ids'

It says there is no field in the specified model. 

On Thursday, December 28, 2017, wizardz <stephane.diez@giordano.ch> wrote:


Uncaught Error: AttributeError: object has no attribute 'new_item_ids'

--
wizardz

ผู้เขียน

the field is in purchase.order.line, not in purchase.order. how can I fix this?

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

Hi,

have you tried setting the domain through the python code ? Based on the value of one field, you can set domain of another field. i.e, in your case, if you can capture the onchange of 'my_item', then based on it's values, you can return the domain for your new field.

อวตาร
ละทิ้ง
ผู้เขียน

the first field comes from purchase.order and the second with the ids from purchase.order.line

ผู้เขียน

the second field is in purchase.order.line. how can I fix this?

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 17
3198
10
ม.ค. 24
15750
ODOO10: Operator Or in View XML แก้ไขแล้ว
4
ต.ค. 17
10254
5
ต.ค. 22
13770
5
ก.ย. 20
12791