Example #1
0
 def add_chickencoop(self):
     ''' add operation '''
     date_ = self.date.text()
     day, month, year = date_.split('/')
     dt = datetime.now()
     datetime_ = datetime(int(year), int(month), int(day),
                          int(dt.hour), int(dt.minute), int(dt.second),
                          int(dt.microsecond))
     if unicode(self.num.text()) != "":
         poussin = ChickenCoop()
         poussin.type_ = int(self.type_.currentIndex())
         poussin.num = int(self.num.text())
         poussin.nbr_sujet_maxi = int(self.nbr_sujet_maxi.text())
         poussin.date = datetime_
         poussin.save()
         self.num.clear()
         self.nbr_sujet_maxi.clear()
         self.poussin_table.refresh_()
         raise_success(_(u"Confirmation"), _(u"Registered operation"))
     else:
         raise_error(_("Error"), _(u"Give the name of the store"))