Hi everybody,
I'm new to odoo, and I created my custom module for contract.
I change the view to update my new field base on the selected resource. My code:
View:
<field name="working_hours" position="replace">
<field name="working_hours"
on_change="on_change_working_hours(working_hours)"/>
</field>
Python code:
@api.onchange('working_hours')
def on_change_working_hours(self, working_hours):
if working_hours:
res_calendar = self.env['resource.calendar'].search([('id', '=', working_hours)])
if res_calendar:
self.expected_working_hours = res_calendar.expected_working_hours
But when changing the field 'working_hours', I got errror:
raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: hr.contract()
How can I update my code?
Thank you.
Hai Vu,
What is the type of the field expected_working_hours ?