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.__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)#
Returns a tuple of keys, composed of couples of name and record value, used to group document with the same header.
- classmethod Report.execute(ids, data)#
Executes the report for the
ModelStorage
instances with theids
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:
header
data
records
record
(containing the firstrecords
)set_lang
- classmethod Report.render(report, report_context)#
Returns the content of the Report rendered by the templating engine.
- classmethod Report.convert(report, data[, timeout[, retry]])#
Converts the report content
data
into the format defined by the Report.
- classmethod Report.format_datetime(value[, lang[, format[, timezone]]])#
Returns the formatted
datetime
.
- 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 asgenerate_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 asgenerate_svg()
.
Email#
- trytond.report.get_email(report, record, languages)#
Returns the
EmailMessage
and title using the Report rendered for theModelStorage
record for each language.