122
122
:attr:`Field.depends` is used per example to ensure that
123
123
:class:`~trytond.pyson.PYSON` statement could be evaluated.
128
.. attribute:: Field.order_field
130
The name of a substitute field on which the ordering of records must be done
132
This is often used to allow ordering on :class:`Function` fields.
154
145
The name of the field.
149
.. method:: Field.convert_domain(domain, tables, Model)
151
Convert the simple :ref:`domain <topics-domain>` clause into a SQL
152
expression or a new domain.
154
Where ``tables`` is a nested dictionary containing the existing joins (and it
155
could be updated to add new joins)::
158
None: (<Table invoice>, None),
160
None: (<Table party>, <join_on sql expression>),
162
None: (<Table address>, <join_on sql expression>),
167
.. method:: Field.sql_format(value)
169
Convert the value to use as parameter of SQL queries.
171
.. method:: Field.sql_type()
173
Return the namedtuple('SQLType', 'base type') which defines the SQL type to
174
use for creation and casting.
159
179
See :ref:`default value <topics-fields_default_value>`
184
A class method could be defined for each field which must return a list of SQL
185
expression on which to order instead of the field.
186
The method signature is::
188
order_<field name>(tables)
190
Where ``tables`` is a nested dictionary, see :meth:`~Field.convert_domain`.
289
320
the time part of the field. The default value is `%H:%M:%S`.
290
321
The value can be replaced by a :class:`~trytond.pyson.PYSON` statement.
326
.. class:: Timestamp(string[, \**options])
328
A timestamp, represented in Python by a ``datetime.datetime`` instance.
308
346
A binary field. It will be represented in Python by a ``str`` instance.
348
:class:`Binary` has one extra optional argument:
350
.. attribute:: Binary.filename
352
Name of the field that holds the data's filename. Default value
353
is an empty string, which means the data has no filename (in this case, the
354
filename is hidden, and the "Open" button is hidden when the widget is set
626
674
where `name` is the name of the field and `clause` is a
627
675
:ref:`domain clause <topics-domain>`.
628
It must return a list of :ref:`domain <topics-domain>` clauses.
676
It must return a list of :ref:`domain <topics-domain>` clauses but the
677
``operand`` can be a SQL query.
630
679
Instance methods: