ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Opening Invoice Tool Error Please select Customer first

I’ve been trying to use the Opening Invoice tool to record the sales invoices for my accounts receivable opening balance. i have used it with purchase invoices with out any problem but when i try it with sales invoice type, i get an error “Please select customer first”. I have selected the correct customer as my entry for the party field but the error persist.

Here is the error from the log:

Data:
{
“items”: [
{
“uom”: “Nos”,
“rate”: 114877.39,
“qty”: “1”,
“conversion_factor”: 1.0,
“item_name”: “Opening Invoice Item”,
“description”: “Opening Invoice Item”,
“income_account”: "191000 - Temporary Opening ",
“cost_center”: “Main”,
“doctype”: “Sales Invoice Item”
}
],
“is_opening”: “Yes”,
“set_posting_time”: 1,
“company”: “My Company”,
“cost_center”: null,
“due_date”: “2021-07-27”,
“posting_date”: “2021-07-27”,
“customer”: null,
“is_pos”: 0,
“doctype”: “Sales Invoice”,
“update_stock”: 0,
“department”: null,
“branch”: null,
“currency”: “PHP”,
“letter_head”: null
}

Exception:
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py”, line 203, in start_import
doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 237, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 960, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 858, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1147, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1130, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 852, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 80, in validate
self.set_tax_withholding()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 160, in set_tax_withholding
tax_withholding_details = get_party_tax_withholding_details(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py”, line 33, in get_party_tax_withholding_details
party_type, party = get_party_details(inv)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py”, line 26, in get_party_details
frappe.throw(_(“Please select {0} first”).format(party_type))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 427, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 406, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Please select Customer first

As you can see, the customer is “null”. I don’t know how to fix this.