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.

0

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

By
priyankahdp
on 3/16/13, 4:15 AM 6,894 views

The Question has been closed

by
priyankahdp
on 04/20/2013 03:22:07

when I'm going to remove pay_roll model from OpenERP 7 it gives below error.please help me to sort it out.i got its some menu for my own modules also.after that its not copied from payroll module to my module.its moved from that module to my module.so i was trying to remove both modules.if going to uninstall them below error occured.

OpenERP Server Error

Client Traceback (most recent call last):
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/http.py", line 203, in dispatch
    response["result"] = method(self, **self.params)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/controllers/main.py", line 1078, in call_button
    action = self._call_kw(req, model, method, args, {})
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/controllers/main.py", line 1066, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 43, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 31, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 104, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)


Server Traceback (most recent call last):
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 90, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  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'

my new added module's code like this

checkroll.py

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()



    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()

Error in terminal when i run with these parameters

openerp-server --addons-path=/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons -r openerp -w postgres -h localhost -u all -d OpenERP_DB
Usage: openerp-server [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit

  Common options:
    -c CONFIG, --config=CONFIG
                        specify alternate config file
    -s, --save          save configuration to ~/.openerp_serverrc
    -i INIT, --init=INIT
                        install one or more modules (comma-separated list, use
                        "all" for all modules), requires -d
    -u UPDATE, --update=UPDATE
                        update one or more modules (comma-separated list, use
                        "all" for all modules). Requires -d.
    --without-demo=WITHOUT_DEMO
                        disable loading demo data for modules to be installed
                        (comma-separated, use "all" for all modules). Requires
                        -d and -i. Default is none
    -P IMPORT_PARTIAL, --import-partial=IMPORT_PARTIAL
                        Use this for big data importation, if it crashes you
                        will be able to continue at the current state. Provide
                        a filename to store intermediate importation states.
    --pidfile=PIDFILE   file where the server pid will be stored
    --addons-path=ADDONS_PATH
                        specify additional addons paths (separated by commas).
    --load=SERVER_WIDE_MODULES
                        Comma-separated list of server-wide modules
                        default=web

  XML-RPC Configuration:
    --xmlrpc-interface=XMLRPC_INTERFACE
                        Specify the TCP IP address for the XML-RPC protocol.
                        The empty string binds to all interfaces.
    --xmlrpc-port=XMLRPC_PORT
                        specify the TCP port for the XML-RPC protocol
    --no-xmlrpc         disable the XML-RPC protocol
    --proxy-mode        Enable correct behavior when behind a reverse proxy

  XML-RPC Secure Configuration:
    --xmlrpcs-interface=XMLRPCS_INTERFACE
                        Specify the TCP IP address for the XML-RPC Secure
                        protocol. The empty string binds to all interfaces.
    --xmlrpcs-port=XMLRPCS_PORT
                        specify the TCP port for the XML-RPC Secure protocol
    --no-xmlrpcs        disable the XML-RPC Secure protocol
    --cert-file=SECURE_CERT_FILE
                        specify the certificate file for the SSL connection
    --pkey-file=SECURE_PKEY_FILE
                        specify the private key file for the SSL connection

  NET-RPC Configuration:
    --netrpc-interface=NETRPC_INTERFACE
                        specify the TCP IP address for the NETRPC protocol
    --netrpc-port=NETRPC_PORT
                        specify the TCP port for the NETRPC protocol
    --no-netrpc         disable the NETRPC protocol
    --netrpc            enable the NETRPC protocol

  Web interface Configuration:
    --db-filter=REGEXP  Filter listed database

  Static HTTP service:
    --static-http-enable
                        enable static HTTP service for serving plain HTML
                        files
    --static-http-document-root=STATIC_HTTP_DOCUMENT_ROOT
                        specify the directory containing your static HTML
                        files (e.g '/var/www/')
    --static-http-url-prefix=STATIC_HTTP_URL_PREFIX
                        specify the URL root prefix where you want web
                        browsers to access your static HTML files (e.g '/')

  Testing Configuration:
    --test-file=TEST_FILE
                        Launch a YML test file.
    --test-report-directory=TEST_REPORT_DIRECTORY
                        If set, will save sample of all reports in this
                        directory.
    --test-enable       Enable YAML and unit tests.
    --test-commit       Commit database changes performed by YAML or XML
                        tests.

  Logging Configuration:
    --logfile=LOGFILE   file where the server log will be stored
    --no-logrotate      do not rotate the logfile
    --syslog            Send the log to the syslog server
    --log-handler=PREFIX:LEVEL
                        setup a handler at LEVEL for a given PREFIX. An empty
                        PREFIX indicates the root logger. This option can be
                        repeated. Example: "openerp.orm:DEBUG" or
                        "werkzeug:CRITICAL" (default: ":INFO")
    --log-request       shortcut for --log-
                        handler=openerp.netsvc.rpc.request:DEBUG
    --log-response      shortcut for --log-
                        handler=openerp.netsvc.rpc.response:DEBUG
    --log-web           shortcut for --log-
                        handler=openerp.addons.web.http:DEBUG
    --log-sql           shortcut for --log-handler=openerp.sql_db:DEBUG
    --log-level=LOG_LEVEL
                        specify the level of the logging. Accepted values:
                        ['info', 'debug_rpc', 'warn', 'test', 'critical',
                        'debug_sql', 'error', 'debug', 'debug_rpc_answer',
                        'notset'] (deprecated option).

  SMTP Configuration:
    --email-from=EMAIL_FROM
                        specify the SMTP email address for sending email
    --smtp=SMTP_SERVER  specify the SMTP server for sending email
    --smtp-port=SMTP_PORT
                        specify the SMTP port
    --smtp-ssl          if passed, SMTP connections will be encrypted with SSL
                        (STARTTLS)
    --smtp-user=SMTP_USER
                        specify the SMTP username for sending email
    --smtp-password=SMTP_PASSWORD
                        specify the SMTP password for sending email

  Database related options:
    -d DB_NAME, --database=DB_NAME
                        specify the database name
    -r DB_USER, --db_user=DB_USER
                        specify the database user name
    -w DB_PASSWORD, --db_password=DB_PASSWORD
                        specify the database password
    --pg_path=PG_PATH   specify the pg executable path
    --db_host=DB_HOST   specify the database host
    --db_port=DB_PORT   specify the database port
    --db_maxconn=DB_MAXCONN
                        specify the the maximum number of physical connections
                        to posgresql
    --db-template=DB_TEMPLATE
                        specify a custom database template to create a new
                        database

  Internationalisation options:
    Use these options to translate OpenERP to another language.See i18n
    section of the user manual. Option '-d' is mandatory.Option '-l' is
    mandatory in case of importation

    --load-language=LOAD_LANGUAGE
                        specifies the languages for the translations you want
                        to be loaded
    -l LANGUAGE, --language=LANGUAGE
                        specify the language of the translation file. Use it
                        with --i18n-export or --i18n-import
    --i18n-export=TRANSLATE_OUT
                        export all sentences to be translated to a CSV file, a
                        PO file or a TGZ archive and exit
    --i18n-import=TRANSLATE_IN
                        import a CSV or a PO file with translations and exit.
                        The '-l' option is required.
    --i18n-overwrite    overwrites existing translation terms on updating a
                        module or importing a CSV or a PO file.
    --modules=TRANSLATE_MODULES
                        specify modules to export. Use in combination with
                        --i18n-export

  Security-related options:
    --no-database-list  disable the ability to return the list of databases

  Advanced options:
    --debug             enable debug mode
    --stop-after-init   stop the server after its initialization
    -t TIMEZONE, --timezone=TIMEZONE
                        specify reference timezone for the server (e.g.
                        Europe/Brussels
    --osv-memory-count-limit=OSV_MEMORY_COUNT_LIMIT
                        Force a limit on the maximum number of records kept in
                        the virtual osv_memory tables. The default is False,
                        which means no count-based limit.
    --osv-memory-age-limit=OSV_MEMORY_AGE_LIMIT
                        Force a limit on the maximum age of records kept in
                        the virtual osv_memory tables. This is a decimal value
                        expressed in hours, and the default is 1 hour.
    --max-cron-threads=MAX_CRON_THREADS
                        Maximum number of threads processing concurrently cron
                        jobs (default 2).
    --unaccent          Use the unaccent function provided by the database
                        when available.

  Multiprocessing options:
    --workers=WORKERS   Specify the number of workers, 0 disable prefork mode.
    --limit-memory-soft=LIMIT_MEMORY_SOFT
                        Maximum allowed virtual memory per worker, when
                        reached the worker be reset after the current request
                        (default 671088640 aka 640MB).
    --limit-memory-hard=LIMIT_MEMORY_HARD
                        Maximum allowed virtual memory per worker, when
                        reached, any memory allocation will fail (default
                        805306368 aka 768MB).
    --limit-time-cpu=LIMIT_TIME_CPU
                        Maximum allowed CPU time per request (default 60).
    --limit-time-real=LIMIT_TIME_REAL
                        Maximum allowed Real time per request (default 120).
    --limit-request=LIMIT_REQUEST
                        Maximum number of request to be processed per worker
                        (default 8192).

removal of modules is still considered a beta feature and somehow dangerous. in this case your best chance is to run openerp-server by hand from the shell (so stop the service first) passing: -u all -d your_db_name (together to all the other switch you usually have to pass to openerp)

Davide Corio
on 3/16/13, 4:21 AM

thanks for ur infor Davide. u mean enter below in my terminal after server stpped. -u all -d my_db_name

priyankahdp
on 3/16/13, 4:38 AM

you'll have to run something like: openerp-server --addons-path=/path/to/addons,/path/to/web/addons -r db_user -w db_password -h localhost -u all -d my_db_name

Davide Corio
on 3/16/13, 4:41 AM

@ Davide : path to web addon means.?

priyankahdp
on 3/16/13, 5:08 AM

the addons folder you can find inside the folder of the web client

Davide Corio
on 3/16/13, 5:15 AM

@ Davide : post edited...please check

i entered ur code in terminal but its gives a error in terminal

priyankahdp
on 3/16/13, 5:23 AM

parameters looks correct. it's probably due to dashes in the path or things like that. btw try with not parameters then add them one by one to find the problem

Davide Corio
on 3/16/13, 6:47 AM
2

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/16/13, 10:18 AM

Hi,

in your command :

openerp-server --addons-path=/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons -r openerp -w postgres -h localhost -u all -d OpenERP_DB

you have an error :

parameter -h is to display help, not to define postgresl location.

-h locahost must be replaced by --db_host=localhost .

you have to defined postgresql port too :

--db_port=5432 (or this you use)

....

to read all parameters and its default value if it exists, see the file : .../server/openerp/tools/config.py

verify web addons are in /server/openerp/addons or defined in --addons_path

Bye

thanks issue with my new module's pass null parameter..i removed it then issue sorted your solution also helped me a lot
thanks :-)

priyankahdp
on 3/16/13, 2:09 PM

tnx GEM, my bad... -h is a postgresql param :)

Davide Corio
on 3/17/13, 4:14 AM

Hi, Davide, no problem, sometimes I read not very well the question or verify not informations which are done.too. the important thing is that at the end,, there is a good answer and active contributors ;) . Bye.

Cyril Gaspard (GEM)
on 3/17/13, 8:57 AM

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/16/13, 4:15 AM
Seen: 6894 times
Last updated: 3/16/15, 8:10 AM