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

How I can change the default value of a field in a form view in openerp7?

아바타
취소
베스트 답변

Hi; The simplest and easiest way , is to go under "Developer mode", and then open the form (you want), open the drop-down menu "Debug view" and choose "Set Defaults", modify the default values as you need.

steps to go under "Developer mode" and change default values (example of "Emplyee form"):

1-- image description

2-- image description

3-- image description

4-- image description

The more complexe way is to find the file where the field you want to change the default value is defined (created) [Probably in a class a_class definition after _columns = {.......} creation in _defaults = {..somewhere...here ..the default value....} statement, as in the example below ( extracted from the code mrp.py file of the mrp module)]:

image description

Hope this can help, and best regards.

아바타
취소

Excelent answer! Thank's for taking your time answering with graphical examples. I'm very grateful for your answer.

If you need to change a lot of defaults (as the defaults set from Developer's Mode is per user), you can check this answer: https://www.odoo.com/forum/help-1/question/how-to-change-default-journal-when-i-create-a-new-customer-invoice-74128#answer_74130

베스트 답변

If you want to change the default value to something that is not listed in the Default dropdown, then you should do the following (it's way faster and there's no need to change the code):

Fill the field with wanted value which you want to set to default and THEN go to the developer mode, Click on Debug View dropdown and select Set Defaults. Now you see you have a NEW (exactly the one you wanted) default value in the dropdown, which you can select.

It can't get any easier than that :)

 

아바타
취소

Dude I know this answer is 6 years old, but you saved my a** and I owe you a beer :)

관련 게시물 답글 화면 활동
0
2월 23
3269
1
3월 15
4599
3
6월 25
790
6
4월 22
43050
0
3월 24
4018