diff --git a/objets.py b/objets.py index ed37bca..f3a7bd6 100644 --- a/objets.py +++ b/objets.py @@ -205,6 +205,18 @@ class CransLdapObject(object): nvals = [nldif[attr][vals.index(v)] for v in vals ] raise EnvironmentError("λv. str(Attr(v)) n'est peut-être pas une projection (ie non idempotente):", attr, nvals, vals) + def _id(self): + """Retourne l'id de l'objet courant""" + if isinstance(self, adherent): + return self['aid'] + elif isinstance(self, machine): + return self['mid'] + elif isinstance(self, club): + return self['cid'] + elif isinstance(self, facture): + return self['fid'] + else: + return [self.dn] def _out_of_context(self, *args, **kwargs): raise EnvironmentError("Hors du context, impossible de faire des écritures") diff --git a/printing/templates/facture b/printing/templates/facture index d5dc21d..7aa46db 100644 --- a/printing/templates/facture +++ b/printing/templates/facture @@ -1,4 +1,4 @@ -{{["fid=",o.fid.0]|join|coul('bleu')}} {{"À : "|coul('gras')}}{{o.proprio().prenom|join(' ')}} {{o.proprio().nom|join(' ')}} ({{o.proprio().aid.0}}) +{{["fid=",o._id().0]|join|coul('bleu')}} {{"À : "|coul('gras')}}{{o.proprio().prenom|join(' ')}} {{o.proprio().nom|join(' ')}} ({{o.proprio()._id().0}}) {% if o.article %} {{"Article : "|coul('gras')}} Prix N° Total Commentaire {% set total = [] %}{% for a in o.article %}