How to use the trytond.backend.fields function in trytond

To help you get started, we’ve selected a few trytond examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tryton / trytond / trytond / backend / postgresql / fields.py View on Github external
class Timestamp(fields.Timestamp):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp(6)')


class Time(fields.Time):

    @staticmethod
    def sql_type(field):
        return ('time', 'time')


class Binary(fields.Binary):

    @staticmethod
    def sql_format(value):
        return value and psycopg2.Binary(value) or None

    @staticmethod
    def sql_type(field):
        return ('bytea', 'bytea')


class Selection(fields.Selection):

    @staticmethod
    def sql_type(field):
        return ('varchar', 'varchar')
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
class Date(fields.Date):

    @staticmethod
    def sql_type(field):
        return ('date', 'date')


class DateTime(fields.DateTime):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp null')


class Timestamp(fields.Timestamp):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp null')


class Time(fields.Time):

    @staticmethod
    def sql_type(field):
        return ('time', 'time')


class Binary(fields.Binary):

    @staticmethod
github tryton / trytond / trytond / backend / postgresql / fields.py View on Github external
class Numeric(fields.Numeric):

    @staticmethod
    def sql_type(field):
        return ('numeric', 'numeric')


class Date(fields.Date):

    @staticmethod
    def sql_type(field):
        return ('date', 'date')


class DateTime(fields.DateTime):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp(0)')


class Timestamp(fields.Timestamp):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp(6)')


class Time(fields.Time):

    @staticmethod
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
    @staticmethod
    def sql_type(field):
        return ('bigint', 'bigint')


class Char(fields.Char):

    @staticmethod
    def sql_type(field):
        if isinstance(field.size, int):
            return ('varchar', 'varchar(%d)' % (field.size,))
        return ('varchar', 'varchar(255)')


class Sha(fields.Sha):

    @staticmethod
    def sql_type(field):
        return ('varchar', 'varchar(40)')


class Text(fields.Text):

    @staticmethod
    def sql_type(field):
        return ('text', 'text')


class Float(fields.Float):

    @staticmethod
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
'biginteger': BigInteger,
    'char': Char,
    'sha': Sha,
    'text': Text,
    'float': Float,
    'numeric': Numeric,
    'date': Date,
    'datetime': DateTime,
    'timestamp': Timestamp,
    'time': Time,
    'binary': Binary,
    'selection': Selection,
    'reference': Reference,
    'many2one': Many2One,
    'one2many': fields.One2Many,
    'many2many': fields.Many2Many,
    'function': fields.Function,
    'property': fields.Property,
    'dict': Dict,
}
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
def sql_format(value):
        return value or None

    @staticmethod
    def sql_type(field):
        return ('longblob', 'longblob')


class Selection(fields.Selection):

    @staticmethod
    def sql_type(field):
        return ('varchar', 'varchar(255)')


class Reference(fields.Reference):

    @staticmethod
    def sql_type(field):
        return ('varchar', 'varchar(255)')


class Many2One(fields.Many2One):

    @staticmethod
    def sql_type(field):
        return ('bigint', 'bigint')


class Dict(fields.Dict):

    @staticmethod
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
class Integer(fields.Integer):

    @staticmethod
    def sql_type(field):
        return ('bigint', 'bigint')


class BigInteger(fields.BigInteger):

    @staticmethod
    def sql_type(field):
        return ('bigint', 'bigint')


class Char(fields.Char):

    @staticmethod
    def sql_type(field):
        if isinstance(field.size, int):
            return ('varchar', 'varchar(%d)' % (field.size,))
        return ('varchar', 'varchar(255)')


class Sha(fields.Sha):

    @staticmethod
    def sql_type(field):
        return ('varchar', 'varchar(40)')


class Text(fields.Text):
github tryton / trytond / trytond / backend / sqlite / fields.py View on Github external
class Numeric(fields.Numeric):

    @staticmethod
    def sql_type(field):
        return ('NUMERIC', 'NUMERIC')


class Date(fields.Date):

    @staticmethod
    def sql_type(field):
        return ('DATE', 'DATE')


class DateTime(fields.DateTime):

    @staticmethod
    def sql_type(field):
        return ('TIMESTAMP', 'TIMESTAMP')


class Timestamp(fields.Timestamp):

    @staticmethod
    def sql_type(field):
        return ('TIMESTAMP', 'TIMESTAMP')


class Time(fields.Time):

    @staticmethod
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
class DateTime(fields.DateTime):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp null')


class Timestamp(fields.Timestamp):

    @staticmethod
    def sql_type(field):
        return ('timestamp', 'timestamp null')


class Time(fields.Time):

    @staticmethod
    def sql_type(field):
        return ('time', 'time')


class Binary(fields.Binary):

    @staticmethod
    def sql_format(value):
        return value or None

    @staticmethod
    def sql_type(field):
        return ('longblob', 'longblob')
github tryton / trytond / trytond / backend / mysql / fields.py View on Github external
class Text(fields.Text):

    @staticmethod
    def sql_type(field):
        return ('text', 'text')


class Float(fields.Float):

    @staticmethod
    def sql_type(field):
        return ('double', 'double(255, 15)')


class Numeric(fields.Numeric):

    @staticmethod
    def sql_type(field):
        return ('decimal', 'decimal(65, 30)')


class Date(fields.Date):

    @staticmethod
    def sql_type(field):
        return ('date', 'date')


class DateTime(fields.DateTime):

    @staticmethod