In my py file
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
In my py file
I got the answer
please update xml file like this
Hi,
Update your code like this,
<field name="marital"/>
<field name="marital_id" invisible="1"/>
<field name="wedding_annniv" attrs="{'invisible':[('marital_id', '!=', True)]}"/>
<field name="spouse_name" attrs="{'invisible':[('marital_id, '!=', True)]}"/>
<field name="spouse_dob" attrs="{'invisible':[('marital_id', '!=', True)]}"/>
In the Python,
marital = fields.Selection([
('single', 'Single'),
('married', 'Married'),
('cohabitant', 'Legal Cohabitant'),
('widower', 'Widower'),
('divorced', 'Divorced')], string='Marital Status', default='single')
marital_id = fields.Boolean(string='Status')
@api.onchange('marital')
def _marital(self):
if self.marital and self.marital == 'married':
self.marital_id = True
else:
self.marital_id = False
Thanks
Thanks for your answer
But i got error like this
EOL while scanning string literal
('', 1, 41, "{'invisible':[('marital_id, '!=', True)]}")
None" while parsing /opt/odoo/odoo11/addons/hr/views/hr_views.xml:34, near
<record id="view_employee_form" model="ir.ui.view">
<field name="marital"/>
<field name="marital_id" invisible="1"/>
<field name="wedding_annniv" attrs="{'invisible':[('marital_id', '!=', True)]}"/>
<field name="spouse_name" attrs="{'invisible':[('marital_id, '!=', True)]}"/>
<field name="spouse_dob" attrs="{'invisible':[('marital_id', '!=', True)]}"/>
i changed xml file like this
I changed python file like this
@api.onchange('marital')
def _onchange_marital(self):
if self.marital and self.marital == "married" :
marital_id = True
else :
marital_id = False
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
1
سبتمبر 22
|
4163 | ||
|
1
سبتمبر 18
|
4144 | ||
|
1
سبتمبر 18
|
9396 | ||
Invoices' Links not working
تم الحل
|
|
2
مارس 18
|
5432 | |
|
2
يوليو 24
|
2245 |