Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 4
0
    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