Skip to Content
Menu
This question has been flagged
3 Replies
4755 Zobrazenia

i read about hidding the create, and the create and Edit options at the many2one fields and i try this solution by creating a custom addon and tested adding other fields at sales:


<record id="view_crm_lead_form" model="ir.ui.view">
<field name="name">view.crm.lead.form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" options="{'no_quick_create':True}" string="Customer" context="{'res_partner_search_mode': type == 'opportunity' and 'customer' or False, 'default_name': contact_name or partner_name,.... etc />
</xpath>
</field>
</record>

just take the original field and add the option 'no_quick_create' and replace it, where is my mistake?

Avatar
Zrušiť
Best Answer

Hi,

also add 'no_create_edit': True in your options list to prevent create contact/partner from Lead Form View.

{'no_open':True,'no_create':True,'no_edit':True, no_create_edit': True, 'no_quick_create': True}

and add crm, base Module in the depends 


Thanks & Regards,

Sunny Sheth


Avatar
Zrušiť
Autor

hi, i add the drm to the depends, and the custom addon its working because i copy and pase your options and warning me about the missing ' in no_create_edit, after that i update and upgrade and still showing the create, maybe for testing i try to change the string attribute for changing the name and dont work either. Im pointing to the wrong location?, the wrong form?, the wrong field?.

im doing this because in the main crm page, when the user create a new oportunity by the "create" button force it to select a valid customer

try with widget="selection"

Autor

yes, changin it like i was trying, but if i cant change my options or the string atributes this will not work too, thanks for all.

Best Answer
<record id="crm_lead_inherit_tree_view" model="ir.ui.view">
<field name="name">crm.lead.inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/group/group[@name='opportunity_partner']/field[@name='partner_id']" position="attributes">
<attribute name="options">{'no_create_edit': True, 'no_create':True}</attribute>
</xpath>
</field>
</record>
Avatar
Zrušiť
Best Answer

Hi,

instead of replacing and adding field again, try using position attributes and set the option attributes as this.


{'no_open':True,'no_create':True,'no_edit':True}

Avatar
Zrušiť
Autor

&#60;record id="view_crm_lead_form_c" model="ir.ui.view"&#62;

&#60;field name="name"&#62;view.crm.lead.form.c&#60;/field&#62;

&#60;field name="model"&#62;crm.lead&#60;/field&#62;

&#60;field name="inherit_id" ref="crm.crm_lead_view_form"/&#62;

&#60;field name="arch" type="xml"&#62;

&#60;xpath expr="//field[@name='partner_id']" position="attributes"&#62;

&#60;attribute name="options"&#62;{'no_open':True,'no_create':True,'no_edit':True}&#60;/attribute&#62;

&#60;/xpath&#62;

&#60;/field&#62;

&#60;/record

here my try, and after upgrade my custom addon still dont working, i need to add some to depends in my manifest like the sale_management for apply the changes?

Related Posts Replies Zobrazenia Aktivita
1
máj 16
6035
2
mar 15
8798
3
jan 25
13210
0
júl 22
2624
1
jan 24
6443