Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
3483 Ansichten

i am struggling to modify CRM Lead form view via inheritance. i want to move Mobile field from Extra Info tab to main, below Phone field (from one Group to Another). i have done this successfully but it is exist on its original place (group) where it was in Extra Info tab. how i can actually move or what is better way? please check my code and advise/help how to Move it

record id="view_crm_lead_form_inherit" model="ir.ui.view"
field name="name"CRM Lead Custom Field/field
field name="model"crm.lead/field
field name="type"form/field
field name="inherit_id" ref="crm.crm_lead_view_form"
field name="arch" type="xml"
xpath expr="//group[@name='opportunity_partner']" position="inside"
label for="mobile" class="oe_inline"
div class="o_row o_row_readonly"
button name="phone_action_blacklist_remove" class="fa fa-ban text-danger" title="This phone number is blacklisted for SMS Marketing. Click to unblacklist." type="object" context="{'default_phone': mobile}" groups="base.group_user" attrs="{'invisible': [('mobile_blacklisted', '=', False)]}"
field name="mobile" widget="phone" string="Mobile"

regards



Avatar
Verwerfen
Beste Antwort

Hi,

You can use position="move" to the field from one position to another. Suppose if you need to move the field mobile, after a field phone, then you can achieve as follows:

field name="phone" position="after"

field name="mobile" position="move"

See more in: Change Position Of Field, Page or Group Using Move Attribute


Thanks

Avatar
Verwerfen
Beste Antwort

Try this way:
record id="view_crm_lead_form_inherit" model="" rel="ugc">ir.ui.view">
field name="name">CRM Lead Custom Field
field name="model">crm.lead
field name="type">form
field name="inherit_id" ref="crm.crm_lead_view_form"/>
field name="arch" type="xml">
xpath expr="//group[@name='lead_detail']" position="inside">
field name="phone" position="after">
field name="mobile" widget="phone" string="Mobile"/>
/field>
/xpath>
xpath expr="//group[@name='opportunity_partner']" position="replace"/>
/field>
/record>

In the above code, we use the xpath expression to target the main group with the name 'lead_detail'. Within this group, we use the position="after" attribute to position the 'Mobile' field after the 'Phone' field.

Additionally, we use another xpath expression to replace the entire group with the name 'opportunity_partner', effectively removing it from the view.

Make sure to adjust the group names ('lead_detail' and 'opportunity_partner') in the code snippet to match the actual group names used in your CRM Lead form view.

After applying these changes and upgrading your custom module, the 'Mobile' field should appear below the 'Phone' field in the main section of the CRM Lead form view, and it will no longer be present in the 'Extra Info' tab.

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Nov. 24
4144
1
Mai 23
2956
1
März 23
3269
1
Mai 25
2088
1
Apr. 25
3161