Skip to content
Extraits de code Groupes Projets
report_survey_xlsx.py 940 octets
Newer Older
  • Learn to ignore specific revisions
  • # © 2024 Le Filament (<http://www.le-filament.com>)
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    from odoo import models
    
    
    class ReportSurveyXlsx(models.AbstractModel):
        _inherit = "report.survey.xlsx"
    
    
        def _pre_generate_xlsx_report_header(self, sheet, results, cols, bold):
            """
            Hérite la fonction parente pour ajouter les informations du stagiaire si il
            s'agit d'un questionnaire AECT ou AECI
            """
            super()._pre_generate_xlsx_report_header(sheet, results, cols, bold)
            if results.filtered(lambda s: s.training_survey_type in ["aeci", "aect"]):
                sheet.write(0, cols["student_id"], "Stagiaire", bold)
    
    
        def _get_input_domain(self, results):
            domain = super()._get_input_domain(results)
            if self.env.context.get("training_id"):
                domain.append(("training_id", "=", self.env.context.get("training_id")))
            return domain