I created a very small and simple module and created wizard in it. When i updated my module and try to use my wizard on the button call i got this error:
AttributeError: 'student_detail' object has no attribute '775' for no reason. I searched all my module if there is mistyping or something but i am now not able to find out what went wrong. Kindly help if someone knows about this weird error.
here is my main model:
class student_detail(osv.osv):
_name = 'student.detail'
_description = 'Students'
_columns ={
'fname':fields.char('First Name',size=64),
'lname':fields.char('Last Name', size=64),
'dob':fields.date('Date of Birth', required=True),
'stu_id':fields.char('Roll No.',size=24,required=True),
'city':fields.char('City',size=24,required=True),
'phone':fields.char('Contact',size=16),
'active': fields.boolean('Active')
}
_defaults = {
'active': lambda *a: True,
}
def confirm(self, cr, uid, ids,Context=None):
student = self.pool.get('student.detail')
new_id = student.create(cr, uid, {'fname': student.fname,
'lname':student.fname,
'dob':student.dob,
'stu_id':student.stu_id,
'city':student.city,
'phone':student.phone,
'active':True,
})
self.write(cr, uid, [student.id], {'student': new_id})
return {}
def action_cancel(self,cr,uid,ids,context=None):
return {'type': 'ir.actions.act_window_close'}
student_detail()
main view:
student.tree student.detail tree student.form student.detail form Students student.detail
wizard.py:
from osv import fields, osv
class confirm_registration(osv.osv_memory):
_name = "confirm.registration"
_description = "confirm registration"
_columns = {
'confirm_student':fields.many2one('student.detail', 'Student', required=True),
}
def confirm(self, cr, uid, ids, context=None):
if context is None:
context = {}
data = context and context.get('active_ids', []) or []
stu_ref = self.pool.get('student.detail')
for confirm_obj in self.browse(cr, uid, ids, context=context):
stu_ref.confirm(cr, uid, data, confirm_obj.confirm_student.id, context)
return {'type': 'ir.actions.act_window_close'}
confirm_registration()
and wizard view:
confirm.registration.form confirm.registration form Confirm Student confirm.registration form tree,form new
↧