Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
7 Odpovědi
15298 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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..

Autor

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..!

Nejlepší odpověď

Can you find a solution, i need the same?

Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 15
3868
1
bře 15
4909
3
úno 18
9016
1
bře 15
12979
2
led 24
12901