dms icon indicating copy to clipboard operation
dms copied to clipboard

dms_file.py Raises "file name is invalid" Error when trying to print an Invoice

Open peterromao opened this issue 10 months ago • 3 comments

This is on Odoo 16.0-20240216 (Community Edition)

Module

Error shows exception thrown in dms

Describe the bug

Create and confirm invoice. As soon as one tries to send and print or just print the following error is thrown:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 1633, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 133, in retrying result = func() File "/usr/lib/python3/dist-packages/odoo/http.py", line 1660, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/usr/lib/python3/dist-packages/odoo/http.py", line 1774, in dispatch return self.request.registry['ir.http']._dispatch(endpoint) File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 237, in _dispatch response = super()._dispatch(endpoint) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 154, in _dispatch result = endpoint(**request.params) File "/usr/lib/python3/dist-packages/odoo/http.py", line 697, in route_wrapper result = endpoint(self, *args, **params_ok) File "/mnt/extra-addons/reporting-engine/report_xlsx_helper/controllers/main.py", line 52, in report_routes return super().report_routes(reportname, docids, converter, **data) File "/usr/lib/python3/dist-packages/odoo/http.py", line 697, in route_wrapper result = endpoint(self, *args, **params_ok) File "/mnt/extra-addons/reporting-engine/report_xlsx/controllers/main.py", line 49, in report_routes return super().report_routes(reportname, docids, converter, **data) File "/usr/lib/python3/dist-packages/odoo/http.py", line 697, in route_wrapper result = endpoint(self, *args, **params_ok) File "/mnt/extra-addons/various/prt_report_attachment_preview/controllers/report.py", line 157, in report_routes pdf = report_obj.with_context(**context)._render_qweb_pdf( File "/mnt/extra-addons/mis-builder/mis_builder/report/mis_report_instance_qweb.py", line 27, in _render_qweb_pdf return super()._render_qweb_pdf(report_ref, res_ids, data) File "/usr/lib/python3/dist-packages/odoo/addons/account/models/ir_actions_report.py", line 61, in _render_qweb_pdf return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 869, in _render_qweb_pdf self.env['ir.attachment'].create(attachment_vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/addons/hr_expense/models/ir_attachment.py", line 9, in create attachments = super().create(vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_attachment.py", line 23, in create return super().create(vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/mnt/extra-addons/dms/dms/models/ir_attachment.py", line 93, in create records._dms_operations() File "/mnt/extra-addons/dms/dms/models/ir_attachment.py", line 79, in _dms_operations dms_file_model.create( File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 414, in _model_create_multi return create(self, [arg]) File "/mnt/extra-addons/dms/dms/models/dms_file.py", line 620, in create return super(File, self).create(new_vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/mnt/extra-addons/dms/dms/models/dms_security_mixin.py", line 251, in create res = super(DmsSecurityMixin, self.sudo()).create(vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 258, in create threads = super(MailThread, self).create(vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_fields.py", line 670, in create recs = super().create(vals_list) File "", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 415, in _model_create_multi return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/models.py", line 3975, in create records = self._create(data_list) File "/usr/lib/python3/dist-packages/odoo/models.py", line 4227, in _create records._validate_fields(name for data in data_list for name in data['stored']) File "/usr/lib/python3/dist-packages/odoo/models.py", line 1359, in _validate_fields check(self) File "/mnt/extra-addons/dms/dms/models/dms_file.py", line 528, in check_name raise ValidationError(("The file name is invalid."))

To Reproduce

This happens with any invoice

Steps to reproduce the behavior: 1.Create invoice 2.Confirm invoice 3.Print Invoice

Expected behavior The wizzard with the e-mail to send to customer should open or the file should be visible on the customer portal.

Additional context Nothing comes to mind besides the error message.

peterromao avatar Feb 25 '25 21:02 peterromao

I have uninstalled the module and printing is now possible again.

It was the only way to manage to delete a file attachment type directory that was lurking in the database and not letting me print.

It seems one cannot use the attachments in the dms.

Is there any other information I might add that can be useful?

peterromao avatar Feb 25 '25 21:02 peterromao

I have tried to reproduce the error you indicate but it is not possible because the file that is generated does not contain / characters (which would cause the error you indicate).

Image

victoralmau avatar May 02 '25 07:05 victoralmau

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Nov 02 '25 12:11 github-actions[bot]