1
votes

I'm a new Odoo developer I created a simple request module in Odoo 11 that will make employee request for stock but when the request is saved and submitted I don't want the request to be edited and deleted by users. I have tried the security rules perm_write = 0 and edit option lost but users are not able to submit the request and help, please?

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_request_user,stock request user,model_stock_request,group_stock_request_user,1,0,1,0
1
please can you calrify your question, adding a sample code well edited ?user12805184
@sodjsn26fr i want hide edit and delete button when request state change, in order for users not to edit or delete request after request submitted for approval.Daniel Abaka

1 Answers

1
votes

You can use sudo() in your submit function to bypass access right

self.env["stock.request"].sudo().state = "submitted"

And further hide the button if you want

<button name="submit()" string="Submit" type="object" attrs="{'invisible': [('state', '=', 'submitted')]}/>"