There are a couple of ways to do this. I am not sure if this the best, but I say try this way first and see how it goes.
Create an Asset (or Cash) account called "Roommate Split" or something similar.
I am going to assume that you already have the following accounts:
- "Cash in Wallet" Current Assets Account (or whatever bank account your cash comes from)
- "Groceries" Expense account
Open "Cash in wallet" or your similar account
Hit Split, Record $40 Spend on $20 Groceries Expense and $20 Roommate Split
Hit Split, Record $30 spend on $15 Groceries Expense and $15 spend on Roommate split
Open Roommate Split Account
1. Record $15 Decrease in Groceries Expense account from "Roommate Split" Account
If you look at your balance sheet report (Reports -> Assets & Liabilities -> Balance Sheet) , you should have $20 in the Roommate split account.
If you look at your Profit & Loss report for the period described (Reports -> Income & Expenses -> Profit & Loss), you should see $50 in Groceries Expenses. You might have to hit report options, and change start/end date on report for it to be correct time period. I believe it defaults to current years P&L, so most likely have more than $50 in groceries for the year.
When your roommate gives you $20 for groceries, Open "Cash in Wallet" and record $20 received from "Roommate Split" Account. After that transaction, the "Roommate Split" Account should be zero.
I hope this helps.