refactor: simplify payment action overrides by removing redundant hr_expense_class base class lookups
This commit is contained in:
parent
5886c62f9d
commit
cfa7913a0b
@ -27,10 +27,6 @@ class AccountPayment(models.Model):
|
|||||||
payment._synchronize_to_moves({'amount', 'deduction_line_ids', 'amount_substract'})
|
payment._synchronize_to_moves({'amount', 'deduction_line_ids', 'amount_substract'})
|
||||||
|
|
||||||
# 2. Standard confirmation logic with bypass flag for internal writes
|
# 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()
|
return super(AccountPayment, self.with_context(skip_expense_lock=True)).action_post()
|
||||||
|
|
||||||
def _synchronize_to_moves(self, changed_fields):
|
def _synchronize_to_moves(self, changed_fields):
|
||||||
@ -95,11 +91,7 @@ class AccountPayment(models.Model):
|
|||||||
|
|
||||||
def action_cancel(self):
|
def action_cancel(self):
|
||||||
# Propagate bypass flag during cancel
|
# Propagate bypass flag during cancel
|
||||||
hr_expense_class = self._get_hr_expense_base_class()
|
res = super(AccountPayment, self.with_context(skip_expense_lock=True)).action_cancel()
|
||||||
if hr_expense_class:
|
|
||||||
res = super(hr_expense_class, self.with_context(skip_expense_lock=True)).action_cancel()
|
|
||||||
else:
|
|
||||||
res = super().action_cancel()
|
|
||||||
|
|
||||||
for payment in self:
|
for payment in self:
|
||||||
if payment.expense_ids:
|
if payment.expense_ids:
|
||||||
@ -110,11 +102,7 @@ class AccountPayment(models.Model):
|
|||||||
|
|
||||||
def action_draft(self):
|
def action_draft(self):
|
||||||
# Propagate bypass flag during reset to draft
|
# Propagate bypass flag during reset to draft
|
||||||
hr_expense_class = self._get_hr_expense_base_class()
|
res = super(AccountPayment, self.with_context(skip_expense_lock=True)).action_draft()
|
||||||
if hr_expense_class:
|
|
||||||
res = super(hr_expense_class, self.with_context(skip_expense_lock=True)).action_draft()
|
|
||||||
else:
|
|
||||||
res = super().action_draft()
|
|
||||||
|
|
||||||
for payment in self:
|
for payment in self:
|
||||||
if payment.expense_ids:
|
if payment.expense_ids:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user