You can do that as below :
Python code:
from odoo import models
class Lead(models.Model):
_inherit = "crm.lead"
def action_set_active(self):
self.stage_id = self._stage_find(domain=[('name', '=', 'Active')]).id
def action_set_inactive(self):
self.stage_id = self._stage_find(domain=[('name', '=', 'Inactive')]).id
Inherited CRM Form view:
<record id="crm_lead_view_form_update" model="ir.ui.view">
<field name="name">crm.lead.view.form.inherit.update</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button name="action_set_active" string="Active" type="object" class="oe_highlight" />
<button name="action_set_inactive" string="Inactive" type="object" class="oe_highlight" />
</xpath>
</field>
</record>