diff --git a/models/account_move.py b/models/account_move.py index b37e754d8547933eee504fdecff3cfdb47da8ab7..5dfbe1591332840bd5fc12265d17899a78d86fda 100644 --- a/models/account_move.py +++ b/models/account_move.py @@ -35,8 +35,12 @@ class ScopAccountMove(models.Model): # ------------------------------------------------------ # ------------------------------------------------------ - # Global functions + # Actions buttons # ------------------------------------------------------ + def reset_bordereau(self): + self.ensure_one() + self.bordereau_id = False + def view_cotiz(self): form_view = self.env.ref( "cgscop_cotisation_cg.invoice_form_scop_cg_inherited" diff --git a/views/account_move.xml b/views/account_move.xml index d9e934c82307b6e1bed99a31fe20ed96dfae3e68..a27e6b0859c6dfa455aa243ed5c279fbb04bdb6f 100644 --- a/views/account_move.xml +++ b/views/account_move.xml @@ -33,6 +33,19 @@ > <attribute name="invisible">True</attribute> </xpath> + <xpath + expr="//header" + position="inside" + > + <button + name="reset_bordereau" + type="object" + string="Détacher du bordereau" + class="btn-warning" + confirm="Valider le détachement du bordereau ?" + attrs="{'invisible': [('bordereau_id', '=', False)]}" + /> + </xpath> <xpath expr="//field[@name='liasse_fiscale_id']" position="replace"> <group>