Report#

A report generates printable documents from ModelStorage records.

There is also a more practical introduction into reports.

class trytond.report.Report#

This is the base class for all reports.

Class attributes are:

Report.__name__#

The unique name used to reference the report throughout the platform.

Class methods are:

classmethod Report.__setup__()#

Setup the class before adding it to the Pool.

classmethod Report.__post_setup__()#

Setup the class after adding it to the Pool.

classmethod Report.__register__(module_name)#

Registers the report.

classmethod Report.check_access(action, model, ids)#

Verifies if the user is allowed to execute the report.

classmethod Report.header_key(record[, data])#

Returns a tuple of keys, composed of couples of name and record value, used to group document with the same header. data is the dictionary passed to :meth:~Report.execute`.

classmethod Report.execute(ids, data)#

Executes the report for the ModelStorage instances with the ids and returns a tuple containing the report type, the content, a boolean to indicate direct printing and the report name. data is a dictionary that will be available in the evaluation context of the report.

classmethod Report.get_context(records, header, data)#

Returns a dictionary with the evaluation context of the report template. The context is filled by default with the keys:

classmethod Report.render(report, report_context)#

Returns the content of the Report rendered by the templating engine. And add gettext and ngettext to the evaluation context for translatable reports.

classmethod Report.convert(report, data[, timeout[, retry]])#

Converts the report content data into the format defined by the Report.

classmethod Report.format_date(value[, lang[, format]])#

Returns the formatted date.

classmethod Report.format_datetime(value[, lang[, format[, timezone]]])#

Returns the formatted datetime.

classmethod Report.format_timedelta(value[, converter[, lang]])#

Returns the formatted timedelta.

classmethod Report.format_currency(value, lang, currency[, symbol[, grouping[, digits]]])#

Returns the formatted numeric value.

classmethod Report.format_number(value, lang[, digits[, grouping[, monetary]]])#

Returns the formatted numeric value.

classmethod Report.format_number_symbol(value, lang, symbol[, digits[, grouping[, monetary]]])#

Returns the numeric value formatted using the SymbolMixin instance.

classmethod Report.barcode(name, code[, size[, \*\*kwargs]])#

Returns named barcode image for the code, the mimetype and the size. The optional keyword arguments are the same as generate_svg().

classmethod Report.qrcode(code[, size[, \*\*kwargs]])#

Returns the QRCode image for the code, the mimetype and the size. The optional keyword arguments are the sames as generate_svg().

Email#

trytond.report.get_email(report, record, languages)#

Returns the EmailMessage and title using the Report rendered for the ModelStorage record for each language.