Skip to Content
मेन्यू
This question has been flagged
1 Reply
3307 Views

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
Discard
Best Answer
--- sory
Avatar
Discard
Related Posts Replies Views Activity
1
मार्च 23
6861
1
जुल॰ 25
2585
4
मार्च 24
3468
1
अक्तू॰ 23
5414
0
मई 23
2321