from odoo.tests import TransactionCase class TestServerAction(TransactionCase): """Lifecycle of the generated contextual server action.""" def test_unlink_removes_server_action(self): """Deleting a template removes its generated server action, instead of leaving an orphaned action browsing a dead record.""" template = self.env["docuseal.template"].create({ "name": "Contract", "template_id": 123, }) template.action_create_server_action() action = template.server_action_id self.assertTrue(action.exists()) template.unlink() self.assertFalse(action.exists())