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

my code . py. fields ten_nv filled but fields luong_ct did not fill. I don know I have an error.

 def onchange_ma_nv(self, cr, uid, ids, ma_nv, context = None):
         res={}
         if ma_nv:
             ma = self.pool.get('danh.sach.nv').browse(cr, uid , ma_nv, context = context)
             res= {
                   'ten_nv': ma.ten_nv,
                   'luong_ct': ma.luong_ct
                 }
         return {'value':v}

       
        
    _columns = {
                'ma_nv':fields.many2one('danh.sach.nv', 'Mã NV'),
                'ten_nv':fields.char('Tên nhân', size = 40),
                'luong_ct':fields.char( 'Lương chính thức', size =  20),
                'luong_dc':fields.char('Lương điều chỉnh', size = 20),
                'ly_do_dc': fields.char('Lý do điều chỉnh', size = 30),
                
                }

 

 

아바타
취소
베스트 답변

What is 'v' here? You have to return 'res' as value for the key 'value'.

def onchange_ma_nv(self, cr, uid, ids, ma_nv, context = None):
         res = {}
         if ma_nv:
             ma = self.pool.get('danh.sach.nv').browse(cr, uid , ma_nv, context = context)
             res= {
                   'ten_nv': ma.ten_nv,
                   'luong_ct': ma.luong_ct
                 }
         return {'value': res}

아바타
취소
베스트 답변

def onchange_ma_nv(self, cr, uid, ids, ma_nv, context = None):
         res = {}
         if ma_nv:
             ma = self.pool.get('danh.sach.nv').browse(cr, uid , ma_nv, context = context)
             res= {
                   'ten_nv': ma.ten_nv,
                   'luong_ct': ma.luong_ct
                 }
         return {'value': res}

아바타
취소
베스트 답변

No you can return mutiple fields in side the value dict

아바타
취소
베스트 답변

 def onchange_ma_nv(self, cr, uid, ids, ma_nv, context = None):
         res={}
         if ma_nv:
             ma = self.pool.get('danh.sach.nv').browse(cr, uid , ma_nv, context = context)
             res= {
                   'ten_nv': ma.ten_nv,
                   'luong_ct': ma.luong_ct
                 }
         return {'value': res}

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

My code run. But I want to aks a question. In onchange function has limit number filed to return ??

아바타
취소

No limit in return type in onchange function. It return dictionary with no of keys (is the column name) and values.

작성자

so when I choose 3 fields to view onchange function , I have an error : server overload. I want to aks you a question : How do I do to not have an error : server overload?

관련 게시물 답글 화면 활동
1
10월 23
2092
2
10월 23
2338
2
8월 23
4362
4
8월 23
20700
3
10월 22
11150