Sélectionner une révision Git
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 ""