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

How can I open a form view in readonly mode after returning the action from python method.

@api.multi
def action_view_product(self):
return {
'type': 'ir.actions.act_window',
'name': 'Products',
'view_mode': 'form',
'view_type': 'form',
'res_model': "product.template",
'res_id': self.id,
'target': 'new',
}


아바타
취소
베스트 답변

Just pass the following code in the action:

'flags': {'initial_mode': 'view'}

return {
'type': 'ir.actions.act_window',
'name': 'Products',
'view_mode': 'form',
'view_type': 'form',
'res_model': "product.template",
'res_id': self.id,
'target': 'new',
'flags': {'initial_mode': 'view'}
}
아바타
취소
작성자

Thank you, it worked! :)

베스트 답변

Hi,

Can you add this to return and see: 

'context': {'create': False, 'delete': False}

Like:

@api.multi
def action_view_product(self):
return {
'type': 'ir.actions.act_window',
'name': 'Products',
'view_mode': 'form',
'view_type': 'form',
'res_model': "product.template",
'res_id': self.id,
'target': 'new',
'context': {'create': False, 'delete': False},
}

Thanks

아바타
취소
관련 게시물 답글 화면 활동
2
3월 20
4887
1
10월 18
5004
1
12월 17
2297
1
12월 17
3745
1
7월 17
7311