İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
11051 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Eki 24
1236
1
Ağu 23
3361
1
Ara 22
4607
2
Haz 17
6023
1
Tem 15
5058