TypeError: unorderable types error

Hi.

am facing a very strange error and I suspect its a bug. it happens when I try to submit a stock reconciliation.

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 264, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 34, in on_submit
self.update_stock_ledger()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 188, in update_stock_ledger
self.insert_entries(row)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 206, in insert_entries
self.make_sl_entries([args])
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 269, in make_sl_entries
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 33, in make_sl_entries
sle_id = make_entry(sle, allow_negative_stock, via_landed_cost_voucher)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 58, in make_entry
sle.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py”, line 36, in on_submit
process_serial_no(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/serial_no/serial_no.py”, line 191, in process_serial_no
update_serial_nos(sle, item_det)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/serial_no/serial_no.py”, line 335, in update_serial_nos
if sle.is_cancelled == “No” and not sle.serial_no and sle.actual_qty > 0
TypeError: unorderable types: NoneType() > int()

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1007, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 264, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 34, in on_submit
self.update_stock_ledger()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 188, in update_stock_ledger
self.insert_entries(row)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py”, line 206, in insert_entries
self.make_sl_entries([args])
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 269, in make_sl_entries
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 33, in make_sl_entries
sle_id = make_entry(sle, allow_negative_stock, via_landed_cost_voucher)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 58, in make_entry
sle.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1031, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 766, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py”, line 36, in on_submit
process_serial_no(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/serial_no/serial_no.py”, line 191, in process_serial_no
update_serial_nos(sle, item_det)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/serial_no/serial_no.py”, line 335, in update_serial_nos
if sle.is_cancelled == “No” and not sle.serial_no and sle.actual_qty > 0
TypeError: unorderable types: NoneType() > int()

kindly help.
am using

Installed Apps
ERPNext: v11.0.3-beta.30 () (staging)

Frappe Framework: v11.0.3-beta.39 () (staging)

1 Like

kindly anyone help on this issue…
thank you

Open your stock ledger report. Can you see any weird values for actual qty ? It seems like bad value is affecting it.

kindly guide on the steps to followed

I did mysql -u root -p,
entered the password,
executed show databases,
executed use (database name)
then from here entered the commands given but non seems to work for me.

tried

if sle.actual_qty != None:
if sle.is_cancelled == “No” and not sle.serial_no and int(sle.actual_qty) > 0;
didnt work.

tried

if sle.actual_qty != None:

didnt work either

tried

if sle.is_cancelled == “No” and not sle.serial_no and int(sle.actual_qty) > 0;

didnt work either.

kindly guide.

Those are python codes. They won’t work in a mysql terminal
If you meant to reply to my comment, then I wanted you to open Stock Ledger report and see if there were some weird values

thank you,
am looking at the stock ledger now

1 Like

i checked all the report for this year and no weird figure seen only some products with negative values. could this affect ?

No. The problem is that code compared a NULL value (NoneType in Python) with zero which is a valid Integer. So I was thinking that some bad value crept into one of the stock transactions say via Stock Entry or any of the receipts.

kindly help how do i go about this step

How many stock transactions have you done so far ? Stock Entries or Purchase Receipts etc. ?

EDIT : Wait a minute, Check in yout Stock Reconciliation, is any item a serialized item ? Please go through that list again. Because Stock Reconciliation is only for non-serialized items not for serialized items so this involvement of serial_no.py doesn’t seem okay.

material receipt I have 107 transaction
purchase orders are 107 too
material requests are 18.
I dont have any product/item with serial no/batch

how do i add this to my system…?

kindly guide

Here’s the line to edit with your change

To ensure the file is recompiled with your change, first delete the old version:

rm ./apps/erpnext/erpnext/stock/doctype/serial_no/serial_no.pyc

See also Stock Reconciliation-Error on submission-ERPNext: v11.0.3-beta.10 () (staging)

Thank you @clarkej I will try to fix this later though I don’t know much about python