İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
4622 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

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"

Üretici

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.

En İyi Yanıt
<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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

&#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?

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
May 16
5868
2
Mar 15
8622
3
Oca 25
13028
0
Tem 22
2481
1
Oca 24
6286