Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
5048 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar
Autor Mejor respuesta

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
Descartar

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.

Publicaciones relacionadas Respuestas Vistas Actividad
3
mar 21
5629
4
nov 23
8487
1
mar 15
7595
5
ago 24
46611
1
may 24
2542