コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
11045 ビュー

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.

アバター
破棄
最善の回答

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,
    }
アバター
破棄
関連投稿 返信 ビュー 活動
3
10月 24
1234
1
8月 23
3353
1
12月 22
4605
2
6月 17
6012
1
7月 15
5055