Update to latest version - Error

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v9_0/copy_old_fees_field_data.py”, line 11, in execute
frappe.db.sql(“”“update tabFees set grand_total=total_amount where grand_total = 0.0"”")
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 163, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 250, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 50, in defaulterrorhandler
raise errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘grand_total’ in ‘where clause’”)

Same problem here. Any solution?

Not yet :confused: :confused:

Just had this happen to me today. I think I found the solution:

Using this as a reference point: Upgrading ERPNext Version 6-9

frappe@ERP:~/frappe-bench$ bench mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 177
Server version: 10.1.25-MariaDB-1~xenial mariadb.org binary distribution
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [1bd3e0294da19198]> ALTER TABLE tabFees ADD COLUMN grand_total DOUBLE(9,2);
Query OK, 0 rows affected (0.26 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [1bd3e0294da19198]> \q
Bye
frappe@ERP:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.

[…]

INFO:bench.utils:sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started

Hope this helps!

2 Likes

Nice, welldone.

Hello @anomaly0617

Thanks for the reply.

Had the same problem and fixed with the solution above. However, got a new error: frappe.exceptions.ValidationError: Search field customer_items is not valid

Here is the traceback:

File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main                                                                                
  "__main__", fname, loader, pkg_name)                                                                                                              
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code                                                                                           
  exec code in run_globals                                                                                                                          
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>                                                     
  main()                                                                                                                                            
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main                                                         
  click.Group(commands=commands)(prog_name='bench')                                                                                                 
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__                                         
  return self.main(*args, **kwargs)                                                                                                                 
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main    rv = self.invoke(ctx)                    
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke                                          
  return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                           
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke                                          
  return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                           
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke                                           
  return ctx.invoke(self.callback, **ctx.params)                                                                                                    
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke                                           
  return callback(*args, **kwargs)                                                                                                                  
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func                                    
  return f(get_current_context(), *args, **kwargs)                                                                                                  
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func                                                         
  ret = f(frappe._dict(ctx.obj), *args, **kwargs)                                                                                                   
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 217, in migrate                                                          
  migrate(context.verbose, rebuild_website=rebuild_website)                                                                                         
File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 33, in migrate                                                                 
  frappe.model.sync.sync_all(verbose=verbose)                                                                                                       
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 19, in sync_all                                                             
  sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)                                                                        
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 45, in sync_for                                                             
  reset_permissions=reset_permissions, for_sync=True)                                                                                               
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path                                         
  ignore_version=ignore_version, reset_permissions=reset_permissions)                                                                               
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 131, in import_doc                                                 
  doc.insert()                                                                                                                                      
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 245, in insert                                                          
  self.run_post_save_methods()                                                                                                                      
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 827, in run_post_save_methods                                           
  self.run_method("on_update")                                                                                                                      
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 702, in run_method                                                      
  out = Document.hook(fn)(self, *args, **kwargs)                                                                                                    
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 964, in composer                                                        
  return composed(self, method, *args, **kwargs)                                                                                                    
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 947, in runner                                                          
  add_to_return_value(self, fn(self, *args, **kwargs))                                                                                              
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 696, in <lambda>                                                        
  fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)                                                                         
File "/home/frappe/frappe-bench/apps/frappe/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py", line 16, in on_update        
  self.make_custom_fields_for_mappings()                                                                                                            
File "/home/frappe/frappe-bench/apps/frappe/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py", line 48, in make_custom_field
  create_custom_field(mapping.local_doctype, df)                                                                                                    
File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 106, in create_custom_field                   
  "hidden": df.hidden or 0                                                                                                                          
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 245, in insert                                                          
  self.run_post_save_methods()                                                                                                                      
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 827, in run_post_save_methods                                           
  self.run_method("on_update")                                                                                                                      
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 702, in run_method                                                      
  out = Document.hook(fn)(self, *args, **kwargs)                                                                                                    
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 964, in composer                                                        
  return composed(self, method, *args, **kwargs)                                                                                                    
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 947, in runner                                                          
  add_to_return_value(self, fn(self, *args, **kwargs))                                                                                              
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 696, in <lambda>                                                        
  fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)                                                                         
File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 51, in on_update                              
  validate_fields_for_doctype(self.dt)                                                                                                              
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 384, in validate_fields_for_doctype                       
  validate_fields(frappe.get_meta(doctype, cached=False))                                                                                           
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 635, in validate_fields                                   
  check_search_fields(meta, fields)                                                                                                                 
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 529, in check_search_fields                               
  frappe.throw(_("Search field {0} is not valid").format(fieldname))                                                                                
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 319, in throw                                                                 
  msgprint(msg, raise_exception=exc, title=title, indicator='red')                                                                                  
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 309, in msgprint                                                              
  _raise_exception()                                                                                                                                
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 282, in _raise_exception                                                      
  raise raise_exception(encode(msg))                                                                                                                
frappe.exceptions.ValidationError: Search field customer_items is not valid        

Thanks!