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


Trying to override browse().

Documentation reading, watching examples. I came to this:

class aTest(models.Model):
     _name = 'a.test'
     _rec_name='name'
     _description = 'test'
     name = fields.Char( size=20, required=True, index=True,)
     discr = fields.Char( size=30, required=False, index=True,)
    @api.v7
    def browse(self, cr, uid, arg, context=None):          recs = super(aTest, self).browse(cr, uid, arg, context=context)
         if not recs._context.get('skip_update'):
             recs.with_context(skip_update=True).update()
# TypeError: update() takes exactly 2 arguments (1 given)
     return recs


     @api.v8
     @api.multi
     def browse(self, arg):
# TypeError: 'NoneType' object is not callable
         recs = super(aTest, self).browse(arg)
         if not recs._context.get('skip_update'):
             recs.with_context(skip_update=True).update()
     return recs


Please tell me, what went wrong, fix it.

Please add examples - for odoo writing recently.

The errors I noted in the code comments.


아바타
취소
관련 게시물 답글 화면 활동
4
1월 16
10468
4
2월 16
6091
0
3월 25
1288
0
1월 25
3390
1
8월 23
14687