summaryrefslogtreecommitdiff
path: root/fixco_custom/models/account_payment.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-02-23 09:56:11 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-02-23 09:56:11 +0700
commita74cf187f1e25edc18b7718c53af9f74554cfed8 (patch)
treeb5ec5cd2fd68a7dea6f0026ea869063f670f53f4 /fixco_custom/models/account_payment.py
parent8bba994b80718a078ec24ade3b1cdf03eac8c0ff (diff)
parent233662316ed9b108271f5f4aacb1fcc0b05be63a (diff)
Merge branch 'main' of bitbucket.org:altafixco/fixco-addons
pull
Diffstat (limited to 'fixco_custom/models/account_payment.py')
-rw-r--r--fixco_custom/models/account_payment.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/fixco_custom/models/account_payment.py b/fixco_custom/models/account_payment.py
index 41a2ce5..8f36de6 100644
--- a/fixco_custom/models/account_payment.py
+++ b/fixco_custom/models/account_payment.py
@@ -5,6 +5,12 @@ from odoo.exceptions import UserError
class AccountPayment(models.Model):
_inherit = 'account.payment'
+ def action_multi_reset_to_draft(self):
+ for payment in self:
+ if payment.state != 'posted':
+ raise UserError("Only posted payments can be reset to draft.")
+ payment.action_draft()
+
@api.constrains('journal_id')
def set_default_journal_id(self):
for rec in self: