Hi, im trying to import our historical sales invoice, but i keep getting this error.
Hi,
Where is the data being imported from, and how was it prepared. It looks like it fails on row 2 , which would be the first row containing data. That could mean one or more columns contains data in the wrong format or type. Does the traceback have anything useful ?
it is imported from Excel sheet.
I exported my current data to see the template, then when I imported it, it failed
Traceback looks like this:
Traceback (most recent call last):
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 125, in import_data
doc = self.process_doc(doc)
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 191, in process_doc
return self.insert_record(doc)
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 210, in insert_record
new_doc.insert()
File “apps/frappe/frappe/model/document.py”, line 261, in insert
self.run_before_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1052, in run_before_save_methods
self.run_method(“validate”)
File “apps/frappe/frappe/model/document.py”, line 941, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1259, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1241, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/document.py”, line 938, in fn
return method_object(*args, **kwargs)
File “apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 96, in validate
super(SalesInvoice, self).validate()
File “apps/erpnext/erpnext/controllers/selling_controller.py”, line 32, in validate
super(SellingController, self).validate()
File “apps/erpnext/erpnext/controllers/stock_controller.py”, line 38, in validate
super(StockController, self).validate()
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 166, in validate
self.validate_all_documents_schedule()
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 270, in validate_all_documents_schedule
self.validate_invoice_documents_schedule()
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 257, in validate_invoice_documents_schedule
self.set_payment_schedule()
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 1605, in set_payment_schedule
d.payment_amount * self.get(“conversion_rate”), d.precision(“base_payment_amount”)
TypeError: unsupported operand type(s) for *: ‘NoneType’ and ‘float’
If the export was Exel file type, Blank template and no new data was added to the columns, it should import without difficulty. Were there any custom fields in the exported data? Or was data added to columns?
I exported 5 rows, excel file type.
Then deleted the infos, and inserted the info that i want to import.
I don’t have any customs fields as much as I know. Im new to ERP, exploring it for 2 mons only.
best guess is that the data entered into one of the columns is not in the format that ERPNext expects. Dates, currencies are sometimes problem. If you added data to more than one column, try adding to only one at a time to see if the import works or fails to pinpoint .
hi, still cannot figure our the problem.
Would you be able to export the Excel sheet with your new data to a .csv file and upload that to ERPNext?
If you try to migrate the “Payment Due Date” then it searches based on the settings details for other columns like: Invoice Portion (Payment Schedule), Mode of Payment (Payment Schedule), Outstanding (Payment Schedule), Paid Amount (Payment Schedule), Payment Amount (Payment Schedule, Invoice Portion (Payment Schedule) , Due Date (Payment Schedule).
And if you don’t pass them correctly the following code fails and gives the error:
if not (
automatically_fetch_payment_terms
and allocate_payment_based_on_payment_terms
and self.linked_order_has_payment_terms(po_or_so, fieldname, doctype)
):
for d in self.get("payment_schedule"):
if d.invoice_portion:
d.payment_amount = flt(
grand_total * flt(d.invoice_portion) / 100, d.precision("payment_amount")
)
d.base_payment_amount = flt(
base_grand_total * flt(d.invoice_portion) / 100, d.precision("base_payment_amount")
)
d.outstanding = d.payment_amount
elif not d.invoice_portion:
d.base_payment_amount = flt(
d.payment_amount * self.get("conversion_rate"), d.precision("base_payment_amount")
)
else:
self.fetch_payment_terms_from_order(po_or_so, doctype)
self.ignore_default_payment_terms_template = 1
I removed the payment due date (in my case was not actually required, and I solved the error).