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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
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
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Nov 24
|
4154 | ||
|
1
May 23
|
2988 | ||
|
1
Mar 23
|
3287 | ||
|
1
May 25
|
2130 | ||
|
1
Apr 25
|
3206 |