This question has been flagged
3 Replies
3994 Views

Greeting,

 I create two menu with difference domain for filtering, I have 2 type of document, 

- Payment Voucher - will select 'supplier' only for receiver

- Receive Voucher - will select 'customer' only as sender


how can I achieve this in same view.? I has field 'doctype' to separate between 'payment_voucher' and 'receive_voucher', but got stuck on how to customize "same" view with difference filter


Thank you in advanced,


Avatar
Discard
Best Answer

Do you want to visible/invisible some fields according to that filter? If yes then you can use attrs. Base on condition you can invisible/readonly some fields in same view.

You can add domain on condition base like :-   <field name="partner_id" domain="[('customer','=', doctype == 'payment_voucher' and True or False)]"/>
Make sure you added "doctype" field invisible in form.



 

Avatar
Discard
Best Answer

Hello, 

see the example at menu invoicing/accounting, find the menu "payments". here is the example as per your requirement. from  the customers payment menu, in field partner you can see only partner where customer checkbox is checked and from suppliers payment menu, in the field partner you can see only partner which has supplier checkbox is checked.

Avatar
Discard
Author Best Answer

Hi Yogesh,

  Thank you for your recommendation, below is more specific detail for my requirement. I have 2 menu's action as below

(1) after click this menu, I would like to show customer list in form with field => <field name="partner_id" domain="[('customer','=','True')]"

<act_window id="action_payment_voucher" name="Payment Voucher" res_model="xpayment.xpayment" view_mode="tree,form" domain="[('doctype','=','payment_voucher')]" />

(2) after click this menu, I would like to show supplier list in form with field =><field name="partner_id" domain="[('customer','=','False')]"

<act_window id="action_receive_voucher" name="Receive Voucher" res_model="xpayment.xpayment" view_mode="tree,form" domain="[('doctype','=','receive_voucher')]" />

so any recommendation on this ?

Avatar
Discard

You can add domain on condition base like :- <field name="partner_id" domain="[('customer','=', doctype == 'payment_voucher' and True or False)]"/>

Make sure you added "doctype" field invisible in form.