This question has been flagged
7 Replies
13973 Views

I want to remove edit button for user in form issue but not for manager or admin. I didn't find any code for edit button. I have tried access control and record rules but it's not working. I also have tried to change models project.issue for project user and uncheck in "write access" , it's working..But user also can't create issue. I want user still can create issue but can't edit any recorded issue..anyone can help me?thank you

Avatar
Discard
Best Answer

Create your own group and then try given xml code. You need to pass your group in groups_id.

    <record id="view_issue_form_remove_edit" model="ir.ui.view">
        <field name="name">view.issue.form.remove.edit</field>
        <field name="model">project.issue</field>
        <field name="inherit_id" ref="project_issue.project_issue_form_view"/>
        <field name="groups_id" eval="[(6, 0, [ref('your_group')])]"/>
        <field name="arch" type="xml">
            <xpath expr="//form" position="attributes">
                <attribute name="edit">false</attribute>
            </xpath>
        </field>
    </record>

This will hide edit button for those users who belongs to new group.

Avatar
Discard
Author

I have tried in file project_issue_view.xml , and it's not working..em sorry , btw which file that I have to write those code?is it in project_issue_view.xml?thank you..

Author

Mr Sudhir Arya please reply my comment..sorry because It's urgent for my project..thank you

Yes , I also need this function..I'm waiting for your response Mr Sudhir Arya..

How can i hide a <page> for particular stage not state? For eg: In recruitment module, it has contract proposed stage. When i click the stage, i want to see my customized <page> tab. is it possible?

Thanks, it works for me..!

Best Answer

Can you find a solution, i need the same?

Avatar
Discard
Best Answer

Also, with something like this It's possible to hide the buttons from an specific user groups. This example hide the buttom edit in the Invoice Form. The users of the groups have write privileges only for posting on the messages an communication history but not the fields of the invoices.

   <record model="ir.ui.view" id="YOURNEWVIEWID">
         <field name="name">account.invoice.form</field>
         <field name="model">account.invoice</field>
         <field name="inherit_id" ref="PARENTFORMID" />
         <field name="groups_id" eval="[(6,0, [ref('YOURSPECIFICGROUP')])]" />
         <field name="arch" type="xml">
            <xpath expr="//form[@string='Invoice']" position="attributes">
                <attribute name="edit">false</attribute>
            </xpath>
         </field>
    </record>
To hide a page it is similar, the difference will be in the xpath section
   <record model="ir.ui.view" id="YOURNEWVIEWID">         
        <field name="name">account.invoice.form</field>         
        <field name="model">account.invoice</field>         
        <field name="inherit_id" ref="PARENTFORMID" />         
        <field name="groups_id" eval="[(6,0, [ref('YOURSPECIFICGROUP')])]" />         
        <field name="arch" type="xml">             
            <xpath expr="//page[@string='Invoice Lines']" position="replace">    
            <!-- nothing here-->
            </xpath>
            <!-- OR -->
            <xpath expr="//page[@string='Invoice Lines']" position="attributes">     
               <attribute name="invisible">True</attribute>
            </xpath            
        </field>     
    </record>
Avatar
Discard