def set_prix(self, prix_achat, prix_vente): out_achat = prix_achat out_vente = prix_vente #Obligatoire is_ok = _mandatory(out_achat) is_ok = _mandatory(out_vente) and is_ok #numérique is_ok = str(out_achat).isnumeric() and is_ok is_ok = str(out_vente).isnumeric() and is_ok #prix de vente au dessus du prix d'achat is_ok = _check_price(prix_vente, prix_achat) and is_ok if is_ok: self.prix_achat = prix_achat self.prix_vente = prix_vente return is_ok
def set_marque(self, marque): out = marque is_ok = _mandatory(out) if is_ok: self.marque = out return is_ok
def set_modele(self, modele): out = modele is_ok = _mandatory(modele) if is_ok: self.modele = modele return is_ok
def set_type(self, _type): out = _type is_ok = _mandatory(_type) if is_ok: self._type = out return is_ok
def set_litrage(self, litrage): out = litrage #Obligatoire is_ok = _mandatory(out) #Numerique is_ok = str(out).isnumeric() and is_ok if is_ok: self.litrage = out return is_ok
def set_designation(self, designation): out = designation #Obligatoire is_ok = _mandatory(out) #Unique is_ok = not _is_duplicate(Out.arr_designation, out) and is_ok if is_ok: self.designation = out return is_ok
def set_ref_fournisseur(self, ref_fourn, ref_sap): #ref sap si pas de ref fournisseur out = ref_fourn if ref_fourn else ref_sap #Obligatoire is_ok = _mandatory(out) #Unique is_ok = not _is_duplicate(Out.arr_ref_fournisseur, out) and is_ok if is_ok: self.ref_fournisseur = out return is_ok
def set_code_barre(self, code_barre): out = code_barre #Obligatoire is_ok = _mandatory(out) #Unique is_ok = not _is_duplicate(Out.arr_code_barre, out) and is_ok #EAN-13 is_ok = is_ean13(out) and is_ok if is_ok: self.code_barre = code_barre return is_ok
def set_code_barre(self, code_barre): out = code_barre prepend = "" if len(str(out)) < 13: nbZeros = 13 - len(str(out)) for i in range(nbZeros): prepend = prepend + "0" out = prepend + str(out) #Obligatoire is_ok = _mandatory(out) #Unique is_ok = not _is_duplicate(Out.arr_code_barre, out) and is_ok #EAN-13 is_ok = is_ean13(out) and is_ok if is_ok: self.code_barre = code_barre return is_ok