def generate_descriptions(self, cr, uid, ids, context=None):
        wizard = self.browse(cr, uid, ids, context)[0]
        project = wizard.project_id

        desc_fr = Project_description_fr.gen_fr_translation(
            cr, uid, project, context)
        desc_de = Project_description_de.gen_de_translation(
            cr, uid, project, context)
        desc_it = Project_description_it.gen_it_translation(
            cr, uid, project, context)

        self.write(
            cr, uid, ids, {
                'desc_fr': desc_fr,
                'desc_de': desc_de,
                'desc_it': desc_it,
                'desc_en': wizard.desc_en,
            }, context)

        return {
            'name': _('Descriptions generation'),
            'type': 'ir.actions.act_window',
            'res_model': self._name,
            'view_mode': 'auto_description_form',
            'view_type': 'form',
            'context': context,
            'target': 'new',
        }
    def generate_descriptions(self, cr, uid, ids, context=None):
        wizard = self.browse(cr, uid, ids, context)[0]
        project = wizard.project_id

        desc_fr = Project_description_fr.gen_fr_translation(
            cr, uid, project, context)
        desc_de = Project_description_de.gen_de_translation(
            cr, uid, project, context)
        desc_it = Project_description_it.gen_it_translation(
            cr, uid, project, context)

        self.write(cr, uid, ids, {
            'desc_fr': desc_fr,
            'desc_de': desc_de,
            'desc_it': desc_it,
            'desc_en': wizard.desc_en,
        }, context)

        return {
            'name': _('Descriptions generation'),
            'type': 'ir.actions.act_window',
            'res_model': self._name,
            'view_mode': 'auto_description_form',
            'view_type': 'form',
            'context': context,
            'target': 'new',
        }
    def generate_descriptions(self):
        self.ensure_one()
        project = self.project_id

        desc_fr = Project_description_fr.gen_fr_translation(
            project)
        desc_de = Project_description_de.gen_de_translation(
            project)
        desc_it = Project_description_it.gen_it_translation(
            project)

        self.write({
            'desc_fr': desc_fr,
            'desc_de': desc_de,
            'desc_it': desc_it,
            'desc_en': self.desc_en,
        })

        return {
            'name': _('Descriptions generation'),
            'type': 'ir.actions.act_window',
            'res_model': self._name,
            'view_mode': 'form',
            'view_type': 'form',
            'target': 'new',
        }
    def _get_desc(self, lang):
        project = self.env['compassion.project'].browse(
            self.env.context.get('active_id'))
        res = False
        if lang == 'fr':
            res = Project_description_fr.gen_fr_translation(project)
        elif lang == 'de':
            res = Project_description_de.gen_de_translation(project)
        elif lang == 'it':
            res = Project_description_it.gen_it_translation(project)
        elif lang == 'en':
            res = project.description_en

        return res + '\n\n'  # Fix for display of the textfield
    def _get_desc(self, lang):
        project = self.env['compassion.project'].browse(
            self.env.context.get('active_id'))
        res = False
        if lang == 'fr':
            res = Project_description_fr.gen_fr_translation(project)
        elif lang == 'de':
            res = Project_description_de.gen_de_translation(project)
        elif lang == 'it':
            res = Project_description_it.gen_it_translation(project)
        elif lang == 'en':
            res = project.description_en

        return res + '\n\n'     # Fix for display of the textfield
    def _get_desc(self, cr, uid, lang, context):
        project = self.pool.get('compassion.project').browse(
            cr, uid, context.get('active_id'), context)
        res = False
        if lang == 'fr':
            res = Project_description_fr.gen_fr_translation(
                cr, uid, project, context)
        elif lang == 'de':
            res = Project_description_de.gen_de_translation(
                cr, uid, project, context)
        elif lang == 'it':
            res = Project_description_it.gen_it_translation(
                cr, uid, project, context)
        elif lang == 'en':
            res = project.description_en

        return res + '\n\n'     # Fix for display of the textfield
    def _get_desc(self, cr, uid, lang, context):
        project = self.pool.get('compassion.project').browse(
            cr, uid, context.get('active_id'), context)
        res = False
        if lang == 'fr':
            res = Project_description_fr.gen_fr_translation(
                cr, uid, project, context)
        elif lang == 'de':
            res = Project_description_de.gen_de_translation(
                cr, uid, project, context)
        elif lang == 'it':
            res = Project_description_it.gen_it_translation(
                cr, uid, project, context)
        elif lang == 'en':
            res = project.description_en

        return res + '\n\n'  # Fix for display of the textfield
    def _get_needs(self, lang):
        """ Returns the needs descrption of the given language.
        It will either generate it from a pattern or retrieve the
        last saved description if one exist. """
        project = self.env['compassion.project'].browse(
            self.env.context.get('active_id'))
        res = False
        if lang == 'fr':
            res = project.needs_fr or \
                Project_description_fr._get_needs_pattern_fr(project)
        elif lang == 'de':
            res = project.needs_de or \
                Project_description_de._get_needs_pattern_de(project)
        elif lang == 'it':
            res = project.needs_it or \
                Project_description_it._get_needs_pattern_it(project)

        return res + '\n\n'  # Fix for display of the textfield
    def _get_needs(self, lang):
        """ Returns the needs descrption of the given language.
        It will either generate it from a pattern or retrieve the
        last saved description if one exist. """
        project = self.env['compassion.project'].browse(
            self.env.context.get('active_id'))
        res = False
        if lang == 'fr':
            res = project.needs_fr or \
                Project_description_fr._get_needs_pattern_fr(project)
        elif lang == 'de':
            res = project.needs_de or \
                Project_description_de._get_needs_pattern_de(project)
        elif lang == 'it':
            res = project.needs_it or \
                Project_description_it._get_needs_pattern_it(project)

        return res + '\n\n'     # Fix for display of the textfield
    def generate_descriptions(self):
        self.ensure_one()
        project = self.project_id

        desc_fr = Project_description_fr.gen_fr_translation(project)
        desc_de = Project_description_de.gen_de_translation(project)
        desc_it = Project_description_it.gen_it_translation(project)

        self.write({
            'desc_fr': desc_fr,
            'desc_de': desc_de,
            'desc_it': desc_it,
            'desc_en': self.desc_en,
        })

        return {
            'name': _('Descriptions generation'),
            'type': 'ir.actions.act_window',
            'res_model': self._name,
            'view_mode': 'form',
            'view_type': 'form',
            'target': 'new',
        }