Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 2f9f52b7d4b26aea7a3e21fb6c9bf633e8364051
  • 12.0-evo-202003 par défaut
  • 14-RV-20250324
  • 14-RV-20240830
  • 14-RV-20231222
  • 12-RV-Bug_ecrasement_date_radiation
  • 12-RV-revision-staff
  • 12-RV-copadev
  • 12-RV-Correctif-open-instagram
  • 12-RV-Tree-Coop-Ajout-effectif
  • 12.0-RV-Instagram
  • 12.0-RV-segment_visibility
  • 12.0 protégée
  • 12.0-RV-Abonnements
14 résultats

post-migration.py

Blame
  • Bifurcation depuis Le Filament / Confédération Générale des SCOP / cgscop_partner
    Le projet source a une visibilité limitée.
    cgscop_gendoc_utils.py NaN Gio
    # © 2022 Le Filament (<https://www.le-filament.com>)
    # © 2022 Confédération Générale des Scop (<https://www.les-scop.coop>)
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    from odoo.addons.component.core import AbstractComponent
    
    
    class CgscopGendocUtils(AbstractComponent):
        _name = "cgscop_gendoc.utils"
        _description = "Méthodes communes"
    
        def _getnested(self, nestedrec):
            res = {}
            if nestedrec:
                res.update(
                    {
                        "id": self._getinteger(nestedrec.id),
                        "name": self._getstring(nestedrec.name),
                    }
                )
            else:
                res.update({"id": 0, "name": ""})
            return res
    
        def _getinteger(self, inValue):
            """
            return inValue or O
            """
            if inValue:
                return inValue
            else:
                return "0"
    
        def _getdecimal(self, inValue):
            """
            return inValue or O
            """
            if inValue:
                return "{:.2f}".format(inValue).replace(".", ",")
            else:
                return ""
    
        def _getstring(self, inValue):
            """
            return inValue or empty string
            """
            if inValue:
                return inValue
            else:
                return ""
    
        def _getboolean(self, inValue):
            """
            return inValue
            """
            return inValue
    
        def _getdate(self, inValue):
            """
            return inValue or empty string
            """
            if inValue:
                return inValue.strftime("%d/%m/%Y")
            else:
                return ""