Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
6814 Vizualizări

Hi, 

I want to hide progress-bar of crm.lead module. when i use xpath with position="replace" that time it would been hide but when I'm using position="attributes" that it would be not hide. i use position="attributes" coz i want to apply group on it.

see the below code

<record id="crm_price_field_hide_kanban_view" model="ir.ui.view">
    <field name="name">crm.lead.kanban.hide.field</field>
    <field name="model">crm.lead</field>
    <field name="priority">1</field>
    <field name="inherit_id" ref="crm.crm_case_kanban_view_leads" />
    <field name="arch" type="xml">
        <xpath expr="//kanban/progressbar[@field='activity_state']" position="attributes">
             <attribute name="groups">base.user_admin</attribute>
        </xpath>
    </field>
</record>

If you will solve this please let me know.

Thanks in Advanced. 

Imagine profil
Abandonează
Cel mai bun răspuns
  • add new field in your model to check the group of current user:

class CrmLead(models.Model):

    _inherit = 'crm.lead'

    is_admin = fields.Boolean(compute="check_user_group")

    def check_user_group(self):

          self.is_admin = self.env['rse.users'].has_group('base.user_admin')

  • add the field in your Xpath:

<xpath expr="//kanban/progressbar[@field='activity_state']" position="attributes">
             <attribute name="attrs">{'invisible':[('is_admin','=',False)]}</attribute>
 </xpath>

Imagine profil
Abandonează
Autor

Below error are generated

Field 'is_admin' used in attributes must be present in view but is missing:

- 'is_admin' in attrs="{'invisible':[('is_admin','!=',True)]}"

add this to your view:

<xpath expr="//kanban/progressbar[@field='activity_state']" position="after">

<field name="is_admin" invisible="1"/>

</xpath>

Related Posts Răspunsuri Vizualizări Activitate
2
oct. 23
5256
1
mai 22
9075
3
oct. 19
13609
2
mar. 24
1672
0
iun. 20
3309