Files
tryton/trytond/tests/trigger.py
T

42 lines
984 B
Python
Raw Normal View History

2014-12-02 12:54:01 +01: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 ModelSQL, fields
2020-03-28 23:56:19 +01:00
from trytond.pool import Pool, PoolMeta
2012-09-24 22:16:53 +02:00
TRIGGER_LOGS = []
2012-04-01 23:08:15 +02:00
2020-03-28 23:56:19 +01:00
class Trigger(metaclass=PoolMeta):
__name__ = 'ir.trigger'
@classmethod
def __setup__(cls):
super().__setup__()
cls.action.selection.append(
('test.trigger_action|trigger', "Test Trigger"))
class Triggered(ModelSQL):
'Triggered'
2012-09-24 22:16:53 +02:00
__name__ = 'test.triggered'
name = fields.Char('Name')
2013-03-06 17:00:34 +01:00
class TriggerAction(ModelSQL):
'Trigger Action Model'
__name__ = 'test.trigger_action'
2012-09-24 22:16:53 +02:00
@staticmethod
def trigger(records, trigger):
'''
Trigger function for test
'''
2012-09-24 22:16:53 +02:00
TRIGGER_LOGS.append((records, trigger))
def register(module):
Pool.register(
2020-03-28 23:56:19 +01:00
Trigger,
Triggered,
TriggerAction,
module=module, type_='model')