frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.32k stars 7.27k forks source link

Sales invoice import on erpnext cloud returns error - quantity cannot be zero #41724

Closed alex-g-s closed 5 months ago

alex-g-s commented 5 months ago

Information about bug

I have ordered a trial ERPNext cloud system. I have entered 3-4 invoices (sales invoices) with already existing data (product, customer,etc). I tried to test the import of transactions from file.

So I do the following steps: Navigate to import/export: https://testYYYY.erpnext.com/app/data-import/

I chosed to download template with data (5 transactions and all required fields). Then I clear the values in ID column in order during the import to create new sales invoice transactions. Whatever format I choose (csv or Excel) , when I upload the file back I get the following error:

"Invalid Quantity Row #1: Item quantity cannot be zero"

Traceback (most recent call last): File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 149, in import_data doc = self.process_doc(doc) ^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 251, in process_doc return self.insert_record(doc) ^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 270, in insert_record new_doc.insert() File "apps/frappe/frappe/model/document.py", line 291, in insert self.run_before_save_methods() File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods self.run_method("validate") File "apps/frappe/frappe/model/document.py", line 962, in run_method out = Document.hook(fn)(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/model/document.py", line 1322, in composer return composed(self, method, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/model/document.py", line 1304, in runner add_to_return_value(self, fn(self, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/model/document.py", line 959, in fn return method_object(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 266, in validate super().validate() File "apps/erpnext/erpnext/controllers/selling_controller.py", line 29, in validate super().validate() File "apps/erpnext/erpnext/controllers/stock_controller.py", line 52, in validate super().validate() File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 171, in validate self.validate_qty_is_not_zero() File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 1094, in validate_qty_is_not_zero frappe.throw( File "apps/frappe/frappe/__init__.py", line 645, in throw msgprint( File "apps/frappe/frappe/__init__.py", line 610, in msgprint _raise_exception() File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception raise exc erpnext.controllers.accounts_controller.InvalidQtyError: Row #1: Item quantity cannot be zero

Then I decided to download all fields and upload them back (just clear the ID field in order to create new sales invoice the same as downloaded one with the template). I get the same error:

"Invalid Quantity Row #1: Item quantity cannot be zero"

The quantity fields are filled with values. Seems like the error is somewhere else reflecting at the end of this error.

Module

selling

Version

latest ERPNext cloud: ERPNext: v15.26.0 (HEAD) Frappe Framework: v15.29.0 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

Traceback (most recent call last):
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 149, in import_data
    doc = self.process_doc(doc)
          ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 251, in process_doc
    return self.insert_record(doc)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 270, in insert_record
    new_doc.insert()
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 266, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 29, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 52, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 171, in validate
    self.validate_qty_is_not_zero()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 1094, in validate_qty_is_not_zero
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
erpnext.controllers.accounts_controller.InvalidQtyError: Row #1: Item quantity cannot be zero
Nihantra-Patel commented 5 months ago

Again, check the qty in file, everything is working fine. No problems were encountered in the latest version 15.

https://github.com/frappe/erpnext/assets/141945075/8b667182-369a-4ab1-bd54-42c6347850f8