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

Hi, 

Please i have a form with this workflow [ In progress, Finished ]

 i want to hide the create button when the workflow is in progress, and show it when we move the workflow to the finished.
in idoo 10


Regards,

아바타
취소

try to create a access rule for this

작성자

i can hide the create button by using the access rule, but i what i'm looking for is for that the same user can use the create button until the workflow for the last record is in finished

create a record rule with your condition eg domain= [('state', '=', 'progress')] and create= false

베스트 답변

This is the better way I cant find to hide create button bassed in some condition:

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(Entity, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type,
context=context,
toolbar=toolbar, submenu=submenu)
doc = etree.XML(res['arch'])
if view_type == 'form' and [some_condition]:
for node_form in doc.xpath("//form"):
node_form.set("create", 'false')

res['arch'] = etree.tostring(doc)
return res
아바타
취소
작성자

Hi,

I think this is not writting in odoo 10 ?

Ahh ok, in odoo 10 this is the source code:

@api.model

def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):

res = super(Entity, self).fields_view_get(view_id=view_id, view_type=view_type,

context=context,

toolbar=toolbar, submenu=submenu)

doc = etree.XML(res['arch'])

if view_type == 'form' and [some_condition]:

for node_form in doc.xpath("//form"):

node_form.set("create", 'false')

res['arch'] = etree.tostring(doc)

return res

Thanks man ! you gave me the idea and it works !

Thank you all!