frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
20.4k stars 7.08k forks source link

Purchase Invoice with Multiple Expense Accounts #40106

Open HelpERPNext opened 6 months ago

HelpERPNext commented 6 months ago

Information about bug

When creating a purchase invoice that has two line items. Each line item has a different expense account attached to it. When I go to submit the invoice I get the error:

Could not find Against: 802.1 - Expense Account 1 - Demo Company, 802.2- Expense Account 2 - Demo Company

How do I attach multiple line items with different a different expense account for each line item?

Module

accounts

Version

ERPNext 15

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No Logs Available
agritheory commented 6 months ago

This usually means that those accounts are mistyped / don't exist. Most likely, this is an input error of some kind. Confirm that the accounts you want to use exist in the chart of accounts.

HelpERPNext commented 6 months ago

The accounts do exist in my coa. I have tried setting the account type to Expense Account, or left blank.

I have even tried indirect expense but it only lets me select a single account as an indirect expense.

agritheory commented 6 months ago

You cannot enter multiple values in a link field. How would the system know how much to allocate to each account given the input of "802.1 - Expense Account 1 - Demo Company, 802.2- Expense Account 2 - Demo Company"? It (correctly) doesn't know that what you mean by that text. The text "802.1 - Expense Account 1 - Demo Company, 802.2- Expense Account 2 - Demo Company" is not a valid expense account, but " "802.1 - Expense Account 1 - Demo Company" and "802.2- Expense Account 2 - Demo Company" are valid expense accounts.

Your document requires two lines with the same item but different expense accounts - let's assume you are entering the receivable qty of (1) indivisible unit ("Item1"), at a price of $1.00 per unit.

Item Account Stock Ledger Debit Credit
Item1 802.1 - Expense Account 1 - Demo Company 1 @ $0.50 $0.50
Item1 802.2- Expense Account 2 - Demo Company 1 @ $0.50 $0.50
Accounts Payable $1.00
HelpERPNext commented 6 months ago

They are two different line items service A and Service B both from the same vendor.

agritheory commented 6 months ago

That's a different problem than:

How do I attach multiple line items with different a different expense account for each line item?

HelpERPNext commented 6 months ago

What's the problem then. If I put both services under the same expense account it works but if each one have a different expense account it gives me the error listed above.

agritheory commented 6 months ago

You're thinking of this backwards. ERPNext is an inventory management system with accounting. The account is secondary to the Item/ "service item". There isn't a way to change this, it is fundamental to how ERPs work.

What's the problem then. If I put both services under the same expense account it works but if each one have a different expense account it gives me the error listed above.

You have to use a separate line for each item:account allocation you wish to persist to the General Ledger.