콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
10591 화면

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
758
1
8월 23
2519
1
12월 22
3957
2
6월 17
5565
1
7월 15
4622