Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hr_expense_advance_clearing/models/hr_expense_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def _check_constraint_clearing_amount(self):
and x.advance_sheet_residual <= 0.0
and x.state in ["submit", "approve", "post"]
)
if sheets_x: # Advance Sheets with no residual left
if sheets_x and not self.env.context.get("skip_check_clearing_amount", False):
# Advance Sheets with no residual left
raise ValidationError(
_("Advance: %s has no amount to clear")
% ", ".join(sheets_x.mapped("name"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _validate_over_return(self):
)

def action_create_payments(self):
self = self.with_context(skip_check_clearing_amount=True)
if self._context.get("hr_return_advance", False):
self._validate_over_return()
self.expense_post_return_advance()
Expand Down