Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Printing Sales orders and Invoices when Print Designer App is installed #359

Open
edardev opened this issue Sep 19, 2024 · 5 comments

Comments

@edardev
Copy link

edardev commented Sep 19, 2024

Hi everyone,

I'm encountering several issues related to printing invoices on Frappe/ERPNext Version 15. Specifically, I'm having trouble with the following:

  • Printing invoices and generating PDFs
  • Setting up Print Formats
  • The new Print Designer app

When using the default print format for Sales Orders ("Sales Order PD v2"), it's throwing errors and failing to generate a proper output. However, when I remove this format, I'm able to view and print the PDF, but the resulting format is messy and unsuitable for my prospective clients.

The Print Designer app also has several bugs related to formatting. I'm unable to achieve the desired print output, and I can't delete elements from the canvas. Additionally, PDF generation isn't functioning as expected.

Here are the versions of the installed apps:

  • Frappe CRM: v2.0.0-dev
  • Ecommerce Integrations: v1.17.0
  • ERPNext: v15.36.0
  • Frappe Framework: v15.41.0
  • Frappe HR: v15.29.0
  • Frappe Insights: v3.0.0
  • Payments: v0.0.1
  • Print Designer: v1.2.0 AND v1.4.2

Has anyone else encountered similar issues or found a solution? Any advice or guidance would be greatly appreciated!

Thanks in advance.

image

image

image

@mualala
Copy link

mualala commented Sep 22, 2024

me too, And web console print:
Error: Worker was destroyed

@edardev edardev changed the title Issues with Printing Invoices and Print Designer on Frappe/ERPNext Version 15 Issues with Printing Invoices when Print Designer App is install Sep 23, 2024
@edardev edardev changed the title Issues with Printing Invoices when Print Designer App is install Issues with Printing Invoices when Print Designer App is installed Sep 23, 2024
@edardev
Copy link
Author

edardev commented Oct 1, 2024

I tested the latest "main" branch, and the issue with deleting items has been resolved, similar to the "develop" branch. However, we're still encountering issues when printing new sales orders, sales invoices, and other documents using the "Print Designer" app.

Identified Issues:

  1. Default Templates: It seems that default templates are not being generated, which prevents them from being located or used during the printing and preview process.

image
image
image
image

We switched back and forth between the "develop" and "main" branches but are still encountering printing issues, even after creating new print formats and setting them as the default. Occasionally, creating a new custom user permission for the preview JPG file resolves the issue temporarily, allowing us to print, but it suddenly stops working again without any clear reason.

image
image

Request for Assistance

I appreciate the creator's ongoing efforts to address this issue, as I've noticed recent updates and GitHub commits. However, we are still experiencing challenges.

Could you kindly assist in further investigating these problems? Any guidance on ensuring that default templates are properly generated and resolving the recurring permission errors would be greatly appreciated.

Thank you for your time and support!

@edardev edardev changed the title Issues with Printing Invoices when Print Designer App is installed Issues with Printing Sales orders and Invoices when Print Designer App is installed Oct 1, 2024
@akramalhajari444
Copy link

akramalhajari444 commented Oct 14, 2024

Me too i have the same error...
‏‏لقطة الشاشة (158)

@edardev
Copy link
Author

edardev commented Oct 19, 2024

Hi everyone,

I wanted to follow up on the issues with printing invoices and the Print Designer in Frappe/ERPNext Version 15. It seems like several users are encountering similar challenges, especially when it comes to customizing print formats and generating PDFs correctly. Could we get an update on any potential fixes or workarounds for this issue? It would be helpful to know if there's a timeline for a resolution or if there are specific logs or details that we could provide to assist with debugging. Thanks for your attention to this matter!

Traceback with variables (most recent call last):
  File "apps/frappe/frappe/core/doctype/file/utils.py", line 368, in attach_files_to_document
    file.insert(ignore_permissions=True)
      doc = <PDPrintFormat: Sales Order PD v2>
      event = 'on_update'
      attach_fields = [<Attach ImageDocField: print_designer_preview_img parent=Print Format>]
      df = <Attach ImageDocField: print_designer_preview_img parent=Print Format>
      value = '/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'
      unattached_file = None
      file = <File: unsaved>
  File "apps/frappe/frappe/model/document.py", line 285, in insert
    self.run_method("before_insert")
      self = <File: unsaved>
      ignore_permissions = True
      ignore_links = None
      ignore_if_duplicate = False
      ignore_mandatory = None
      set_name = None
      set_child_names = True
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <File: unsaved>
      method = 'before_insert'
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
      self = <File: unsaved>
      args = ()
      kwargs = {}
      hooks = []
      method = 'before_insert'
      doc_events = {'*': {'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date', 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'], 'after_rename': ['frappe.desk.notifications.clear_doctype_notifications'], 'on_cancel': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply'], 'on_trash': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions'], 'on_update_after_submit': ['frappe.workflow.doctype.workflow_action.workflow_action.process_w...
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7fd10e041080>
      compose = <function Document.hook.<locals>.compose at 0x7fd10e0416c0>
      f = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <File: unsaved>
      method = 'before_insert'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7fd10e0413a0>
      fn = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
      hooks = ()
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
      self = <File: unsaved>
      args = ()
      kwargs = {}
      method_object = <bound method File.before_insert of <File: unsaved>>
      method = 'before_insert'
  File "apps/frappe/frappe/core/doctype/file/file.py", line 104, in before_insert
    self.save_file(content=self.get_content())
      self = <File: unsaved>
  File "apps/frappe/frappe/core/doctype/file/file.py", line 539, in get_content
    with open(file_path, mode="rb") as f:
      self = <File: unsaved>
      file_path = './demo.menteware.com/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'
builtins.FileNotFoundError: [Errno 2] No such file or directory: './demo.menteware.com/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'

@kavindraherat
Copy link

kavindraherat commented Nov 19, 2024

I'm having a similar issue so bumping this post:

  File "apps/frappe/frappe/website/serve.py", line 20, in get_response
    response = renderer_instance.render()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 529, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 95, in get_html
    self.update_context()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 163, in update_context
    data = self.run_pymodule_method("get_context")
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 223, in run_pymodule_method
    return method(self.context)
  File "apps/frappe/frappe/www/printview.py", line 56, in get_context
    body = get_rendered_template(
  File "apps/frappe/frappe/www/printview.py", line 162, in get_rendered_template
    format_data_map[df.get("fieldname")] = df
AttributeError: 'str' object has no attribute 'get'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants