API Reference#

Resources#

class trytond.ir.resource.ResourceAccessMixin#

This mixin adds a resource Reference field and applies the same access right as the resource to the ModelStorage.

class trytond.ir.resource.ResourceMixin#

This mixin extends the ResourceAccessMixin to add some metadata fields and the option to copy the record using resource_copy().

trytond.ir.resource.resource_copy(resource, name, string)#

Returns a mixin that adds the named One2Many to the resource ModelStorage. The mixin also adds a copy_resources_to(target) instance method that copies the resource records to the target.

Attachments#

class trytond.ir.attachment.AttachmentCopyMixin#

A mixin setup by the resource_copy() for the Attachments.

Notes#

class trytond.ir.note.NoteCopyMixin#

A mixin setup by the resource_copy() for the Notes.

Language#

class trytond.ir.lang.Language#
Language.get([code])#

Returns the language instance for the code or the language.

Language.format(percent, value[, grouping[, monetary[, \*\*additional]]])#

Formats the value according to the language by substitution of the %? specifier.

Language.currency(val, currency[, symbol[, grouping[, digits]]])#

Formats the numeric value according to the language and the currency.

Language.strftime(value[, format])#

Formats the date or datetime according to the language.

Language.format_number(value[, digits[, grouping[, monetary]]])#

Formats the number value according to the language.

Language.format_number_symbol(value, symbol[, digits[, grouping]])#

Formats the number value with the SymbolMixin instance according to the language.

HTML Editor#

A route is registered to allow HTML Text fields to be edited using a web editor:

  • GET /<database_name>/ir/html/<model>/<record>/<field> Returns the web page containing the editor with:

    model is the name of the ModelStorage. record is the id of the record. field is the name of the Text field.

  • POST /<database_name>/ir/html/<model>/<record>/<field> Save the text value in the form with:

    model is the name of the ModelStorage. record is the id of the record. field is the name of the Text field.

Download CSV Data#

A route is registered to download records as a CSV file:

  • GET /<database_name>/data/<model> Returns a CSV file for the records of model using the parameters:

    l is the language. d is a JSON encoded domain. c is a JSON encoded context. s is an integer to limit the number of records. p is the offset to apply to the list of records. o is a list of fields and orders separated by ,. f is a list of field names. enc is the encoding with UTF-8 as default. dl is the CSV delimiter. qc is the quoting char. h is a boolean integer whether to include the header or not. loc is a boolean integer whether to use locale format or not.

Fetch Avatar#

A route is registered from which an Avatar can be downloaded:

  • GET /avatar/<database_name>/<uuid> Returns the avatar using s parameter for the size and with:

    database_name is the name of the database encoded in base64. uuid is the UUID of the avatar.