Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
3331 Vues

I am trying out an example of "Using abstract models for reusable model features"


My code is showing an error:

raise TypeError("Model %r inherits from non-existing model %r." % (name, parent))
TypeError: Model 'library.book' inherits from non-existing model 'base.archive'. - - - 


My Code:

class BaseArchive(models.AbstractModel):

    _name = 'base.archive'
    active = fields.Boolean(default=True)
    def do_archive(self):
        for record in self:
            record.active = not record.active

class LibraryBook(models.Model):
    _name = 'library.book'
    _inherit = ['base.archive']

Avatar
Ignorer
Meilleure réponse
--- sory
Avatar
Ignorer
Publications associées Réponses Vues Activité
1
mars 23
6885
1
juil. 25
2642
4
mars 24
3517
1
oct. 23
5445
0
mai 23
2341