Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4197 Lượt xem

Hi, i want to question.

I have problem, i will invisible field 'place' in form 'student' when the state become 'aplikan'.

this is code in form(object) :

class student(osv.osv):

_columns = {

'number_aplikan': fields.char('No Aplikan'),  

'full_name': fields.char('Full Name'), 

'place': fields.char('Tempat Lahir'),

}

def proses_aplikan(self, cr, uid, ids, context=None):

self.write(cr, uid, ids,{'state':'aplikan'})

a = self.browse(cr, uid, ids,{ 'state':'aplikan', })

if a:

'place' == False,


def create(self, cr, uid, vals, context=None):    

obj = self.pool.get('gelombang.pendaftaran').browse(cr, uid, vals['tahun_akademik_id']).name.name.tahun  

seq_name = 'A/{0}'.format(obj)

seq = self.pool.get('ir.sequence')

ids = seq.search(cr, uid, [('name','=',seq_name)])

if not ids:

prefix = seq_name

ids = seq.create(cr, uid, {

'name':seq_name,

'prefix': prefix,

'padding': 4,

'implementation': 'no_gap',

})

vals['name'] = seq.get_id(cr,uid,ids)

res = super(student, self).create(cr, uid, vals, context=context)

self.proses_aplikan(cr, uid, [res])

return res


i hope you give me idea, for invisible field 'place' in form 'student' when state become 'aplikan' ...


thanks in advance.

 


Ảnh đại diện
Huỷ bỏ

where you define your 'state' field ?

Tác giả

hmm, my problem it's work Jeng . with use code thanks with your respon ...

Câu trả lời hay nhất

Hi,

in xml use:

<field name="place" attrs="{'invisible': [('state','=','aplikan')]}"/>


Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

yes, it's work Ahmed . thank you very much Ahmed ...