Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
11056 Visninger

How can I remove/stop creating defaults values from inherited class?

For example I have this:

class A(orm.Model):
    _name = 'a.a'
    _columns = {
        'field1': fields.char('Field', size=64),
    }
    defaults = {
        'field1': 'Hello',
    }

class B(orm.Model):
    _inherit = 'a.a'
    #now how to remove to stop creating default value from A class?

Note. Of course I can't just simply delete that line from class A, because some other modules may depend on it.

Avatar
Kassér
Bedste svar

You have to do this:

class B(orm.Model):
_inherit = 'a.a'
#now how to remove to stop creating default value from A class?
defaults = {
        'field1': None,
    }
Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
3
okt. 24
1239
1
aug. 23
3367
1
dec. 22
4610
2
jun. 17
6030
1
jul. 15
5059