diff --git a/attributs.py b/attributs.py index 6b9f74c..0344e81 100644 --- a/attributs.py +++ b/attributs.py @@ -1225,6 +1225,10 @@ class modePaiement(Attr): class recuPaiement(Attr): ldap_name = "recuPaiement" +@crans_attribute +class article(Attr): + ldap_name = "article" + @crans_attribute class dnsIpv6(boolAttr): ldap_name = "dnsIpv6" diff --git a/lc_ldap.py b/lc_ldap.py index eeed8b4..f381278 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -295,11 +295,18 @@ class lc_ldap(ldap.ldapobject.LDAPObject, object): else: raise EnvironmentError("Vous n'avez pas le droit de créer cet adhérent.") - def newFacture(self, fldif): + def newFacture(self, parent, fldif): """Crée une nouvelle facture --Non implémenté !""" uldif = copy.deepcopy(fldif) - raise NotImplementedError() + # fid + uldif['fid'] = [ unicode(self._find_id('fid')) ] + uldif['objectClass'] = [u'facture'] + facture = self._create_entity('fid=%s,%s' % (uldif['fid'][0], parent), uldif) + if facture.may_be(variables.created, self.droits + self._check_parent(facture.dn)): + return facture + else: + raise EnvironmentError("Vous n'avez pas le droit de créer cette facture.") def _create_entity(self, dn, uldif): '''Crée une nouvelle entité ldap avec le dn ``dn`` et les diff --git a/objets.py b/objets.py index d513515..784ebd8 100644 --- a/objets.py +++ b/objets.py @@ -930,7 +930,8 @@ class facture(CransLdapObject): variables.modified: [attributs.nounou, attributs.bureau, attributs.cableur], variables.deleted: [attributs.nounou, attributs.bureau, attributs.cableur], } - attribs = [attributs.fid, attributs.modePaiement, attributs.recuPaiement] + attribs = [attributs.fid, attributs.modePaiement, attributs.recuPaiement, + attributs.historique, attributs.article] ldap_name = "facture" @crans_object