_inherits doesnt see orm objects

Asked by grisha

Hello.
I'm trying to create my own little addon.

import time
import netsvc
 from osv import fields, osv
 import pooler
 from tools import config
 from tools.translate import _

class account_invoice(osv.osv):
    _name = "account.invoice"
    _inherit = "account.invoice"
     def _get_order(self, cr, uid, ids, field_name, args, context={}):
             res={}
             sids = self.pool.get('sale.order').search(cr, uid, [('invoice_ids','=',ids)],context=context)
             if sids:
                 for id in ids:
                    res[id]=[x for x in sids]
                 return res
            else:
                return False
   _columns = {
         'order_id': fields.function(_get_order , method=True,type='many2one' , obj='sale.order',string='Order'),
         }
     _defalts = {}
account_invoice()

And when installing it, i get:
 "File "/usr/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 232, in createInstance
    assert pool.get(parent_name), "parent class %s does not exist in module %s !" % (parent_name, module)
AssertionError: parent class account.invoice does not exist in module rez !"

Please help, i have no idea what have i missed to initialize

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Romain Deheele - Camptocamp
Solved:
Last query:
Last reply:
Revision history for this message
Best Romain Deheele - Camptocamp (romaindeheele) said :
#1

Don't forget to put the object 'account' in the field "depends" inside the terp of your module!

Revision history for this message
grisha (bzvqzrvpageu0tp-deactivatedaccount) said :
#2

Thanks romainD, that solved my question.