Let s try this idea ?
Create a new field in the same model class of your status pipeline
is_closed = fields.Boolean('is closed', readonly=True)
@api.onchange('stage_id') # triggered fields
def on_change_stage_id(self):
if self.stage_id == 'closed':
self.is_closed = True
else:
self.is_closed = False
In the corresponding model view:
<odoo>
<record model="ir.ui.view" id="view_mymodel_form_extend">
<field name="name">event.view_mymodel_form_xsb</field>
<field name="model">mymodel.mymodel</field>
<field name="inherit_id" ref="originalmodel.view_originalmodel_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='name']" position="after">
<field name="is_closed" string="is closed" />
</xpath>
...which will display a checkbox in the in your html page.
You can now use the onchange method on this new input field, using jquery code in your custom file: src/user/my_module/static/src/js/disable_edit.js
odoo.define('my_module.disable_edit', function(require) {
"use strict";
$(document).ready(function() {
$("input[name='is_closed']").on('change', function() {
//if($("nav.o_main_navbar>a.o_menu_brand").text()=='Sale')
if (($(this).val == "True")
{
$(".button.o_form_button_edit").hide();
}
else
{
$(".button.o_form_button_edit").show();
}
});
});
});