def add_operation(self): ''' add operation ''' if unicode(self.name.text()) != "": magasin = Magasin() magasin.name = unicode(self.name.text()) magasin.qte_maxi_stok = int(self.qte_maxi_stok.text()) magasin.save() self.name.clear() self.qte_maxi_stok.clear() self.stori_table.refresh_() raise_success(_(u"Confirmation"), _(u"Registered operation")) else: raise_error(_("Error"), _(u"Give the name of the store"))
def set_data_for(self): self.data = [(mag.name, mag.qte_maxi_stok) for mag in Magasin.all()]