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
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
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.
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
3
lis 24
|
4149 | ||
|
1
maj 23
|
2977 | ||
how to inherit form in odoo 16
Rozwiązane
|
|
1
mar 23
|
3282 | |
|
1
maj 25
|
2124 | ||
|
1
kwi 25
|
3201 |