mntechnique/jmi_erpnext

Daily Sales Invoice - "Address None not Found" error

Closed this issue · 4 comments

When running the Daily Sale Invoice report for "Commercial" customer group, the following error message has been popping up:

image

It first showed up right after the developer team uploaded the new CSV File Generator code to our live server. I 'thought' the error only affected the data for that day you uploaded the new code (July 17, 2018). Now, it has happened again for data on July 20, 2018.

This needs to be investigated. For some reason running the reports for those 2 days generates the same error.

It also generates inconsistent data. For example...
If you setup up the report for all Owners and Individual Customer group and then follow that with the same report and change the customer group to All Customers, one report is very much longer than the other. Even though neither report contains Commercial customers.

There are only Commercial and Individual customers in the database, so I would expect the reports to be the same if for some reason the Commercial customers are not working for that day.

Please fix.

BKM

@bkm888
We did manage to find out the cause of the error report was throwing.
I replicated the same locally,

Problem analysis:
We observed that some of the 'commercial' customers do not have an address and the report requires 'county' in the Sales tax ID column.
hence, the error.

Here we created 2 customers with address/without address.
Our original report was built considering all the customers has 'county'.
Since one customer did not have an address(county) it gave us the exact same error.
problem_analysis

We have added a validation in code wherein if it finds a customer without county it will keep it blank.
solution

Checking if keeping it blank wont cause any problem while updating the csv in Sage50.

Thank you for locating the source of the error. I will investigate the possible side effects on Sage50 and reply in about 2 days.

I very much appreciate your work!
BKM

Is it possible to fix the problem by adding in the missing address fields to the customer/address record and re-running the report, or is the address information the report uses already embedded in each sales invoice?

If it is embedded in each sales invoice, will fixing all of the customer address records prevent the error in the future?

We have found that allowing the "County" field of an address to be left blank will cause problems when Daily Sales Invoice report is later exported to the Sage50 system.

It is better to leave the Error as it was and NOT make code corrections to allow a blank field.

However, if the wording of the error can be altered to make it easier to locate subsequent errors, that would be better.

Thank you - BKM

@bkm888
Yes, fixing of customer address records now will prevent the error in the future.

Invoices that are created now can't be changed.

Also since this error is frappe generated, we cannot change its wordings.