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

I am new to odoo and python. I am working on a module, I need to hide a button by calling a method from ".xml" file, function definition and body is in ".py" file. Currently am trying to hide button like that

<button confirm="Are you sure you want to start the test?" name="set_to_test_inprogress" states="Invoiced" string="Start Test" type="object" class="oe_highlight"groups="oehealth.group_oeh_medical_physician,oehealth.group_oeh_medical_manager" attrs="{'invisible': [('start_button', '=', False)]}"/>

and "start_button" column is in ".py" file with code like that

def _start_test_button(self, cr, uid, ids, field_name, arg, context):

return False

_columns = {

'start_button': fields.function(_start_test_button, type="boolean", obj="generic.request", method=True),

}

and that python code is in class named "OeHealthLabTests". When create a lab it shows error which is

Uncaught Error: Unknown field start_button in domain [["start_button","=",false],["state","not in",["Invoiced"]]]

Am confused and i didn't find a way yet to make it happen. Please guide me how can i do that.

Thank You

아바타
취소
베스트 답변

Good day. Because the field start_button doesn't exist on the *form* view (even though it does exist in Python and in the database), Odoo will throw that error: "Unkown field start_button..." The solution is to add the field to the form view like so:

<field name="start_button" />

If you don't want anybody to see the field, just add the invisible attribute like so:

<field name="start_button" invisible="1" />

아바타
취소
작성자 베스트 답변

Thank You @Andre. As i mentioned in my previous message that i am totally new to python and odoo, i have 2 more questions.


1. Are there any video tutorials for beginners on odoo development, if yes then please send me link

2. I installed odoo source on my local system using these instructions http://www.mindissoftware.com/2014/09/08/Odoo-PyCharm-Windows-installation/ , and i purchased "oeHealth" odoo module. When i install or upgrade that module it takes too much time (approx 30 minutes), is there any other way to upgrade that module ?

아바타
취소
관련 게시물 답글 화면 활동
0
9월 23
1923
0
9월 23
1611
2
6월 25
11064
6
10월 23
21921
3
3월 24
9382