Skip to Content
Menu
This question has been flagged
2 Replies
1327 Views

File "/opt/odoo/odoo/service/server\.py",\ line\ 1260,\ in\ preload_registries
\ \ \ \ registry\ =\ Registry\.new\(dbname,\ update_module=update_module\)
\ \ File\ "/opt/odoo/odoo/modules/registry\.py",\ line\ 87,\ in\ new
\ \ \ \ odoo\.modules\.load_modules\(registry,\ force_demo,\ status,\ update_module\)
\ \ File\ "/opt/odoo/odoo/modules/loading\.py",\ line\ 470,\ in\ load_modules
\ \ \ \ processed_modules\ \+=\ load_marked_modules\(cr,\ graph,
\ \ File\ "/opt/odoo/odoo/modules/loading\.py",\ line\ 363,\ in\ load_marked_modules
\ \ \ \ loaded,\ processed\ =\ load_module_graph\(
\ \ File\ "/opt/odoo/odoo/modules/loading\.py",\ line\ 198,\ in\ load_module_graph
\ \ \ \ registry\.setup_models\(cr\)
\ \ File\ "/opt/odoo/odoo/modules/registry\.py",\ line\ 290,\ in\ setup_models
\ \ \ \ model\._setup_fields\(\)
\ \ File\ "/opt/odoo/odoo/models\.py",\ line\ 3049,\ in\ _setup_fields
\ \ \ \ field\.setup\(self\)
\ \ File\ "/opt/odoo/odoo/fields\.py",\ line\ 464,\ in\ setup
\ \ \ \ self\.setup_nonrelated\(model\)
\ \ File\ "/opt/odoo/odoo/fields.py", line 3359, in setup_nonrelated
invf = comodel._fields[self.inverse_name]
KeyError: 'order_line_id'

Avatar
Discard
Author

it is field
order_line_ids = fields.One2many('sub.units', 'order_line_id', string='Order Lines', required=True)
and many2one field in the other module
order_line_id = fields.Many2one('realestate.sales', string='Order Line', required=True)
and i added
'depends': ['base', 'real_estate_sales'],
in the manifest

Best Answer

Hi,

Did you add order_line_id many2one field in sub.units model ? 

If the order_line_ids field is  defined inside the model realestate.sales model, you have to add order_line_id field with code model as realestate.sales in sub.units model .

Thanks & Regards

Avatar
Discard
Author

I already added order_line_ids in sub.unts
order_line_id=fields.Many2one('realestate.sales', string='Order Line', required=True)

Best Answer

Hello Reda Kassem,

Please find below code it may help you to resolve this issue,

In model realestate.sales
order_line_ids = fields.One2many('sub.units', 'order_line_id', string='Order Lines', required=True)

In model sub.units
order_line_id = fields.Many2one('realestate.sales', string='Order Line', required=True)

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard