[SOLVED] Data Import error in Stock Entry

Hello,
I am running the latest ERPNext develop branch on localhost and see the following error while trying to import some data for the “Stock Entry” doctype. Could someone please help me resolve this? Thanks. I also mentioned it as a github issue.

Traceback (most recent call last):
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/core/doctype/data_import/importer.py", line 395, in upload
    doc.insert()
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 222, in insert
    self.run_before_save_methods()
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 869, in run_before_save_methods
    self.run_method("validate")
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 765, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 1040, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 1023, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/model/document.py", line 759, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/username/.erpnext/frappe-py2/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 46, in validate
    self.validate_item()
  File "/home/username/.erpnext/frappe-py2/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 139, in validate_item
    for_update=True)
  File "/home/username/.erpnext/frappe-py2/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 573, in get_item_details
    (args.get('item_code'), self.company, nowdate()), as_dict = 1)
  File "/home/username/.erpnext/frappe-py2/apps/frappe/frappe/database.py", line 195, in sql
    self._cursor.execute(query, values)
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/connections.py", line 893, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/connections.py", line 1103, in _read_query_result
    result.read()
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/connections.py", line 1396, in read
    first_packet = self.connection._read_packet()
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/connections.py", line 1059, in _read_packet
    packet.check_error()
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/connections.py", line 384, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/username/.erpnext/frappe-py2/env/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
InternalError: (1054, u"Unknown column 'i.stock_uom' in 'field list'")

I solved this by copying the erpnext and frappe directories (both updated to the newest ERPNext using bench update --reset) from an earlier working installation to the new machine. It seems local copies of working erpnext repos are not exactly reproducible, so copying from a previous installation is the most efficient along with the system setup.

The corresponding github issue has also been closed.

I am facing the same problem but the solution @paramjitrohits has given doesnot work. Kindly help.

-Amit

Hi @Amit_Saxena, my comment is not exactly a solution. I had a previous working copy of ERPNext and managed to get by, by copying the apps folder to my new install and using bench update. If you have such a previous working copy, I suggest you try using the apps folder from there. Please raise this as a github issue or here on the forum if you need further help (as this post has been marked SOLVED).

In any case, this problem seems more likely if you already have a database. If this is your first install, try bench switch-to-develop to switch to develop branch (as that is where most fixes are, including possibly to the above error) and then do a bench update --reset. Hope this helps.