Skip to Content
Menu
This question has been flagged
2 Replies
4910 Zobrazenia

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
Zrušiť
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
Zrušiť

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

Autor

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

Autor 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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
3
feb 24
39530
1
jan 24
14259
2
mar 18
5063
0
jan 18
3178
2
feb 24
25637