JayRam’s excellent suggestion (to debug of the client side) is worth a try too Not able to save Sales Invoice - #3 by JayRam
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/pos.py”, line 597, in submit_invoice
si_doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 893, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 794, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1064, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1047, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 788, 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 74, in validate
super(SalesInvoice, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 39, in validate
super(SellingController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 21, in validate
super(StockController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 76, in validate
self.calculate_taxes_and_totals()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 179, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 16, in init
self.calculate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 33, in calculate
self.set_item_wise_tax_breakup()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 615, in set_item_wise_tax_breakup
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 637, in get_itemised_tax_breakup_html
update_itemised_tax_data(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/init.py”, line 129, in caller
return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/united_arab_emirates/utils.py”, line 17, in update_itemised_tax_data
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision(“total_amount”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 713, in precision
if df.fieldtype in (“Currency”, “Float”, “Percent”):
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/pos.py”, line 619, in save_invoice
si.insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 893, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 794, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1064, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1047, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 788, 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 74, in validate
super(SalesInvoice, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 39, in validate
super(SellingController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 21, in validate
super(StockController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 76, in validate
self.calculate_taxes_and_totals()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 179, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 16, in init
self.calculate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 33, in calculate
self.set_item_wise_tax_breakup()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 615, in set_item_wise_tax_breakup
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 637, in get_itemised_tax_breakup_html
update_itemised_tax_data(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/init.py”, line 129, in caller
return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/united_arab_emirates/utils.py”, line 17, in update_itemised_tax_data
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision(“total_amount”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 713, in precision
if df.fieldtype in (“Currency”, “Float”, “Percent”):
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’
hi, this is the error log i found inside settings. but for quotation window error i couldn’t find the error log…
This may be a language translation issue - to debug on the client would help shed light what is amiss
hi, i did nt understand the solution that you have mentioned.
Hi, i have done the same process… but still i have the same error when trying to include the TAX charges.
how u solved this
This problem is still not resolved. But, i guess it is because of two currency in one company profile. I have ones solved this issue, but another application error pop-up. so i gave up on this program…
do u remember how u solved this .
AttributeError means that there was an Error that had to do with an Attribute request. In general, when you write x.y, y is the purported attribute of x. NoneType means that instead of an instance of whatever Class or Object you think you’re working with, you’ve actually got None. That usually means that an assignment or function call up failed or returned an unexpected result.
mylist = mylist.sort()
The sort() method of a list sorts the list in-place, that is, mylist is modified. But the actual return value of the method is None and not the list sorted. So you’ve just assigned None to mylist. If you next try to do, say, mylist.append(1) Python will give you this error.
@mithun Just checking back in on this, in case you’ve not figured it out. One thing you will want to check is your pricing rules. I ran into this issue with a particular customer record that I had created a custom pricing rule on. The rule was set to “Apply On” “Item Code”, however, I had not defined the specific item-code. So the error I was getting, only happened for that specific client, which lead me to look at the pricing rule I had created.
I see you feel this is related to Sales Tax, so depending on what you’re doing there, you may need to create a sales tax template, if one does not exist.
So, a few questions:
- Does the error only happen with specific customers? Or all of them?
- Do you have a default sales tax template? If so, can you post the settings here?
- Do you have any pricing rules configured? If so, can you post it/them here?
@njb and dear all, I recently installed ERPNext and I’ve the same error when saving quotations. This error is occurring when the Sales Taxes and Charges (Sales Taxes and Charges Template) are added to the quotation.
- This happens to all of the customers
- I have a default tax template (please see the details below)
- No pricing rules configured
Any suggestions?
Has the problem resolved? If yes, can you send me the details?
Thank you for your attention. Log copied below.
09:53:39.265 request.js:300 throttled
09:53:39.268 request.js:300 throttled
09:53:50.464 router.js:54 Uncaught TypeError: Cannot read property ‘startsWith’ of null
at HTMLAnchorElement. (router.js:54)
at HTMLBodyElement.dispatch (jquery.min.js:3)
at HTMLBodyElement.r.handle (jquery.min.js:3)
(anonymous) @ router.js:54
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
09:54:09.024 router.js:54 Uncaught TypeError: Cannot read property ‘startsWith’ of null
at HTMLAnchorElement. (router.js:54)
at HTMLBodyElement.dispatch (jquery.min.js:3)
at HTMLBodyElement.r.handle (jquery.min.js:3)
(anonymous) @ router.js:54
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
09:54:25.375 router.js:54 Uncaught TypeError: Cannot read property ‘startsWith’ of null
at HTMLAnchorElement. (router.js:54)
at HTMLBodyElement.dispatch (jquery.min.js:3)
at HTMLBodyElement.r.handle (jquery.min.js:3)
(anonymous) @ router.js:54
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
09:54:31.911 router.js:54 Uncaught TypeError: Cannot read property ‘startsWith’ of null
at HTMLAnchorElement. (router.js:54)
at HTMLBodyElement.dispatch (jquery.min.js:3)
at HTMLBodyElement.r.handle (jquery.min.js:3)
(anonymous) @ router.js:54
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
09:54:34.980 libs.min.js?ver=1628200020.0:231 Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to Moment.js | Guides for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: true, _useUTC: true, _l: undefined, _i: undefined, _f: undefined, _strict: undefined, _locale: [object Object]
Error
at Function.createFromInputFallback (https://erpnext.nazmuae.com/assets/js/libs.min.js?ver=1628200020.0:231:3368)
at va (https://erpnext.nazmuae.com/assets/js/libs.min.js?ver=1628200020.0:231:21539)
at Sa (https://erpnext.nazmuae.com/assets/js/libs.min.js?ver=1628200020.0:231:22250)
at c (https://erpnext.nazmuae.com/assets/js/libs.min.js?ver=1628200020.0:231:935)
at Function.R [as tz] (https://erpnext.nazmuae.com/assets/js/libs.min.js?ver=1628200020.0:234:3771)
at Object.convert_to_user_tz (https://erpnext.nazmuae.com/assets/js/desk.min.js?ver=1628200020.0:1:277352)
at prettyDate (https://erpnext.nazmuae.com/assets/js/desk.min.js?ver=1628200020.0:1:101159)
at HTMLSpanElement. (https://erpnext.nazmuae.com/assets/js/desk.min.js?ver=1628200020.0:1:202288)
at Function.each (https://erpnext.nazmuae.com/assets/frappe/js/lib/jquery/jquery.min.js:2:2861)
at n.fn.init.each (https://erpnext.nazmuae.com/assets/frappe/js/lib/jquery/jquery.min.js:2:845)
w @ libs.min.js?ver=1628200020.0:231
(anonymous) @ libs.min.js?ver=1628200020.0:231
va @ libs.min.js?ver=1628200020.0:231
Sa @ libs.min.js?ver=1628200020.0:231
c @ libs.min.js?ver=1628200020.0:231
R @ libs.min.js?ver=1628200020.0:234
convert_to_user_tz @ datetime.js:17
prettyDate @ pretty_date.js:5
(anonymous) @ pretty_date.js:86
each @ jquery.min.js:2
each @ jquery.min.js:2
frappe.datetime.refresh_when @ pretty_date.js:85
(anonymous) @ pretty_date.js:92
09:54:51.255 VM7:1 POST https://erpnext.nazmuae.com/api/method/frappe.desk.form.save.savedocs 500 (INTERNAL SERVER ERROR)
(anonymous) @ VM7:1
send @ jquery.min.js:4
ajax @ jquery.min.js:4
frappe.request.call @ request.js:229
frappe.call @ request.js:98
d @ save.js:201
frappe.ui.form.save @ save.js:25
(anonymous) @ form.js:634
Promise.then (async)
(anonymous) @ dom.js:265
frappe.run_serially @ dom.js:263
validate_and_save @ form.js:625
(anonymous) @ form.js:569
save @ form.js:566
Save @ toolbar.js:499
(anonymous) @ page.js:254
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
09:54:51.272 request.js:387 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 21, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 285, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 238, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 961, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 859, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1148, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1131, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 853, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/quotation/quotation.py”, line 26, in validate
super(Quotation, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 31, in validate
super(SellingController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 26, in validate
super(StockController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 100, in validate
self.calculate_taxes_and_totals()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 224, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 20, in init
self.calculate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 37, in calculate
self.set_item_wise_tax_breakup()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 676, in set_item_wise_tax_breakup
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 716, in get_itemised_tax_breakup_html
update_itemised_tax_data(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/init.py”, line 129, in caller
return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/united_arab_emirates/utils.py”, line 29, in update_itemised_tax_data
row.tax_rate = flt(tax_rate, row.precision(“tax_rate”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 859, in precision
if df.fieldtype in (“Currency”, “Float”, “Percent”):
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’
09:54:51.272 request.js:387 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 68, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 31, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 67, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1172, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 21, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 285, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 238, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 961, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 859, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1148, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1131, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 853, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/quotation/quotation.py”, line 26, in validate
super(Quotation, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 31, in validate
super(SellingController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 26, in validate
super(StockController, self).validate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 100, in validate
self.calculate_taxes_and_totals()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 224, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 20, in init
self.calculate()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 37, in calculate
self.set_item_wise_tax_breakup()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 676, in set_item_wise_tax_breakup
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 716, in get_itemised_tax_breakup_html
update_itemised_tax_data(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/init.py”, line 129, in caller
return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/united_arab_emirates/utils.py”, line 29, in update_itemised_tax_data
row.tax_rate = flt(tax_rate, row.precision(“tax_rate”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 859, in precision
if df.fieldtype in (“Currency”, “Float”, “Percent”):
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’
@riyasudheen.mohammed apologies for the delay. Not sure if you’ve figured this one out yet or not, since it’s been so long.
Hi,
Thank you for your attention.
I’ve not yet found a fix for this and we couldn’t use the system.
I would appreciate it if you could help us.
Thank you.
That’s unfortunate. Alright, after reviewing the error it’s basically stating that there is not default float precision (basically, how many decimals do you want the system to round to when doing calculations) set for your system. If you let me know which version of ERPNext you were testing with, I can clue you in. If version 13, go to “Settings/System Settings” and make sure that you have Number format, Float Precision and Currency Precision set under the Date and Number Format grouping.
Then for whatever your default currency is, make sure you have the details configured properly for that currency, including the fraction Units. For example, for the US dollar, the smallest fraction is 1 cent. Which is .01 of a dollar, and so there are a total of 100 units that can make up a dollar.
Test with those two settings and let me know if your error goes away. It’s possible there are some other things at play with your tax setup, but those are the two things I would verify first.
This generic error a lot of times just means there’s something set/not set in the system that is required for the function you’re executing to work.
I’m using version 13, the default currency is AED.
All pointed settings were available except the “Currency Precision”. I changed the “Date Format”, “Time Format” according to my system and added “2” in Currency Precision. The error doesn’t go away. Please see the below image for the previous and current system settings.
I appreciate your support. Thank you.