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,
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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,
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!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
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