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

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

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

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
lis 24
4359
1
kvě 23
3214
1
bře 23
3512
3
srp 25
2222
1
kvě 25
2505