Odoo Help


AttributeError: 'student_detail' object has no attribute '775'? [Closed]

on 6/5/13, 8:45 AM 2,768 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 06/12/2013 07:53:24

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),
                    '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,
                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'} 


main view:

<?xml version="1.0"?>
        <!-- TREE -->
        <record model="ir.ui.view" id="student_detail_tree_view">
            <field name="name">student.tree </field>
            <field name="model">student.detail</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Students">
                    <field name="fname"/>
                    <field name="lname"/>
                    <field name="dob"/>                 
                    <field name="stu_id"/>
                    <field name="city"/>
        <!-- FORM -->
        <record model="ir.ui.view" id="student_detail_form_view">
            <field name="name">student.form</field>
            <field name="model">student.detail</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Student Form">
                  <group colspan="4" col="6">
                    <field name="fname"/>
                    <field name="lname"/>
                    <field name="dob"/>                 
                    <field name="stu_id"/>
                    <field name="active"/>
                    <field name="city"/>
                    <field name="phone"/>
                    <separator colspan="4" col="2"/>
                    <button name="%(action_confirm_registration)d" string="Register" icon="gtk-ok" type="object" groups="base.group_user"/>
                    <button name="action_cancel" string="Cancel" special="cancel" type="object" icon="gtk-cancel" groups="base.group_user"/>

        <record model="ir.actions.act_window" id="action_student_detail_form">
            <field name="name">Students</field>
            <field name="res_model">student.detail</field>

        <menuitem name="Students" id="menu_student" action="action_student_detail_form" />
        <menuitem name="Student Info" id="menu_student_detail" parent="menu_student" action="action_student_detail_form" />



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'}


and wizard view:

<?xml version="1.0" encoding="utf-8"?>

<!-- confirm student  -->

    <record id="view_confirm_registration" model="ir.ui.view">
            <field name="name">confirm.registration.form</field>
            <field name="model">confirm.registration</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Register">
                    <group colspan="4" >
                         <separator string="Registration Confirmation" colspan="4"/>
                         <field name="confirm_student"/>
                        <separator string="" colspan="4" />
                    <group colspan="4" col="6">
                        <button  icon="gtk-cancel" special="cancel" string="Cancel"/>
                        <button  icon="gtk-ok" name="confirm" string="Confirm" type="object"/>

        <record id="action_confirm_registration" model="ir.actions.act_window">
            <field name="name">Confirm Student</field>
            <field name="res_model">confirm.registration</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
           <field name="view_id" ref="view_confirm_registration"/>
           <field name="target">new</field>

        <act_window id="action_confirm_registration_values"
            key2="client_action_multi" name="Confirm Student"
            res_model="confirm.registration" src_model="student.detail"
            view_mode="form" target="new" view_type="form"/>


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 6/5/13, 8:52 AM

It seems problem is here:

stu_ref.confirm(cr, uid, data, confirm_obj.confirm_student.id, context)

You either need to pass data or confirm_obj.confirm_student.id because in confirm() method you have cr, uid, ids, context as parameters.

Try this.

Hope this will solve your problem.

hey m getting confused do i need to pass only confirm_student.id??

on 6/5/13, 9:05 AM

It's up to you what you want to do.

Sudhir Arya (ERP Harbor Consulting Services)
on 6/5/13, 9:10 AM

If you want to do changes on selected student in wizard then pass confirm_student.id.

Sudhir Arya (ERP Harbor Consulting Services)
on 6/5/13, 9:11 AM

I too have this error, but not because I don't pass anything. I simply cannot launch my wizard without getting the same error (different number though). Does this have to do with the dynamic XML ID reference?

David Brilliant
on 9/17/13, 12:19 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 6/5/13, 8:45 AM
Seen: 2768 times
Last updated: 3/16/15, 8:10 AM