# 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 orm, fields
from openerp.tools.translate import _
from ..program_result import STATES
        if context is None:
            context = {}
        res = []
        result_line_pool = self.pool['program.result.close.line']
        for result_id in context.get('active_ids', []):
            res.append(result_line_pool.create(
                cr, uid, {
                    'result_id': result_id,
                }, context=context
            ))
        return res

    _defaults = {
        'line_ids': _build_result_ids,
    }

    def run(self, cr, uid, ids, context=None):
        if type(ids) is list and ids:
            ids = ids[0]
        result_ids = []
        non_closable_ids = []
        for line in self.browse(cr, uid, ids, context=context).line_ids:
            if line.is_closable:
                result_ids.append(line.result_id)
            else:
                non_closable_ids.append(line.result_id)
        if non_closable_ids:
            # Don't do the following in a generator as it doesn't translate
            culprits = set()
            for r in non_closable_ids:

# 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/wizard/program_result_close.py
from openerp.osv import orm, fields
from openerp.tools.translate import _
from ..program_result import STATES

        if context is None:
            context = {}
        res = []
        result_line_pool = self.pool['program.result.close.line']
        for result_id in context.get('active_ids', []):
            res.append(result_line_pool.create(
                cr, uid, {
                    'result_id': result_id,
                }, context=context
            ))
        return res

    _defaults = {
        'line_ids': _build_result_ids,
    }

    def run(self, cr, uid, ids, context=None):
        if type(ids) is list and ids:
            ids = ids[0]
        result_ids = []
        non_closable_ids = []
        for line in self.browse(cr, uid, ids, context=context).line_ids:
            if line.is_closable:
                result_ids.append(line.result_id)
            else:
                non_closable_ids.append(line.result_id)
        if non_closable_ids:
            # Don't do the following in a generator as it doesn't translate
            culprits = set()
            for r in non_closable_ids:

                culprits.add((r.name, _(dict(STATES)[r.state])))