Community mailing list archives

error after restart if inherit is used

Valentin Imsand
- 04/15/2015 06:00:02
Dear Community,

I’m trying to write a simple module where I can run some special „trigger-events" when a quotation has been send… therefore I will _inherit = „sale.order“ and override the original action_quotation_send()… It works fine after a fresh installation of the new module…
from openerp.osv import fields, osv

import logging
_logger = logging.getLogger(__name__)

class hooc_main(osv.Model):
_name = "hooc.main"
_columns = {
'order_id': fields.integer('Order ID', size=4),
'product_id': fields.integer('Product ID', size=4),
'partner_id': fields.integer('Partner ID', size=4),
'assigned_to': fields.integer('Assigned To', size=9, required=False),
'followup_id': fields.integer('FollowUp ID', size=4, required=False),
'create_date':'Create Date'),
'valid_form':'Valid From', required=False),
'valid_until':'Valid Until', required=False),
'cancel_date':'Cancel Date', required=False),
'disable_ack': fields.boolean('Disable Ack'),

class sale_order(osv.Model):
_inherit = "sale.order"

def action_quotation_send(self, cr, uid, ids, context=None):'My Interrupt'),

return super(sale_order, self).action_quotation_send(cr, uid, ids, context=None)
but after a server restart, the following error appears:

Traceback (most recent call last):
  File "/Users/imsand/odoo-env/lib/python2.7/site-packages/werkzeug/", line 177, in run_wsgi
  File "/Users/imsand/odoo-env/lib/python2.7/site-packages/werkzeug/", line 165, in execute
    application_iter = app(environ, start_response)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/service/", line 281, in app
    return, s)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/service/", line 216, in application
    return application_unproxied(environ, start_response)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/service/", line 202, in application_unproxied
    result = handler(environ, start_response)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/", line 1280, in __call__
    return self.dispatch(environ, start_response)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/", line 1254, in __call__
    return, start_wrapped)
  File "/Users/imsand/odoo-env/lib/python2.7/site-packages/werkzeug/", line 588, in __call__
    return, start_response)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/", line 1412, in dispatch
    ir_http = request.registry['ir.http']
  File "/Users/imsand/HOOC/odoo-8.0/openerp/", line 339, in registry
    return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 353, in get
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 384, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 351, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 255, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 152, in load_module_graph
    models = registry.load(cr, package)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 166, in load
    model = cls._build_model(self, cr)
  File "/Users/imsand/HOOC/odoo-8.0/openerp/", line 595, in _build_model
    original_module = pool[name]._original_module if name in parents else cls._module
  File "/Users/imsand/HOOC/odoo-8.0/openerp/modules/", line 101, in __getitem__
    return self.models[model_name]
KeyError: 'sale.order'

and the server can’t start anymore… did I miss something???

Thanks for your help