Skip to Content
Menu
This question has been flagged
2 Replies
4635 Views

Hi Odoo users,

I want to add a button that skips the applicant to the last stage 'HIRED'. Adding this button would need to be something like

I copied this code to a certain extent from the CRM pipeline that has a similar button but I don't understand where the object, my "action_set_hired" should be added. In the CRM pipeline button it is named action_set_won_rainbowman but I cannot find this anywhere within Odoo.

I have many more wishes of buttons to add to different modules, but can't seem to get any to work. I am missing something. Could someone help me?


Avatar
Discard
Best Answer

Hi,

You can define a function as follows:

<button name="action_hired" string="Hired" type="object" class="oe_highlight"/>

def action_hired(self):
hired_stage = self.env['hr.recruitment.stage'].search([('name', '=', 'Hired')])
if hired_stage:
self.stage_id = hired_stage.id

Thanks

Avatar
Discard

i have searched using the name, which is not a recommended way, hope it give you some insights

Author

Hi Niyas,
Seems easier said than done. I am not an expert sorry, but where should I even add such code? I can't put this in the view hr.applicant as this is Python code if I am not mistaken. Or can't I do this in Odoo but do I have to do this in the server?

if you are customizing system from custom module, you can inherit the model in python file and add the above code, if you are doing from ui in debug mode, create a server action(from debug mode) that executes python code and paste this code and take the id of the created action and set the ID as name of the button in xml

Author Best Answer

The code used is

button name="action_set_archived_rainbowman" string="Mark Archived" type="object" class="oe_highlight" attrs="{'invisible': [('active', '=', False),('emp_id', '=', False)]}"/>

Avatar
Discard
Related Posts Replies Views Activity
3
Feb 24
38981
1
Jan 24
13892
2
Mar 18
4842
0
Jan 18
2948
2
Feb 24
25313