Skip to Content
Menu
This question has been flagged
3 Replies
5352 Views

Hi everyone,

Thanks to the community for all the answers I could get from this forum. I have one problem now for which I can't seem to find a solution.

I created a custom model (x_smartphones) with studio in odoo 10 entreprise and now I am building a new module via code which should inherit x_smartphones but I get the following error

TypeError: Model 'x_smartphones' does not exist in registry.
here is my model deals.py

from odoo import fields, models, tools, _
import odoo.addons.decimal_precision as dp

class CustomSmartphonesTemplate(models.Model):
    _inherit = 'x_smartphones'
    #x_isdeal = fields.Boolean(string="Mettre en Occasion")
    x_deal_pic = fields.Binary("Medium-sized image", attachment=True, help="blabla")

I have the following in  __manifest__.py

'depends': [
    'website',
    'web_studio',
    'product',
    'website_sale',
    'sale'
],

Thanks a lot for any input that could help!

Cheers,

Hugues

Avatar
Discard
Author

Sorry for the bump.

Anyone had an idea for this issue?

Do you resolve that?

Best Answer

if you are still interested what I did is the following:

1

create a model class in your custom module with the same name of the model created with studio 

class ReportExternal(models.Model):
_name = 'x_smartphones'

x_name = fields.Char()

2

run this query in the database

select * from ir_model where model like 'x_smartphones';

3

get the id and update

update ir_model set state = 'base' where id =574;

4

then update your custom module, that should work


works on Odoo 14 and Odoo 15


Avatar
Discard
Best Answer

add inherit model also in  manifest depends 

'depends': [
    'website',
    'web_studio',
    'product',
    'website_sale',
    'sale',
'x_smartphones',
],


Avatar
Discard
Best Answer

Still looking for an answer on how to set a dependency on studio; Trying to inherit classes made out of studio throws a " Model 'x_model_name' does not exist in registry. " error.

Even though web_studio is in the dependency list.

Avatar
Discard