Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • f4c33e407b5ad3c54d65ae23b10db77e62ab9029
  • 14.0 par défaut protégée
  • 14-RV-202503401
3 résultats

account_payment_order.py

Blame
  • Bifurcation depuis Le Filament / Confédération Générale des SCOP / cgscop_cotisation
    Le projet source a une visibilité limitée.
    cgscop_gendoc_utils.py 1,56 Kio
    # © 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 ""