Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
44722 Weergaven

Hello everybody,

I try to get a domain (context maybe) on field when I change a value of an other field.

My case :

I have two fields :

  1. partner_id : m2o (res.partner) type
  2. type : selection(sale or purchase)

On a form view, I want when I set type=sale, the domain=[('customer','=',True)] applied to the field partner_id

My idea is to use onchange action on the field type, but I don't know how

A help please

Avatar
Annuleer
Beste antwoord

Hello Yug Faa,

on_change in OpenERP has 3 possible values returned finally in a dictionary or a {} .

1: The value dictionary i.e {field1:value1,field2:value2}

2: The domain dictionary i.e {field1:domain1}

3: The warning

Syntax:

res = {'value':{},'domain':{},'warning':'Warning Message'}

According to your case add this to the return dictionary.

{'domain':{'partner_id':[('customer','=',True)]}}

Thanks

Avatar
Annuleer
Beste antwoord

Hi, 

You can watch following video for this:

https://youtu.be/ezH3ql5Dmx4

Thanks

Avatar
Annuleer
Beste antwoord

'warning' key permits also a dict as value: {'title': 'Caption title of window:', 'message': 'Text of the message'}

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
sep. 19
3804
1
nov. 24
4537
1
mrt. 15
5261
7
mrt. 25
8125
3
mei 24
4522