ERPNEXT v12 to v13 upgrade error - invalid field name (Fixed)

On running bench upgrade get the following error

Executing erpnext.patches.v13_0.add_missing_fg_item_for_stock_entry

frappe.database.database.InvalidColumnName: Invalid field name: make_serial_no_batch_from_work_order

going from 12.23.0 to 13.7.0

will need to investigate a bit further.
I note that patches were implemented for FG item in v 13.7.0

i have the same error today

I faced the same. I guess the issue is because make_serial_no_batch_from_work_order field is only added to DB after migration and the patch is trying to check the field in DB which doesn’t exist at that time. You can overcome it by running it below way.

bench migrate --skip-failing

This will skip the failing patch.

bench migrate
Now the patch will execute because the field is now added to the DB.

2 Likes

I run it as a multi site
I thought I had got it through the first site by doing similar.
However main web page would not load and got stuck on an updating message.
Decided to try a restore to 12.23.0 for time being

went back and had another look.’

ran
bench migrate --skip-failing

for each site individually as have multi site setup. it would not do otherwise for all

ran
bench upgrade

all worked OK, and can log in - so far
had already updated bench to 13.7.0 before staring this.

Thanks @kartik this worked for us!

1 Like

Instead of ignoring the patch, one can run the following code in bench console to make it pass:

frappe.reload_doctype('Manufacturing Settings')
frappe.db.commit()
Traceback (most recent call last):
  File "apps/frappe/frappe/desk/doctype/system_console/system_console.py", line 17, in run
    safe_exec(self.console)
  File "apps/frappe/frappe/utils/safe_exec.py", line 72, in safe_exec
    exec(compile_restricted(script), exec_globals, _locals)  # pylint: disable=exec-used
  File "<unknown>", line 1, in <module>
  File "apps/frappe/frappe/utils/safe_exec.py", line 42, in default_function
    raise AttributeError(f"module has no attribute '{key}'")
AttributeError: module has no attribute 'reload_doctype'

You’re trying the “System Console”, which is very different from bench console. bench console is something you run in the command line and needs physical / SSH access to the ERP server.

I understand that but this ‘allow_sales_order_creation_for_expired_quotation’ doesn’t exist in selling settings and system is looking for it on startup which is causing issues