<s> from lino . api import dd , rt <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> class EntryStates ( dd . Workflow ) : <EOL> pass <EOL> add = EntryStates . add_item <EOL> add ( '<STR_LIT>' , _ ( "<STR_LIT>" ) , '<STR_LIT>' ) <EOL> add ( '<STR_LIT>' , _ ( "<STR_LIT>" ) , '<STR_LIT>' ) <EOL> add ( '<STR_LIT>' , _ ( "<STR_LIT>" ) , '<STR_LIT>' ) <EOL> add ( '<STR_LIT>' , _ ( "<STR_LIT>" ) , '<STR_LIT>' ) <EOL> add ( '<STR_LIT>' , _ ( "<STR_LIT>" ) , '<STR_LIT>' ) <EOL> @ dd . receiver ( dd . pre_analyze ) <EOL> def my_entry_workflow ( sender = None , ** kw ) : <EOL> EntryStates . todo . add_transition ( _ ( "<STR_LIT>" ) , states = '<STR_LIT>' ) <EOL> EntryStates . todo . add_transition ( WakeupEntry ) <EOL> EntryStates . started . add_transition ( StartEntry ) <EOL> EntryStates . sleeping . add_transition ( states = "<STR_LIT>" ) <EOL> EntryStates . done . add_transition ( FinishEntry ) <EOL> EntryStates . cancelled . add_transition ( states = '<STR_LIT>' , <EOL> help_text = _ ( """<STR_LIT>""" ) , <EOL> icon_name = '<STR_LIT>' ) <EOL> class StartEntry ( dd . ChangeStateAction ) : <EOL> label = _ ( "<STR_LIT>" ) <EOL> help_text = _ ( "<STR_LIT>" ) <EOL> required_states = '<STR_LIT>' <EOL> def get_action_permission ( self , ar , obj , state ) : <EOL> if not obj . company or not obj . subject or not obj . body : <EOL> return False <EOL> return super ( StartEntry , self ) . get_action_permission ( ar , obj , state ) <EOL> class FinishEntry ( StartEntry ) : <EOL> icon_name = '<STR_LIT>' <EOL> label = _ ( "<STR_LIT>" ) <EOL> required_states = '<STR_LIT>' <EOL> help_text = _ ( "<STR_LIT>" ) <EOL> class WakeupEntry ( dd . ChangeStateAction , dd . NotifyingAction ) : <EOL> label = _ ( "<STR_LIT>" ) <EOL> required_states = '<STR_LIT>' <EOL> def get_notify_subject ( self , ar , obj ) : <EOL> return _ ( "<STR_LIT>" ) % obj </s>
