Problem with printing invoice

Hello,

I want to print an invoice but this error pop up.

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 111, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 78, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/account_invoice/invoice.py", line 2608, in execute
    return super().execute(ids, data)
  File "/trytond/report/report.py", line 165, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/modules/account_invoice/invoice.py", line 2586, in _execute
    result = super(InvoiceReport, cls)._execute(records, data, action)
  File "/trytond/report/report.py", line 181, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/modules/account_invoice/invoice.py", line 2603, in render
    return super().render(*args, **kwargs)
  File "/trytond/report/report.py", line 276, in render
    data = template.generate(**report_context).render()
  File "/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/genshi/output.py", line 59, in encode
    return _encode(''.join(list(iterator)))
  File "/genshi/output.py", line 581, in __call__
    for event in stream:
  File "/genshi/core.py", line 291, in _ensure
    for event in stream:
  File "/genshi/filters/i18n.py", line 688, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/base.py", line 641, in _include
    for event in stream:
  File "/genshi/template/base.py", line 601, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/base.py", line 291, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/genshi/template/eval.py", line 160, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 4, in <Expression 'Linux_X86_64'>
  File "/genshi/template/eval.py", line 294, in lookup_name
    val = cls.undefined(name)
  File "/genshi/template/eval.py", line 397, in undefined
    raise UndefinedError(key, owner=owner)
genshi.template.eval.UndefinedError: "Linux_X86_64" not defined

Fault: "Linux_X86_64" not defined

I’m running trytond and tryton on the same virtual machine for testing purpose, and I’ve installed cups-pdf to show the printed files. This is my invoice configuration.

I’ve checked send it to printer directly and unchecked but it not worked. And this happen when setting type document as “OpenDocument Text”

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 111, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 78, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/account_invoice/invoice.py", line 2608, in execute
    return super().execute(ids, data)
  File "/trytond/report/report.py", line 165, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/modules/account_invoice/invoice.py", line 2586, in _execute
    result = super(InvoiceReport, cls)._execute(records, data, action)
  File "/trytond/report/report.py", line 181, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 310, in convert
    subprocess.check_call(cmd, timeout=timeout)
  File "/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'soffice'

Fault: [Errno 2] No such file or directory: 'soffice'

Help please :slight_smile:

You need to install libreoffice soffice to render document text as pdf. Document type should be open document text.

Maybe this should work:

apt-get install libreoffice

Thanks German, it worked, now it try to open from temporal folder. I cannot open from this location, the file was create, it exist! so I don’t know for what reason this message.

If a move the file to my home folder it open fine

Screenshot from 2020-12-05 16-05-46

Try to create a new invoice to avoid the cache on database and start trytond and tryton with same user.

Seems more like a local issue than server issue actually.

Yeah it looks like a local issue. Do you know how to change where to save the temporary files ? I think if I creates other tmp folder in home’s user this issues will gone

We use the tempfile Python module which can be customized with environment variables like ‘TMPDIR’, ‘TEMP’, ‘TMP’.

Thanks Cédric, it worked adding “TMP” enviroment variable.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.