feat: add action_recompute_state wrapper and update button to trigger state and payment status recalculation

This commit is contained in:
Suherdy Yacob 2026-04-06 11:00:20 +07:00
parent d436c336b9
commit 6689999b17
2 changed files with 6 additions and 1 deletions

View File

@ -163,3 +163,8 @@ class HrExpenseSheet(models.Model):
raise UserError(_("You cannot refuse this report because it has Posted Realizations. Revert them first."))
realizations.write({'state': 'draft'})
return super().action_refuse_expense_sheets()
def action_recompute_state(self):
""" Public wrapper to allow triggering recompute from a button. """
self._compute_state()
self._compute_payment_state()

View File

@ -148,7 +148,7 @@
<attribute name="statusbar_visible">draft,submit,approve,post,wait_post,done</attribute>
</xpath>
<xpath expr="//header" position="inside">
<button name="_compute_state"
<button name="action_recompute_state"
string="Recompute Status"
type="object"
groups="base.group_erp_manager"