Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4831 Lượt xem

Is it possible to search on field.property() fields? I would really like to be able to search by payment terms, but can't figure out the way to do so. I have tried:

<filter string="COD" name="type_cod" domain="[('property_payment_term.name','=','COD')]" help="COD Customers"/> 

and

<filter string="COD" name="type_cod" domain="[('property_payment_term','=','COD')]" help="COD Customers"/> 

as well as

<filter string="COD" name="type_cod" domain="[('property_payment_term','like','COD')]" help="COD Customers"/> 
But none of these seem to be working. The field is defined as such:

        'property_payment_term': fields.property(
'account.payment.term',
type='many2one',
relation='account.payment.term',
string ='Customer Payment Term',
view_load=True,
help="This payment term will be used instead of the default one for sale orders and customer invoices"),

Any idea how to search on this? Thanks!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<filter string="COD" name="type_cod" domain="[('name','=','COD')]" help="COD Customers"/>

Ảnh đại diện
Huỷ bỏ
Tác giả

Ah forgot to specify, I want to perform this search on partner records, to see which partners are using CoD.

property_payment_term is defined in module account file partner.py, this should work, exept perhaps to add company_id in context (should be defined for a property field) context="{'company_id': user_id.company_id.id}"