Hello,
I have this code:
from openerp.osv import fields, osv from openerp.tools.translate import _ import openerp
class hr_expense_expense(osv.osv): _inherit = 'hr.expense.expense' _columns = { 'issue_id': fields.many2one('account.analytic.line','Incidencia'), }
class account_analytic_line(osv.osv): _description = 'Analytic Line' _inherit = 'account.analytic.line' _columns = { 'expenses_id': fields.one2many('hr.expense.expense','issue_id','Gastos'), }
And get this error:
2015-04-29 07:13:55,604 4039 CRITICAL Conecta openerp.service.server: Failed to initialize database `Conecta`.
Traceback (most recent call last):
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/service/server.py", line 906, in preload_registries
registry = RegistryManager.new(dbname, update_module=update_module)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/registry.py", line 341, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/loading.py", line 354, in load_modules
force, status, report, loaded_modules, update_module)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/loading.py", line 263, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/loading.py", line 158, in load_module_graph
models = registry.load(cr, package)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/registry.py", line 148, in load
model = cls._build_model(self, cr)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/models.py", line 595, in _build_model
original_module = pool[name]._original_module if name in parents else cls._module
File "/opt/bitnami/apps/odoo/lib/odoo-8.0_a2115ef-py2.7.egg/openerp/modules/registry.py", line 101, in __getitem__
return self.models[model_name]
KeyError: 'hr.expense.expense'
I'm just trying to add a relation between expense and timesheet, so the user can add it's expenses in the timesheet (and keep related the work he did, with its expenses)
Hope you can help me. Thank you.