I have a custom module and i am trying to modify "Time off module" by inheriting it ! and I want to add an item in the existing Many2One (dropdown) field. what would be the syntax to do that? for both python and XML. The model name is "hr.leave" and the field is "holiday_status_id", I want to add one more element in the dropdown as "CL" or "Casual leave".
You need to create a new hr.leave.type
record and make sure it is not hidden when applying the domain.
You can use a data file, I modified the Sick Time Off
to add a new leave type:
<record id="holiday_new_type" model="hr.leave.type">
<field name="name">New type</field>
<field name="allocation_type">no</field>
<field name="color_name">red</field>
<field name="validity_start" eval="time.strftime('%Y-01-01')"/>
<field name="leave_notif_subtype_id" ref="hr_holidays.mt_leave_sick"/>
<field name="responsible_id" ref="base.user_admin"/>
</record>
You can check the hr_holidays data file for more examples.