API Reference¶
Resources¶
- class trytond.ir.resource.ResourceAccessMixin¶
This mixin adds a
resourceReferencefield and applies the same access right as the resource to theModelStorage.
- class trytond.ir.resource.ResourceMixin¶
This mixin extends the
ResourceAccessMixinto 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
One2Manyto theresourceModelStorage. 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 <model-ir.attachment>.
Notes¶
- class trytond.ir.note.NoteCopyMixin¶
A mixin setup by the
resource_copy()for the Notes <model-ir.note>.
Language¶
- class trytond.ir.lang.Language¶
- Language.format(percent, value[, grouping[, monetary[, \*\*additional]]])¶
Formats the
valueaccording to the language by substitution of the%?specifier.
- Language.currency(val, currency[, symbol[, grouping[, digits]]])¶
Formats the numeric
valueaccording to the language and the currency.
- Language.strftime(value[, format])¶
Formats the
dateordatetimeaccording to the language.
- Language.format_number(value[, digits[, grouping[, monetary]]])¶
Formats the number
valueaccording to the language.
- Language.format_number_symbol(value, symbol[, digits[, grouping]])¶
Formats the number
valuewith theSymbolMixininstance 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:
modelis the name of theModelStorage.recordis theidof the record.fieldis the name of theTextfield.
POST/<database_name>/ir/html/<model>/<record>/<field>Save thetextvalue in the form with:
modelis the name of theModelStorage.recordis theidof the record.fieldis the name of theTextfield.
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 ofmodelusing the parameters:
lis the language.dis a JSON encoded domain.cis a JSON encoded context.sis an integer to limit the number of records.pis the offset to apply to the list of records.ois a list of fields and orders separated by,.fis a list of field names.encis the encoding withUTF-8as default.dlis the CSV delimiter.qcis the quoting char.his a boolean integer whether to include the header or not.locis a boolean integer whether to use locale format or not.
Fetch Avatar¶
A route is registered from which an Avatar <model-ir.avatar> can be downloaded:
GET/avatar/<database_name>/<uuid>Returns the avatar usingsparameter for the size and with:
database_nameis the name of the database encoded in base64.uuidis the UUID of the avatar.