Odoo Help

Welcome!

This community 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.

1

AttributeError: 'NoneType' object has no attribute '_table' [Closed]

By
priyankahdp
on 3/17/13, 12:47 AM 5,046 views

The Question has been closed

by
priyankahdp
on 04/18/2013 06:54:39

when I'm going to remove my created module below error occured..

2013-03-17 03:42:33,019 5517 INFO OpenERP_DB openerp.modules.loading: loading 36 modules...
2013-03-17 03:42:33,057 5517 ERROR OpenERP_DB openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 495, in button_immediate_uninstall
    return self._button_immediate_function(cr, uid, ids, self.button_uninstall, context=context)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 475, in _button_immediate_function
    _, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/pooler.py", line 39, in restart_pool
    registry = RegistryManager.new(db_name, force_demo, status, update_module)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/modules/registry.py", line 218, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/modules/loading.py", line 416, in load_modules
    pool.get('ir.module.module').module_uninstall(cr, SUPERUSER_ID, mod_ids_to_remove)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 439, in module_uninstall
    ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/ir/ir_model.py", line 533, in _module_data_uninstall
    WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table))
AttributeError: 'NoneType' object has no attribute '_table'
2013-03-17 03:42:33,060 5517 ERROR OpenERP_DB openerp.netsvc: 'NoneType' object has no attribute '_table'
Traceback (most recent call last):
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/netsvc.py", line 293, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/service/web_services.py", line 618, in dispatch
    res = fn(db, uid, *params)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 495, in button_immediate_uninstall
    return self._button_immediate_function(cr, uid, ids, self.button_uninstall, context=context)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 475, in _button_immediate_function
    _, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/pooler.py", line 39, in restart_pool
    registry = RegistryManager.new(db_name, force_demo, status, update_module)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/modules/registry.py", line 218, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/modules/loading.py", line 416, in load_modules
    pool.get('ir.module.module').module_uninstall(cr, SUPERUSER_ID, mod_ids_to_remove)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/module/module.py", line 439, in module_uninstall
    ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/base/ir/ir_model.py", line 533, in _module_data_uninstall
    WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table))
AttributeError: 'NoneType' object has no attribute '_table'
2013-03-17 03:42:33,069 5517 INFO OpenERP_DB werkzeug: 127.0.0.1 - - [17/Mar/2013 03:42:33] "POST /web/dataset/call_button HTTP/1.1" 200 -


    <?xml version="1.0"?>
<openerp>
    <data>
        <!-- 1st part of the sim_view start -->
        <record model="ir.ui.view" id="worker_form">
            <field name="name">Basic Data</field>
            <field name="model">checkroll.plucker</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Worker_test">
                    <field name="reg_no" />
                    <field name="worker_name" />
                    <field name="spouse_name" />
                    <field name="gender" />
                    <field name="epf_no" />
                </form>
            </field>
        </record>
        <!--2nd part of the sim_view start -->
        <record model="ir.ui.view" id="worker_tree">
            <field name="name">Basic Data</field>
            <field name="model">checkroll.plucker</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Worker_test"><!-- which columns need to shows in OpenERP List View -->
                    <field name="reg_no" />
                    <field name="worker_name" />
                    <field name="spouse_name" />
                </tree>
            </field>
        </record>
        <!-- 3rd part of the sim_view start -->
        <record model="ir.actions.act_window" id="action_worker_reg">
            <field name="name">Worker Registration</field><!-- This shows what should 
                screen caption in form/tree views -->
            <field name="res_model">checkroll.plucker</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->

        <record model="ir.ui.view" id="work_offer_form">
            <field name="name">Work Offer Data</field>
            <field name="model">checkroll.work.offer</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Work_offer">
                    <field name="date" />
                    <field name="division" />
                    <field name="work" />
                    <field name="epf_no" />
                </form>
            </field>
        </record>

        <!--2nd part of the sim_view start -->
        <record model="ir.ui.view" id="work_offer_tree">
            <field name="name">Work Offer Data</field>
            <field name="model">checkroll.work.offer</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Work_offer">
                    <field name="date" />
                    <field name="division" />
                    <field name="work" />
                    <field name="epf_no" />
                </tree>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_worker_work_offer">
            <field name="name">Work Offer Process</field>
            <field name="res_model">checkroll.work.offer</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
        </record>


        <!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->

        <record model="ir.ui.view" id="work_offer_form_new">
            <field name="name">Work Offer Data New</field>
            <field name="model">checkroll.work.offer.new</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Work_offer_new">
                    <field name="date" />
                    <field name="division" />
                    <field name="holiday" />
                    <field name="work" />
                    <field name="emp_id" />
                </form>
            </field>
        </record>

        <!--2nd part of the sim_view start -->
        <record model="ir.ui.view" id="work_offer_tree_new">
            <field name="name">Work Offer Data New</field>
            <field name="model">checkroll.work.offer.new</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Work_offer_new">
                    <field name="date" />
                    <field name="division" />
                    <field name="holiday" />
                    <field name="work" />
                </tree>
            </field>
        </record>


        <record model="ir.ui.view" id="work_offer_graph_new">
            <field name="name">Work Offer Data New</field>
            <field name="model">checkroll.work.offer.new</field>
            <field name="arch" type="xml">
                <graph string="Work_offer_new" type="bar">
                    <field name="date" />
                    <field name="holiday" />
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_worker_work_offer_new">
            <field name="name">Work Offer Process</field>
            <field name="res_model">checkroll.work.offer.new</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
        </record>

        <!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->

        <record model="ir.ui.view" id="namelist_update_form">
            <field name="name">Name List Update</field>
            <field name="model">checkroll.namelist.update</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="namelist_update">
                    <field name="date" />
                    <field name="val" />
                </form>
            </field>
        </record>

        <!--2nd part of the sim_view start -->
        <record model="ir.ui.view" id="namelist_update_list">
            <field name="name">Name List Update</field>
            <field name="model">checkroll.namelist.update</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="namelist_update">
                    <field name="date" />
                    <field name="val" />
                </tree>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_namelist_update">
            <field name="name">Name List Update</field>
            <field name="res_model">checkroll.namelist.update</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>



        <!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->

        <menuitem id="menu_checkroll_plucker" name="Checkroll/Steps" />

        <menuitem id="menu_worker_registration_plucker" name="Worker Registration"
            parent="menu_checkroll_plucker" sequence="1" action="action_worker_reg" />
        <menuitem id="menu_work_offer_plucker" name="Work Offer"
            parent="menu_checkroll_plucker" action="action_worker_work_offer_new"
            sequence="2" />
        <menuitem id="menu_namelist_update_plucker" name="Namelist Update"
            parent="menu_checkroll_plucker" action="action_namelist_update"
            sequence="3" />
        <menuitem id="menu_daily_update_plucker" name="Daily Update"
            parent="menu_checkroll_plucker" action="action_worker_reg" sequence="4" />
        <menuitem id="menu_monthly_update_plucker" name="Monthly Update"
            parent="menu_checkroll_plucker" action="action_worker_reg" sequence="5" />

    </data>
</openerp>


    from openerp.osv import fields, osv
import random

class checkroll(osv.osv):
    _name = "checkroll.plucker"
    _description = "This table is for keeping personal data of plucker"
    _columns = {
        'reg_no': fields.char('Registration Number', size=256, required=True),
        'worker_name': fields.char('Worker Name', size=256, required=True),
        'spouse_name': fields.char('Spouse Name', size=256),
        'gender' : fields.selection((('male', 'Male'), ('female', 'Female'), ('middle', 'Test')), 'Gender', required=True),
        'epf_no':fields.char('EPF Number', size=256)
    }

checkroll()



class workoffer(osv.osv):
    _name = "checkroll.work.offer"
    _description = "This table is for keeping work offer data"
    _columns = {
        'date': fields.date("Date"),
        'division': fields.char('Division', size=256, required=True),
        'work' : fields.selection((('plucking', 'Plucking'), ('tapping', 'Tapping'), ('sundry_worker', 'Sundry Worker')), 'Work', required=True),
        'epf_no': fields.many2one('hr.employee', "Employee", required=True, select=True),
    }

workoffer()


class workoffernew(osv.osv):
    _name = "checkroll.work.offer.new"
    _description = "This table is for keeping work offer data"
    _columns = {
        'date': fields.date("Date"),
        'division': fields.many2one('hr.department', 'Division', select=True),
        'holiday': fields.boolean('Holiday', help="select if holiday or not"),
        'work' : fields.selection((('plucking', 'Plucking'), ('tapping', 'Tapping'), ('sundry_worker', 'Sundry Worker')), 'Work', required=True),
        'emp_id': fields.many2one('hr.employee', "Employee", required=True, select=True),
    }

workoffernew()

class namelistupdate(osv.osv):
    def _random_letter(self, cr, uid, ids, name, args, context):
        num=[]
        for i in range(5):
            res = random.choice([1, 2, 3, 5, 9])
            num.append(res)
            print  (num)
            return num

    def _mytest_query(self, cr, uid, ids, name, args, context):
        cr.execute("""update checkroll_plucker set worker_name =concat('worker','%s') where id='1'""", self._random_letter(cr, uid, ids, name, args, context))
        cr.commit()
        # res = cr.dictfetchall()
        # print (res)

# here ids means current id in table.if table have 5 records now ids[0] means 6
# name means column name we need to insert
    def _invoiced_rate(self, cr, uid, ids, name, args, context):
        self._mytest_query(cr, uid, ids, name, args, context)
        amount_untaxed = 1
        record_id = ids[0]
        res = {record_id: 0.0}
        if amount_untaxed == 0:
            res[record_id] = 100.0
        else:
            res[record_id] = 50.0
        return res

    _name = "checkroll.namelist.update"
    _description = "This table is for keeping Name list updates"
    _columns = {        
        'date': fields.date("Date"),
        'val': fields.function(_invoiced_rate, method=True, type='float', string='Test', store=True),
    }

namelistupdate()

i removed my exist data from pgsql .tables.now issues is ok..

priyankahdp
on 3/17/13, 10:12 PM
0

priyankahdp

--priyankahdp--
1089
| 5 5 6
Colombo, Sri Lanka
--priyankahdp--
Java Developer ORACLE Python J2EE Spring Hibernate Struts & Jquery............. :-)
priyankahdp
On 4/18/13, 6:53 AM

i removed my exist data from pgsql .tables.now issues is ok..

just go to manage database link in login window.then create DB and work with that hope it will helps :-)

priyankahdp
on 7/15/13, 6:14 AM
0
fadhel salhi
On 6/2/14, 9:23 AM

Hi also get the same error when i added a function in account_invoice.py and its view. I re changed the code to its previous version so that the error goes but still it shows the same error, restarted server, cleared the cache but no result. Can you help?

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/17/13, 12:47 AM
Seen: 5046 times
Last updated: 3/16/15, 8:10 AM