Merge pull request #30317 from deepeshgarg007/opening_gl_validation

fix: P&L account validation on cancellation
This commit is contained in:
Deepesh Garg 2022-03-21 10:45:07 +05:30 committed by GitHub
commit 1daaf6be2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,7 +136,7 @@ class GLEntry(Document):
def check_pl_account(self):
if self.is_opening=='Yes' and \
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss":
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss" and not self.is_cancelled:
frappe.throw(_("{0} {1}: 'Profit and Loss' type account {2} not allowed in Opening Entry")
.format(self.voucher_type, self.voucher_no, self.account))