From 1da5fb05f918b6846f7f3e5dba57ce725005ab12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Fri, 3 May 2024 01:11:46 -0300 Subject: [PATCH] [IMP] l10n_br_sped_base: done/reset to draft --- l10n_br_sped_base/models/sped_declaration.py | 28 +++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/l10n_br_sped_base/models/sped_declaration.py b/l10n_br_sped_base/models/sped_declaration.py index 73ea0104687b..c3c457892819 100644 --- a/l10n_br_sped_base/models/sped_declaration.py +++ b/l10n_br_sped_base/models/sped_declaration.py @@ -97,6 +97,12 @@ def button_flush_registers(self): self.ensure_one() self.env["l10n_br_sped.mixin"]._flush_registers(self._get_kind(), self.id) + def button_done(self): + self.state = "done" + + def button_draft(self): + self.state = "draft" + def button_create_sped_file(self): self.ensure_one() sped_txt = self._generate_sped_text() @@ -150,9 +156,29 @@ def _append_view_header(self, form): ) header.append( E.button( - name="button_create_sped_file", + name="button_done", type="object", states="draft", + string="Set to Done", + # class="oe_highlight", + groups="l10n_br_fiscal.group_manager", + ) + ) + header.append( + E.button( + name="button_draft", + type="object", + states="done", + string="Reset to Draft", + # class="oe_highlight", + groups="l10n_br_fiscal.group_manager", + ) + ) + header.append( + E.button( + name="button_create_sped_file", + type="object", + states="done", string="Generate SPED File", # class="oe_highlight", groups="l10n_br_fiscal.group_manager",