Sales Invoice SPIN/18-19/059: Either debit or credit amount is required for Rounded Off - SPIN

Hi,

Here’s the problem.

When you make an invoice with Include Payment, Update Stock and stuff (POS Invoice) and so long as the Rounding Adjustment is a negative value, the invoice is going through. However if the Rounding Adjustment is a Positive Value, you get the following error.

I’m guessing that the code is missing functions to move post the positive value as you submit the invoice.

Error message after my signature.

Thanks

Hi @eliyaskhan18

Did you sort out this error?? I am also getting this error message. Any help would be greatly appreciated.

Thanks!

Same here, I have this issue since V11, but it also happens for negative rounding (not systematically).
I’m investigating.
ERPNext and Frappe v.11.1.5
Python 3.5 env

OK I think I got it
in erpnext/accounts/general_ledger.py function make_round_off_gle
In v10

 round_off_gle.update({
		"account": round_off_account,
		"debit_in_account_currency": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,
		"credit_in_account_currency": debit_credit_diff if debit_credit_diff > 0 else 0,
		**"debit": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,**
		"credit": debit_credit_diff if debit_credit_diff > 0 else 0,
		"cost_center": round_off_cost_center,
		"party_type": None,
		"party": None,
		"against_voucher_type": None,
		"against_voucher": None
 })

in v11

	for d in gl_map:
	if d.account == round_off_account:
		round_off_gle = d
		if d.debit_in_account_currency:
			**debit_credit_diff -= flt(d.debit_in_account_currency)**
		else:
			debit_credit_diff += flt(d.credit_in_account_currency)
		round_off_account_exists = True
[....]
 round_off_gle.update({
	"account": round_off_account,
	"debit_in_account_currency": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,
	"credit_in_account_currency": debit_credit_diff if debit_credit_diff > 0 else 0,
	**"debit": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,**
	"credit": debit_credit_diff if debit_credit_diff > 0 else 0,
	"cost_center": round_off_cost_center,
	"party_type": None,
	"party": None,
	"against_voucher_type": None,
	"against_voucher": None
})

In my case, debit_credit_diff and debit_in_account_currency are equal at first, so debit_credit_diff -= flt(d.debit_in_account_currency) makes debit_credit_diff = 0
“debit”: abs(debit_credit_diff) if debit_credit_diff < 0 else 0
debit, then, equals 0 which is unauthorized.

See commit #15140 rounding off fixes and conversion fix (#15140) · frappe/erpnext@3523b77 · GitHub

What’s the correct way to handle this ?

I am also facing same issue. any workaround for this? can any one from Frappe Team confirm? @umair

@eliyaskhan18, @sethu, @MelBohard, @asanodaria, Please find Pull Request link for the same.
https://github.com/frappe/erpnext/pull/17091#issue-266184793