Thanks Anand. But it didn't work either. See below:
ro...@doris3to4:/var/www/frappe-bench/sites# ../env/bin/frappe --ipython erp-prod
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
Type "copyright", "credits" or "license" for more information.
IPython 2.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: frappe.delete_doc('Custom Field', 'Purchase Order Item-cost_center')
In [2]: frappe.delete_doc('Custom Field', 'Purchase Receipt Item-cost_center')
In [3]: quit
ro...@doris3to4:/var/www/frappe-bench/sites# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 63
Server version: 5.5.38-MariaDB-1~precise-log
mariadb.org binary distribution
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use sirius_erp_prod;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [sirius_erp_prod]> select name, fieldname from `tabCustom Field` where name like '%cost%';
+-----------------------------------+-------------+
| name | fieldname |
+-----------------------------------+-------------+
| Purchase Order Item-cost_center | cost_center |
| Purchase Receipt Item-cost_center | cost_center |
+-----------------------------------+-------------+
2 rows in set (0.00 sec)
MariaDB [sirius_erp_prod]> quit
Bye
ro...@doris3to4:/var/www/frappe-bench/sites# ../env/bin/frappe --latest erp-prod
Executing frappe.patches.v4_0.update_custom_field_insert_after in erp-prod (sirius_erp_prod)
Traceback (most recent call last):
File "../env/bin/frappe", line 9, in <module>
load_entry_point('frappe==4.1.0', 'console_scripts', 'frappe')()
File "/var/www/frappe-bench/apps/frappe/frappe/cli.py", line 53, in main
return run(fn, parsed_args)
File "/var/www/frappe-bench/apps/frappe/frappe/cli.py", line 83, in run
out = globals().get(fn)(**args)
File "/var/www/frappe-bench/apps/frappe/frappe/cli.py", line 67, in new_fn
return fn(*args, **new_kwargs)
File "/var/www/frappe-bench/apps/frappe/frappe/cli.py", line 417, in latest
frappe.modules.patch_handler.run_all()
File "/var/www/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
if not run_single(patchmodule = patch):
File "/var/www/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 50, in run_single
return execute_patch(patchmodule, method, methodargs)
File "/var/www/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 66, in execute_patch
frappe.get_attr(patchmodule + ".execute")()
File "/var/www/frappe-bench/apps/frappe/frappe/patches/v4_0/update_custom_field_insert_after.py", line 18, in execute
cf.save()
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 194, in save
self.run_post_save_methods()
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 414, in run_post_save_methods
self.run_method("on_update")
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 387, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 463, in composer
return composed(self, method, *args, **kwargs)
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 446, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/var/www/frappe-bench/apps/frappe/frappe/model/document.py", line 381, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/var/www/frappe-bench/apps/frappe/frappe/core/doctype/custom_field/custom_field.py", line 38, in on_update
validate_fields_for_doctype(self.dt)
File "/var/www/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 186, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype).get("fields"))
File "/var/www/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 244, in validate_fields
check_unique_fieldname(d.fieldname)
File "/var/www/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 199, in check_unique_fieldname
frappe.throw(_("Fieldname {0} appears multiple times in rows {1}").format(fieldname, ", ".join(duplicates)))
File "/var/www/frappe-bench/apps/frappe/frappe/__init__.py", line 206, in throw
msgprint(msg, raise_exception=exc)
File "/var/www/frappe-bench/apps/frappe/frappe/__init__.py", line 203, in msgprint
_raise_exception()
File "/var/www/frappe-bench/apps/frappe/frappe/__init__.py", line 187, in _raise_exception
raise raise_exception, msg
frappe.exceptions.ValidationError: Fieldname cost_center appears multiple times in rows 17, 41
ro...@doris3to4:/var/www/frappe-bench/sites#