From cfa7913a0bced85524ce703c09d70b505124a088 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Tue, 9 Jun 2026 08:18:31 +0700 Subject: [PATCH] refactor: simplify payment action overrides by removing redundant hr_expense_class base class lookups --- models/account_payment.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/models/account_payment.py b/models/account_payment.py index fba0216..023d3d3 100644 --- a/models/account_payment.py +++ b/models/account_payment.py @@ -27,10 +27,6 @@ class AccountPayment(models.Model): payment._synchronize_to_moves({'amount', 'deduction_line_ids', 'amount_substract'}) # 2. Standard confirmation logic with bypass flag for internal writes - hr_expense_class = self._get_hr_expense_base_class() - if hr_expense_class: - return super(hr_expense_class, self.with_context(skip_expense_lock=True)).action_post() - return super(AccountPayment, self.with_context(skip_expense_lock=True)).action_post() def _synchronize_to_moves(self, changed_fields): @@ -95,11 +91,7 @@ class AccountPayment(models.Model): def action_cancel(self): # Propagate bypass flag during cancel - hr_expense_class = self._get_hr_expense_base_class() - if hr_expense_class: - res = super(hr_expense_class, self.with_context(skip_expense_lock=True)).action_cancel() - else: - res = super().action_cancel() + res = super(AccountPayment, self.with_context(skip_expense_lock=True)).action_cancel() for payment in self: if payment.expense_ids: @@ -110,11 +102,7 @@ class AccountPayment(models.Model): def action_draft(self): # Propagate bypass flag during reset to draft - hr_expense_class = self._get_hr_expense_base_class() - if hr_expense_class: - res = super(hr_expense_class, self.with_context(skip_expense_lock=True)).action_draft() - else: - res = super().action_draft() + res = super(AccountPayment, self.with_context(skip_expense_lock=True)).action_draft() for payment in self: if payment.expense_ids: