I have check for the api call for sales invoice entry but getting the following error with trace back…
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 119, in handle
“data”: frappe.get_doc(data).insert().as_dict()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 192, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 666, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 870, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 660, 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 57, in validate
super(SalesInvoice, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 33, in validate
super(SellingController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 17, in validate
super(StockController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 34, in validate
self.set_missing_values(for_validate=True)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 242, in set_missing_values
self.debit_to = get_party_account(“Customer”, self.customer, self.company)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/party.py”, line 175, in get_party_account
frappe.throw(_(“Please select a Company”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 319, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Please select a Company
I have already pass the company name there but this showing an error…
following is my request object,
API URL: api/resource/Sales Invoice
Request:
{
“data”:{
“company”:“Demo Company”,
“posting_date” : “2017-10-14”,
“due_date”: “2017-10-30”,
“customer”:“350”,
“items”: [
{
“item_name”: “test”,
“description”: “test”,
“uom”: “Nos”,
“income_account”: “Sales - DC”,
“cost_center”: “Main - DC”
}
],
“customer_name”: “snd snd”,
“naming_series”: “SINV-”,
“debit_to”: “Cash - DC”
}
}