Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
11033 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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,
    }
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
oct. 24
1233
1
aug. 23
3348
1
dec. 22
4600
2
iun. 17
6007
1
iul. 15
5049