Project filter in General Ledger


I’m unable to filter by project in general ledger for a given Party (type: customer) and Party Name. Basically, if we have multiple projects ongoing for the same client, we would like to be able to look at the project-wise GL for the client to differentiate where the payment/invoicing is done. Am I missing something?


The culprit seems to be in the following file:

def pl_must_have_cost_center(self):
		if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
			if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
				frappe.throw(_("{0} {1}: Cost Center is required for 'Profit and Loss' account {2}. Please set up a default Cost Center for the Company.")
					.format(self.voucher_type, self.voucher_no, self.account))
			from erpnext.accounts.utils import get_allow_cost_center_in_entry_of_bs_account
			if not get_allow_cost_center_in_entry_of_bs_account() and self.cost_center:
				self.cost_center = None
			if self.project:
			 	self.project = None

The last 2 lines seem to be setting the project code to none for journal entry/sales invoice/etc. If I comment the lines out, then the project code shows up on submitting the invoice/journal entry.


Thank you very very much for posting this!

You have no idea how much this issue has distressed me. I had to come up with a work around to get past this limitation as I could not understand why this restriction was in place.

However, may I suggest that this be offered as an option instead of a default.
If you look at V11, it comes with an option under the account settings :
‘Allow Cost Center In Entry of Balance Sheet Account’

The same would be applicable in this case where the user would choose this option as you have done where it would be

Allow Project In Entry of Balance Sheet Account

That way, those people who have operated successfully over the many years without having the project entry in their balance sheet accounts will not be surprised as doing this action by default will result in many accountants being not too happy

Thanks again

@Eli Thank you for your message. Glad to have been of help :slight_smile:
I agree with you that the option to enable this in the account settings would be ideal.
Will try and send a pull request for it when I get a chance.

I think this is still an issue in v13. Balance sheet accounts do not have project code in the GL entry even if project code is specified in the purchase invoice items table. Project code seems to be there for sales invoices however.