Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3424 Widoki

Need to remove create and edit option in partner field when the value of sale invoice type is credit. I found one similar answer in odoo forum but its not working

My code is:

<field name="partner_id" position="replace">

 <field name="partner_id" string="bhjk" domain="[('customer','=',True),('sale_invoice_type','=',sale_invoice_type)]"     context="{'search_default_customer':1, 'show_address': 1,'default_sale_invoice_type':sale_invoice_type}" attrs="  {'invisible': [('sale_invoice_type', '=', 'cash')]}" options='{"always_reload": True, "no_create_edit": True}'/>         

 <field name="partner_id" domain="[('customer','=',True),('sale_invoice_type','=',sale_invoice_type)]" context="{'search_default_customer':1, 'show_address': 1,'default_sale_invoice_type':sale_invoice_type}" attrs="{'invisible': [('sale_invoice_type', '=', 'credit')]}" options='{"always_reload": True}'/>

                    </field>

Awatar
Odrzuć
Najlepsza odpowiedź

Hi

Try with following attributes.

options='{"always_reload": True, "no_create_edit": True, "no_create":True}'


if it's not working then the problem is two condition with single field will  not work.

Simple you can add one more field partner_id1 

onchange partner_id1  update partner_id field


<field name="partner_id" position="replace">

 <field name="partner_id" string="bhjk" domain="[('customer','=',True),('sale_invoice_type','=',sale_invoice_type)]"     context="{'search_default_customer':1, 'show_address': 1,'default_sale_invoice_type':sale_invoice_type}" attrs="  {'invisible': [('sale_invoice_type', '=', 'cash')]}" options='{"always_reload": True, "no_create_edit": True}'/>         

 <field name="partner_id1" domain="[('customer','=',True),('sale_invoice_type','=',sale_invoice_type)]" context="{'search_default_customer':1, 'show_address': 1,'default_sale_invoice_type':sale_invoice_type}" attrs="{'invisible': [('sale_invoice_type', '=', 'credit')]}" options='{"always_reload": True}'/>

                    </field>



Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
9
cze 23
12815
2
sty 22
3681
2
gru 21
7607
0
cze 21
1794
0
lut 21
2353