하나의 변수 var_x가 fct1에 있습니다. 제가 동일한 클래스 코드에 다른 기능 fct2에서 동일한 변수 값을 사용할 :openerp에서 같은 클래스의 다른 함수에서 하나의 함수 변수를 사용하는 방법은 무엇입니까?
여기def onchange_blockcreate(self, cr, uid, ids, block):
global family_code_id
global varname
if block:
cr.execute ('select activefrom,activeto from new_block where id=%s ',(block,))
family_code_id =cr.fetchone()[0]
msgalert = {'title':'Warning','message':}
return {'warning':msgalert}
def onchange_evaluation_date(self, cr, uid, ids,family_code_id,activefrom):
print activefrom
print family_code_id
if activefrom>=family_code_id:
print activefrom
else :
msgalert = {'title':'Warning','message':'fieldtocheck is too short!'}
return {'warning':msgalert}
family_code_id가 제 기능에 사용되며, 또한 제 기능 동일 family_code_id 사용할. 하지만 오류가 있습니다 :
global variable family_code_id is not defined.
openerp에서 어떻게 가능합니까?
코드의 형식을 수정하십시오. 들여 쓰기 당 4 개의 공백을 사용하십시오. 탭과 스페이스를 혼용하지 마십시오. – eryksun