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 theModelStorage
.
- class trytond.ir.resource.ResourceMixin#
This mixin extends the
ResourceAccessMixin
to add some metadata fields and the option to copy the record usingresource_copy()
.
- trytond.ir.resource.resource_copy(resource, name, string)#
Returns a mixin that adds the named
One2Many
to theresource
ModelStorage
. The mixin also adds acopy_resources_to(target)
instance method that copies the resource records to thetarget
.
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.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.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 theSymbolMixin
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 theModelStorage
.record
is theid
of the record.field
is the name of theText
field.
POST
/<database_name>/ir/html/<model>/<record>/<field>
Save thetext
value in the form with:
model
is the name of theModelStorage
.record
is theid
of the record.field
is the name of theText
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 ofmodel
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 withUTF-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 usings
parameter for the size and with:
database_name
is the name of the database encoded in base64.uuid
is the UUID of the avatar.