Tryton - Issues

 

Issue5464

Title Default format of OpenDocument Report
Priority feature Status chatting
Superseder Nosy List risto3
Type Components
Assigned To Keywords
Reviews

Created on 2016-04-07.17:39:18 by risto3, last changed by ced.

Messages
msg32588 (view) Author: [hidden] (risto3) Date: 2017-03-18.18:00:48
I come back to this...
(the last error seems to have been temporal)

I reiterate that editing, for example *.odt in modules/accounts,
and setting the page style format to 'a4' and the language for all text
to 'language neutral' as mentioned below does seem to work fine for me.

BTW, I also tried the following tip
http://www.ocsmag.com/2015/10/17/libreoffice-tip-making-an-a4letter-size-template/

seems okay, but perhaps with headers and footers it is probably better to scale using the real a4 or letter size.

I still believe that tryton could trivially determine (at worse via configuration) the papersize using libpaper's paperconf to be able
to use the right file for the case providing both a4 and letter files.
msg25462 (view) Author: [hidden] (risto3) Date: 2016-04-08.14:00:46
trying to set to language neutral for trial_balance.odt turned out toxique for
my database... giving the following:

16223 22 [2016-04-08 11:49:55,162] ERROR trytond.protocols.dispatcher report.account.trial_balance.execute(*([], {'company': 1, 'start_period': None, 'action_id': 86, 'end_period': None, 'fiscalyear': 2, 'empty_account': False, 'posted': False}, {'date_format': '%d.%m.%Y', 'direct_print': False, 'language': 'fr_FR', 'locale': {'date': '%d.%m.%Y', 'thousands_sep': ' ', 'decimal_point': ',', 'grouping': [3, 0]}, 'company': 1, '_check_access': True, 'company.rec_name': 'xxxxxx', 'email': {}, 'email_print': False, 'groups': [1, 7, 5, 10, 3, 2, 4, 6, 8, 9], 'employee': None, 'language_direction': 'ltr'}), **{}) from 1@::1:36594/xxxxxxx
Traceback (most recent call last):
  File "/opt/local/lib/python2.7/site-packages/trytond/protocols/dispatcher.py", line 162, in dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/opt/local/lib/python2.7/site-packages/trytond/report/report.py", line 143, in execute
    cls.render(action_report, report_context))
  File "/opt/local/lib/python2.7/site-packages/trytond/report/report.py", line 227, in render
    data = rel_report(**report_context).render()
  File "/opt/local/lib/python2.7/site-packages/relatorio/templates/base.py", line 34, in render
    return self.serializer(self.events)
  File "/opt/local/lib/python2.7/site-packages/relatorio/templates/opendocument.py", line 884, in __call__
    for kind, data, pos in stream:
  File "/opt/local/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/opt/local/lib/python2.7/site-packages/genshi/filters/i18n.py", line 690, in __call__
    for kind, data, pos in stream:
  File "/opt/local/lib/python2.7/site-packages/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "/opt/local/lib/python2.7/site-packages/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "/opt/local/lib/python2.7/site-packages/genshi/template/base.py", line 578, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/opt/local/lib/python2.7/site-packages/genshi/template/base.py", line 289, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/opt/local/lib/python2.7/site-packages/genshi/template/eval.py", line 177, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 1, in <Expression u'fiscalyear.rec_name'>
  File "/opt/local/lib/python2.7/site-packages/genshi/template/eval.py", line 310, in lookup_name
    val = cls.undefined(name)
  File "/opt/local/lib/python2.7/site-packages/genshi/template/eval.py", line 413, in undefined
    raise UndefinedError(key, owner=owner)
UndefinedError: "fiscalyear" not defined

Other reports still work okay, but even setting back the original file doesn't appear to fix the problem and needed to rollback the database!!!!
msg25460 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-08.12:21:55
I can no more understand what is the topic of this issue.
If you need support, it is not the right place: http://www.tryton.org/community.html#mailing-lists
msg25459 (view) Author: [hidden] (risto3) Date: 2016-04-08.12:12:06
btw, somewhat related.. I notice now the following:
doc/topics/reports/index.rst:5115:    * Use Liberation fonts (Only necessary if being officially included in
doc/reports.rst:2179:    * Use Liberation fonts (Only necessary if being officially included in

I find no other documentation of this dependency. 

Is it supposed to be in trytond or in one of the modules so I can add fonts/liberation-ttf to it's dependency list...
msg25458 (view) Author: [hidden] (risto3) Date: 2016-04-08.11:37:42
Looking at http://templates.libreoffice.org/?set_language=fr
it mentions:

Important note for template contributors: please be aware that the language setting on the meta data page of your project is language neutral! Otherwise the project is not visible for users with another language setting in their browser. You have to set also "language neutral" in the settings of the releases page and on the page of every release for the same reason. We encourage every developer/contributor to check the (sub-)sites of his project about the correct setting.

I'm giving this a try to see if it resolves anything
msg25456 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-08.11:20:11
On 2016-04-08 10:58, richard wrote:
> grepping I notice mention of 'company/header_A4.odt'
> is this something that could be of service?
> can't seem to located the file currently, though.

This was removed in r 45e423bd93fe
msg25454 (view) Author: [hidden] (risto3) Date: 2016-04-08.10:58:43
grepping I notice mention of 'company/header_A4.odt'
is this something that could be of service?
can't seem to located the file currently, though.
msg25450 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-08.09:26:42
I think it is too much complex to try to change the page size on the fly because as your link show, people could make very complex design.
So for me, it is clear that it should be managed on the template.
The only left open question is if the letter format is a good default?
msg25449 (view) Author: [hidden] (risto3) Date: 2016-04-08.08:14:49
I'm quite unfamiliar with the internals of the reporting facility used in tryton
but as far changing the pagesize in {open,libre}office perhaps something useful can be found by this link:
https://forum.openoffice.org/en/forum/viewtopic.php?f=20&p=379623

for the language:
https://ask.libreoffice.org/en/question/6642/shortcut-for-changing-language/
msg25442 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-07.21:00:12
On 2016-04-07 20:23, richard wrote:
> Administration->Actions->Rapports ?

Yes.

> I take a look, but I believe this is perhaps orthogonal to the feature request
> setting the default papersize (and, as you indicate, the language as well).

But I still don't understand how you want to change the page size.
Also report are not only opendocument, it is designed to allow any
format.
msg25441 (view) Author: [hidden] (risto3) Date: 2016-04-07.20:23:41
Administration->Actions->Rapports ?

I take a look, but I believe this is perhaps orthogonal to the feature request
setting the default papersize (and, as you indicate, the language as well).
msg25435 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-07.18:50:08
On 2016-04-07 18:36, richard wrote:
> I'm not sure, but it seems that the current reports are stored under python*/site-packages... which shouldn't normally be fooled with.

You can override report template from the administration menu.
msg25434 (view) Author: [hidden] (risto3) Date: 2016-04-07.18:36:24
By default:
richard@omnis:/home/richard/src/pkgsrc/devel/py-tryton$ paperconf
a4

or if overridden by an environment variable:
richard@omnis:/home/richard/src/pkgsrc/devel/py-tryton$ PAPERSIZE=letter paperconf
letter

I'm not sure, but it seems that the current reports are stored under python*/site-packages... which shouldn't normally be fooled with.

I haven't noticed as yet any $PREFIX/etc/<tryton> configuration directory tree 
just something configurable under /var/lib/trytond documented for 'database' 'path'.

Is that what this directory can be used for?

As far as current reports go, the text is translated, so it would greatly simplify things to set the language and papersize by default.
(also probably explains some issues I'm experiencing with pdf printing)
msg25433 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-07.18:11:19
I can not find what it does exactly.
Nor what exactly you want to do. The page size of an OpenDocument is stored in its style. So users who want a different page size should edit their template.
After that maybe letter is not the best default but at least it is consistent with the default language which is en_US.
msg25432 (view) Author: [hidden] (risto3) Date: 2016-04-07.18:10:38
On the other hand, this may be so trivial in a contained system like tryton,
that perhaps a PAPERSIZE variable be would be simple enough to store in the base that could be overridden on a 'user' basis via preferences.
msg25431 (view) Author: [hidden] (risto3) Date: 2016-04-07.17:57:58
https://packages.qa.debian.org/libp/libpaper.html

Many packaging systems, like pkgsrc and freshports for freebsd use it,
not to mention numerous distros natively.
msg25430 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-04-07.17:46:41
What is libpaper?
msg25429 (view) Author: [hidden] (risto3) Date: 2016-04-07.17:39:17
Currently reports seem to always be in 'letter'.

It would be nice if tryton (client) could utilise an option if libpaper is
installed, which provides a tool called `paperconf`. Then prior to generating
the report, the paper size could be set appropriately, for example to 'a4'.

It would probably only need to be called at client startup.

Perhaps both server and client docs could utilise it as well.
History
Date User Action Args
2017-03-19 00:55:48cedsetnosy: - ced
2017-03-18 18:00:48risto3setmessages: + msg32588
2016-04-08 14:00:46risto3setmessages: + msg25462
2016-04-08 12:21:56cedsetmessages: + msg25460
2016-04-08 12:12:06risto3setmessages: + msg25459
2016-04-08 11:37:43risto3setmessages: + msg25458
2016-04-08 11:20:11cedsetmessages: + msg25456
2016-04-08 10:58:43risto3setmessages: + msg25454
2016-04-08 09:26:43cedsetmessages: + msg25450
title: feature request: use libpaper (to determine site -> Default format of OpenDocument Report
2016-04-08 08:14:49risto3setmessages: + msg25449

Showing 10 items. Show all history (warning: this could be VERY long)