Skip to Content
Menu
This question has been flagged
1 Atsakyti
10953 Rodiniai

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.

Portretas
Atmesti
Best Answer

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,
    }
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
spal. 24
1154
1
rugp. 23
3253
1
gruod. 22
4438
2
birž. 17
5945
1
liep. 15
4980