콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
44798 화면

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

아바타
취소
베스트 답변

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

아바타
취소
베스트 답변

Hi, 

You can watch following video for this:

https://youtu.be/ezH3ql5Dmx4

Thanks

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
9월 19
3894
1
11월 24
4596
1
3월 15
5303
7
3월 25
8286
3
5월 24
4573