Skip to content

Commit

Permalink
G2P-2242 added proper error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek-Wagh committed Jun 12, 2024
1 parent b499fe5 commit 27443eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion g2p_programs/models/accounting/fund_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class ProgramFundManagement(models.Model):

@api.ondelete(at_uninstall=False)
def _unlink_fund(self):
if self.state == "posted":
count_posted_fund = 0
for record in self:
if record.state == "posted":
count_posted_fund += 1
if count_posted_fund > 0:
raise UserError(_("This fund is already posted and cannot be deleted."))

def post_fund(self):
Expand Down

0 comments on commit 27443eb

Please sign in to comment.