콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
5374 화면

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

아바타
취소
작성자

Sorry for the bump.

Anyone had an idea for this issue?

Do you resolve that?

베스트 답변

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


아바타
취소
베스트 답변

add inherit model also in  manifest depends 

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


아바타
취소
베스트 답변

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.

아바타
취소