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

Hello All,

I have a selection field and another many2one field in odoo10. And i want that when i select only "service" from selection type field then another many2one field visible on the form view. Here i attach my python and xml code.


Python code:-

service_types = fields.Selection([('product', ('Product')),
('service', ('Service'))], string='Services', required=True)
name_rental = fields.Many2one('rental.pet', string="Rental Management")

Xml code:-

<field name="service_types"/>
<field name="name_rental" attrs="{'invisible': [('service_types', '!=', 'service')]}"/>
Avatar
Vazgeç

What is the prob? are you telling the above code is not working ?

Seems error is in your field defination. please correct the tuples of both field.

service_types = fields.Selection([('product', 'Product'),

('service', 'Service')], string='Services', required=True)

please field this field first and check.

En İyi Yanıt

Hello! 
please find the below code with changes

Python code:-

service_types = fields.Selection([('product', 'Product'),
('service', 'Service')], string='Services', required=True)
name_rental = fields.Many2one('rental.pet', string="Rental Management")

Xml code:-

<field name="service_types"/>
<field name="name_rental" attrs="{'invisible': [('service_types', 'not in', 'service')]}"/>

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Eyl 17
3455
2
Kas 18
5656
0
Şub 25
1111
2
Ara 24
1428
0
Tem 24
1184