2009-09-01 14:43:49 +02:00
|
|
|
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
#this repository contains the full copyright notices and license terms.
|
|
|
|
|
from trytond.model import ModelSingleton, ModelSQL, fields
|
|
|
|
|
|
2012-09-24 22:16:53 +02:00
|
|
|
__all__ = [
|
2013-09-22 14:28:46 +02:00
|
|
|
'Singleton', 'URLObject', 'ModelSQLRequiredField', 'ModelSQLTimestamp',
|
2012-09-24 22:16:53 +02:00
|
|
|
]
|
|
|
|
|
|
2009-09-01 14:43:49 +02:00
|
|
|
|
|
|
|
|
class Singleton(ModelSingleton, ModelSQL):
|
|
|
|
|
'Singleton'
|
2012-09-24 22:16:53 +02:00
|
|
|
__name__ = 'test.singleton'
|
2009-09-01 14:43:49 +02:00
|
|
|
name = fields.Char('Name')
|
|
|
|
|
|
2012-09-24 22:16:53 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def default_name():
|
2009-09-01 14:43:49 +02:00
|
|
|
return 'test'
|
|
|
|
|
|
2011-07-20 19:04:52 +02:00
|
|
|
|
|
|
|
|
class URLObject(ModelSQL):
|
2012-09-24 22:16:53 +02:00
|
|
|
'URLObject'
|
|
|
|
|
__name__ = 'test.urlobject'
|
2011-07-20 19:04:52 +02:00
|
|
|
name = fields.Char('Name')
|
|
|
|
|
|
|
|
|
|
|
2012-10-09 11:08:56 +02:00
|
|
|
class ModelSQLRequiredField(ModelSQL):
|
|
|
|
|
'model with a required field'
|
|
|
|
|
__name__ = 'test.modelsql'
|
|
|
|
|
|
|
|
|
|
integer = fields.Integer(string="integer", required=True)
|
|
|
|
|
desc = fields.Char(string="desc", required=True)
|
2013-09-22 14:28:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModelSQLTimestamp(ModelSQL):
|
|
|
|
|
'Model to test timestamp'
|
|
|
|
|
__name__ = 'test.modelsql.timestamp'
|