Skip to content

Commit

Permalink
Merge pull request #32635 from ruthra-kumar/fix_tax_or_charges_acc_up…
Browse files Browse the repository at this point in the history
…dating_voucher_outstanding

fix: Integrity Error on PLE while submitting sales invoice
  • Loading branch information
ruthra-kumar committed Oct 19, 2022
2 parents 96b4211 + 8f42e7f commit f844097
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
16 changes: 16 additions & 0 deletions erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3228,6 +3228,22 @@ def test_batch_expiry_for_sales_invoice_return(self):

self.assertTrue(return_si.docstatus == 1)

def test_sales_invoice_with_payable_tax_account(self):
si = create_sales_invoice(do_not_submit=True)
si.append(
"taxes",
{
"charge_type": "Actual",
"account_head": "Creditors - _TC",
"description": "Test",
"cost_center": "Main - _TC",
"tax_amount": 10,
"total": 10,
"dont_recompute_tax": 0,
},
)
self.assertRaises(frappe.ValidationError, si.submit)


def get_sales_invoice_for_e_invoice():
si = make_sales_invoice_for_ewaybill()
Expand Down
7 changes: 6 additions & 1 deletion erpnext/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,12 @@ def update_voucher_outstanding(voucher_type, voucher_no, account, party_type, pa

# on cancellation outstanding can be an empty list
voucher_outstanding = ple_query.get_voucher_outstandings(vouchers, common_filter=common_filter)
if voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"] and voucher_outstanding:
if (
voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"]
and party_type
and party
and voucher_outstanding
):
outstanding = voucher_outstanding[0]
ref_doc = frappe.get_doc(voucher_type, voucher_no)

Expand Down

0 comments on commit f844097

Please sign in to comment.