"Invalid field name: compact_item_print" when opening invoices, quotations, etc [v12]

Hello All,

I posted about this in the v12 mega thread, but thought I would also create a separate topic. When opening or creating invoices, quotations, delivery, notes, or any doctype with an item listing, I receive the message “Invalid field name: compact_item_print”. Not really sure how to proceed with v12.

Anybody else experiencing this bug,

I am not aware of the steps you have took to get this error.
But you can try to disable this field from Print Settings and check.

@harshit-30 It is really peculiar.

I restored to one of my v11 snapshots. From there I upgraded to v12:

  • git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*" in frappe-bench/apps/erpnext
  • bench switch-to-branch version-12 --upgrade
  • bench update --patch

Compact_item_print is not listed as a field under Print Settings. Chrome console displays the following:

Traceback (most recent call last):
File “/home/admin/mvogel.frappe/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/admin/mvogel.frappe/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/admin/mvogel.frappe/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/desk/form/load.py”, line 33, in getdoc
doc = frappe.get_doc(doctype, name)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/init.py”, line 734, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/document.py”, line 69, in get_doc
return controller(*args, **kwargs)
File “/home/admin/mvogel.frappe/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 38, in init
super(SalesInvoice, self).init(*args, **kwargs)
File “/home/admin/mvogel.frappe/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 25, in init
super(AccountsController, self).init(*args, **kwargs)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/document.py”, line 104, in init
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/document.py”, line 162, in load_from_db
self.set(df.fieldname, children)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/base_document.py”, line 130, in set
self.extend(key, value)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/base_document.py”, line 167, in extend
self.append(key, v)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/base_document.py”, line 144, in append
value = self._init_child(value, key)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/base_document.py”, line 183, in init_child
value = get_controller(value[“doctype”])(value)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/document.py”, line 113, in init
super(Document, self).init(kwargs)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/model/base_document.py”, line 64, in init
File “/home/admin/mvogel.frappe/apps/erpnext/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py”, line 12, in setup
File “/home/admin/mvogel.frappe/apps/erpnext/erpnext/controllers/print_settings.py”, line 15, in print_settings_for_item_table
doc.flags.compact_item_print = cint(frappe.db.get_single_value(“Print Settings”, “compact_item_print”))
File “/home/admin/mvogel.frappe/apps/frappe/frappe/database/database.py”, line 558, in get_single_value
(‘Invalid field name: {0}’).format(frappe.bold(fieldname)), self.InvalidColumnName)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/init.py”, line 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/admin/mvogel.frappe/apps/frappe/frappe/init.py”, line 346, in msgprint
File “/home/admin/mvogel.frappe/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
InvalidColumnName: Invalid field name: compact_item_print

Not sure what I might have done to cause this. It appears the Compact Item Print setting in Print Settings hasn’t existed for several versions now.

I reverted to v11 and everything functions normally.
If anyone has any suggestions, I would be beyond grateful.

Thank you,

Is there possibly another way for me to disable Compact Item Print?

In a little bit of a pinch,

Found this… not sure if this means anything.

Any update on how to solve this?

No, good to hear that I am not alone though :slight_smile: .

Same Here !!

Yes the database seems to have no compact_item_print entry

MariaDB [2e43900160fc4542]> select * from tabSingles where doctype = 'Print Settings';
| doctype        | field                          | value                      |
| Print Settings | add_draft_heading              | 1                          |
| Print Settings | allow_page_break_inside_tables | 0                          |
| Print Settings | allow_print_for_cancelled      | 0                          |
| Print Settings | allow_print_for_draft          | 1                          |
| Print Settings | attach_view_link               | 1                          |
| Print Settings | creation                       | 2019-05-16 09:12:19.877770 |
| Print Settings | docstatus                      | 0                          |
| Print Settings | font                           | Default                    |
| Print Settings | font_size                      | 0                          |
| Print Settings | idx                            | 0                          |
| Print Settings | modified                       | 2019-05-16 09:12:24.118615 |
| Print Settings | modified_by                    | Administrator              |
| Print Settings | name                           | Print Settings             |
| Print Settings | owner                          | Administrator              |
| Print Settings | parent                         | NULL                       |
| Print Settings | parentfield                    | NULL                       |
| Print Settings | parenttype                     | NULL                       |
| Print Settings | pdf_page_size                  | A4                         |
| Print Settings | print_style                    | Modern                     |
| Print Settings | repeat_header_footer           | 1                          |
| Print Settings | send_print_as_pdf              | 1                          |
| Print Settings | with_letterhead                | 1                          |
22 rows in set (0.00 sec)

So this code may no longer apply

so what is your suggestion ?

should we comment this code or what ?

I suggest ask Frappe to review this Issues · frappe/erpnext · GitHub

In my v11 instance print_taxes_with_zero_amount is also gone from Print Settings.

The UI, code and database may need rework for these two Print Settings fields:

Thank you @clarkej,

Issue has been opened. Feel free to add @Mahmoud_Ghoneem and @Justine_Jay_Caneza.

3rd day now without accessing SO,QO, & SINV

even after commenting that line !!!

any idea to help my team to work ?

I remember adding the custom field to print settings manually to fix the problem

1 Like

thanks @Kar_M it works !!

thanks @clarkej @maxvogel


Would you mind elaborating how you solved this issue?

in print settings doctype creat a new custom field with same name “compact_item_print” and make its type as check

thats all

in V12 you cannot add custom filed to single doctype, so how can i add custom filed in Print Settings Doctype?

Any solution? as @YGhoul said it’s not possible to accomplish the given solution in v12.