Merge pull request #24375 from deepeshgarg007/plv_cost_center_ignore_v13

fix: Ignore group cost center validation for period closing voucher
This commit is contained in:
Deepesh Garg 2021-01-14 19:47:56 +05:30 committed by GitHub
commit c96ea002a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,9 +137,10 @@ class GLEntry(Document):
frappe.throw(_("{0} {1}: Cost Center {2} does not belong to Company {3}")
.format(self.voucher_type, self.voucher_no, self.cost_center, self.company))
if self.cost_center and _check_is_group():
frappe.throw(_("""{0} {1}: Cost Center {2} is a group cost center and group cost centers cannot be used in transactions""")
.format(self.voucher_type, self.voucher_no, frappe.bold(self.cost_center)))
if not self.flags.from_repost and not self.voucher_type == 'Period Closing Voucher' \
and self.cost_center and _check_is_group():
frappe.throw(_("""{0} {1}: Cost Center {2} is a group cost center and group cost centers cannot
be used in transactions""").format(self.voucher_type, self.voucher_no, frappe.bold(self.cost_center)))
def validate_party(self):
validate_party_frozen_disabled(self.party_type, self.party)