Skip to content
Extraits de code Groupes Projets
post-migration.py 1,09 ko
Newer Older
  • Learn to ignore specific revisions
  • # © 2022 Le Filament (<http://www.le-filament.com>)
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    from openupgradelib import openupgrade  # pylint: disable=W7936
    
    
    def get_years():
        year_list = []
        for i in range(2019, 2030):
            year_list.append((str(i), str(i)))
        return year_list
    
    
    def ur_month_timesheet_map_values(env):
        openupgrade.map_values(
            env.cr,
            openupgrade.get_legacy_name("month"),
            "month",
            [
                ("1", "Janv"),
                ("2", "Fév"),
                ("3", "Mars"),
                ("4", "Avr"),
                ("5", "Mai"),
                ("6", "Juin"),
                ("7", "Juil"),
                ("8", "Août"),
                ("9", "Sept"),
                ("10", "Oct"),
                ("11", "Nov"),
                ("12", "Dec"),
            ],
            table="ur_month_timesheet",
        )
        openupgrade.map_values(
            env.cr,
            openupgrade.get_legacy_name("year"),
            "year",
            get_years(),
            table="ur_month_timesheet",
        )
    
    
    @openupgrade.migrate()
    def migrate(env, version):
        ur_month_timesheet_map_values(env)