On 10/12/09 13:20 -0500, Juan Fernando Jaramillo Botero wrote:
> Hello, I just create a new step in the helloWord wiki [1] to explain the
> reporting, but I like to extend it to put headers in the report. I try
> to add the field 'style' in the file 'hello.xml' like:
>
> <record model="ir.action.report" id="report_hello">
> <field name="name">Hello</field>
> <field name="model">hello.hello</field>
> <field name="report_name">hello.helloworld</field>
> <field name="report">helloWorld/hello.odt</field>
> <field name="style">company/header_A4.odt</field>
> </record>
>
> As was made in [1] but just adding the style line.
>
> But when I try to run the report appear the following error:
>
> Traceback (most recent call last):
> File "/trytond/protocols/netrpc.py", line 47, in run
> res = dispatch(host, port, 'NetRPC', *msg)
> File "/trytond/protocols/dispatcher.py", line 125, in dispatch
> res = getattr(obj, method)(cursor, user, *args, **kargs)
> File "trytond/report/report.py", line 115, in execute
> File "trytond/report/report.py", line 209, in parse
> File "/relatorio/templates/base.py", line 36, in render
> return self.serializer(self.events)
> File "/relatorio/templates/opendocument.py", line 619, in __call__
> for kind, data, pos in stream:
> File "/genshi/core.py", line 283, in _ensure
> for event in stream:
> File "/genshi/filters/i18n.py", line 141, in __call__
> for kind, data, pos in stream:
> File "/genshi/template/base.py", line 569, in _include
> for event in stream:
> File "/genshi/template/markup.py", line 245, in _match
> for event in stream:
> File "/genshi/template/base.py", line 543, in _exec
> for event in stream:
> File "/genshi/template/base.py", line 496, in _eval
> for kind, data, pos in stream:
> File "/genshi/template/base.py", line 558, in _flatten
> for event in self._flatten(substream, ctxt, **vars):
> File "/genshi/template/base.py", line 557, in _flatten
> **vars)
> File "/genshi/template/base.py", line 272, in _apply_directives
> stream = directives[0](iter(stream), directives[1:], ctxt, **vars)
> File "/genshi/template/directives.py", line 411, in __call__
> value = _eval_expr(self.expr, ctxt, **vars)
> File "/genshi/template/base.py", line 286, in _eval_expr
> retval = expr.evaluate(ctxt)
> File "/genshi/template/eval.py", line 180, in evaluate
> return eval(self.code, _globals, {'__data__': data})
> File "/genshi/template/eval.py", line 321, in lookup_attr
> val = cls.undefined(key, owner=obj)
> File "/genshi/template/eval.py", line 405, in undefined
> raise UndefinedError(key, owner=owner)
> UndefinedError: 1 has no member named "header"
>
> What is the problem? Something lack in the hello.odt?
> You must use the "CompanyReport" class from trytond/modules/company/company.py It will setup the company BrowseRecord in the context because "company/header_A4.odt" use it. Or you must create your own odt file for style. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email: [email protected] Jabber: [email protected] Website: http://www.b2ck.com/ twitter: http://twitter.com/cedrickrier identi.ca: http://identi.ca/cedrickrier
pgp7vdyqNDahF.pgp
Description: PGP signature
