I am getting an error whenever I try to open the print format on most of the doc_types where I have made my custom printformats. These formats were running fine in earlier versions but had started showing the above server error after migrating to v13. If I close the error dialog the print format is displayed correctly. This is the complete error.
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 68, in application
response = frappe.api.handle()
File "apps/frappe/frappe/api.py", line 55, in handle
File "apps/frappe/frappe/handler.py", line 31, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 68, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1214, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/printing/page/print/print.py", line 16, in get_print_settings_to_show
df.default = print_settings.get(fieldname)
AttributeError: 'NoneType' object has no attribute 'default'
"doctype": "Delivery Note",
"exception": "AttributeError: 'NoneType' object has no attribute 'default'"
Any pointers would be helpful to debug.
@arpanzen your table Print settings is missing some attributes . did you moved your data from 12 to 13 via a backup and restore ?
Thanks for your reply.
I transferred data from V12 production server to V12 to a cloud server, via backup and restore and then migrated the cloud server to V13.
I have tried to copy the HTML print format and pasted it by new name but it still doesnt work. Could it be related to VUE. I am still getting errors on bench update
UNRESOLVED_IMPORT : 'vue/dist/vue.js'
@arpanzen the problem is that the database was rebuilt using your data from v12 . some fields are not the same , so the app will throw errors when it can’t find some fields that suppose to be in v13 . have you tried a bench build and migrate ?
Yes I have already tried build and migrate. If i delete existing print formats and make new ones from the existing html code then also i am getting same error.
@arpanzen is it happening to all doctypes to print or only the the one you are trying to print ?
It is happening to most of the doctypes but one or two are still working fine and when i close the dialog after this error the data is displayed correctly on the printformat. So it is some hidden setting that is causing the issue.
@arpanzen try this . open print settings folder from terminal (apps/frappe/frappe/printing/doctype/print_setting) and then open print_setting.json and search for modified . change the time to a recent one like this morning . save the file and run a bench migrate . that will force the table to rebuild . I hope it’s the table that is missing some field otherwise it will be all the other doctypes .
I did as you had suggested, and then bench migrate and bench build. Everything went well, no errors except UNRESOLVED_IMPORT : ‘vue/dist/vue.js’
When all done. Tried the print formats but it still throws same error.
@arpanzen a temporary solution : open the file apps/frappe/frappe/printing/page/print/print.py and comment the line that makes error or put it in a try except . it’s not very important . I tried it
Thanks, the workaround removed the error. Hope it does not affect anything.
Thanks again for your help. Do let me know if you could suggest something later for a permanent fix. I have been migrating our companies data from V5 till now and would not like to do away with it.
@arpanzen don’t worry about the code . it’s for getting some default settings , the print will just work fine without them . for a permanent solution you need to know where exactly the df variable come from . its table is missing something and needs to be rebuilt.