# Path: program/program_result.py
# STATES = [
#     ('draft', _('Draft')),
#     ('validated', _('Validated')),
#     ('visa_director', _("Director's Visa")),
#     ('visa_dpe', _("DPE's Visa")),
#     ('visa_admin', _("Admin's Visa")),
#     ('opened', _('Opened')),
#     ('closed', _('Closed')),
#     ('cancel', _('Cancelled')),
# ]


from openerp.osv import fields, orm
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval
from .program_result import STATES
        'fvg_show_group_status': False,
        'fvg_show_field_statement': True,
        'validation_spec_ids': (
            lambda self, *a, **kw: self.default_validation_spec_ids(*a, **kw)
        ),
    }

    def _rec_message(self, cr, uid, ids, context=None):
        return _('Error! You can not create recursive Levels.')

    _constraints = [
        (orm.Model._check_recursion, _rec_message, ['parent_id']),
    ]

    def default_validation_spec_ids(self, cr, uid, context=None):
        """Create default validations from validated to closed using groups
        """
        data_pool = self.pool['ir.model.data']

        def ref(xid):
            return data_pool.get_object(cr, uid, xid[0], xid[1]).id

        groups = [
            ('program', 'group_program_director'),  # validated->visa_director
            ('program', 'group_program_dpe'),  # visa_director->visa_dpe
            ('program', 'group_program_administrator'),  # visa_dpe->visa_admin
            ('program', 'group_program_administrator'),  # visa_admin->opened
            ('program', 'group_program_dpe'),  # opened->closed
        ]
        groups = map(ref, groups)

# Path: program/program_result.py
# STATES = [
#     ('draft', _('Draft')),
#     ('validated', _('Validated')),
#     ('visa_director', _("Director's Visa")),
#     ('visa_dpe', _("DPE's Visa")),
#     ('visa_admin', _("Admin's Visa")),
#     ('opened', _('Opened')),
#     ('closed', _('Closed')),
#     ('cancel', _('Cancelled')),
# ]


# Path: program/program_result_level.py
from openerp.osv import fields, orm
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval
from .program_result import STATES

        'fvg_show_group_status': False,
        'fvg_show_field_statement': True,
        'validation_spec_ids': (
            lambda self, *a, **kw: self.default_validation_spec_ids(*a, **kw)
        ),
    }

    def _rec_message(self, cr, uid, ids, context=None):
        return _('Error! You can not create recursive Levels.')

    _constraints = [
        (orm.Model._check_recursion, _rec_message, ['parent_id']),
    ]

    def default_validation_spec_ids(self, cr, uid, context=None):
        """Create default validations from validated to closed using groups
        """
        data_pool = self.pool['ir.model.data']

        def ref(xid):
            return data_pool.get_object(cr, uid, xid[0], xid[1]).id

        groups = [
            ('program', 'group_program_director'),  # validated->visa_director
            ('program', 'group_program_dpe'),  # visa_director->visa_dpe
            ('program', 'group_program_administrator'),  # visa_dpe->visa_admin
            ('program', 'group_program_administrator'),  # visa_admin->opened
            ('program', 'group_program_dpe'),  # opened->closed
        ]
        groups = map(ref, groups)

        states = STATES[1:1+len(groups)]