This question has been flagged

I am using Odoo v8 and my client wants to have the accrual function on leave management. Unfortunately the current apps for that haven't been ported to v8 or v9

                   https://github.com/OCA/hr/tree/7.0 and

                   https://github.com/OCA/hr/issues/224

Is there a way i can script an automated action that creates an Allocation Request , then links the allocation request to a particular Leave Type and Employee Tags and adds a particular number of days eg 1.75? This should be run every month and if possible make it approved.

Any help will be appreciated.


Avatar
Discard
Best Answer

You can write script in Automated action, which will find the start_date in Employee's contract (which we will assume as joining date of the employee) and will compare the date on which scheduler is running,

And accordingly we will compute the number of days to be allocated to employee, if leaves has to be assigned on pro-rata basis, or else we will allocate overall leaves which are configured in leaves master.

The Solution you are thinking of is absolutely possible..

Avatar
Discard
Author

Could you help me with the script or the process? i am still new to Odoo programming.

<record model="ir.cron" id="account_asset_cron">

<field name="name">Generate Asset Entries</field>

<field name="interval_number">1</field>

<field name="interval_type">months</field>

<field name="numbercall">-1</field>

<field name="doall" eval="False"/>

<field name="model" eval="'account.asset.asset'"/>

<field name="function" eval="'_cron_generate_entries'"/>

<field name="args" eval="'()'" />

</record>

You can refer to this cron job, where you can set the interval in days, months, years.

In model you should use model, for which you want to create the automated action.

In function tag you should use the method, which should get triggered in this cron job.

If you are using version uptil 8, you can test the cron job by setting the next scheduled datetime from front-end.

If you are using v9, you have button on cron job record to trigger the action.