Exemplo n.º 1
0
    def add_chiks(self):
        ''' add operation '''

        date_ = self.date_report.text()
        day, month, year = date_.split('/')
        dt = datetime.now()
        chicken_coop = self.list_chicken_coop[self.chicken_coop.currentIndex()]
        print chicken_coop.id
        datetime_ = datetime(int(year), int(month), int(day), int(dt.hour),
                             int(dt.minute), int(dt.second),
                             int(dt.microsecond))

        if unicode(self.nb_death.text()) != "":
            ps = PsRapport()
            ps.nb_death = int(self.nb_death.text())
            ps.weight = int(self.weight.text())
            ps.nb_eggs = int(self.nb_eggs.text())
            ps.date_report = datetime_
            ps.psarrivage = chicken_coop.id
            ps.save()
            self.nb_death.clear()
            self.nb_eggs.clear()
            self.weight.clear()
            self.chiks_table.refresh_()
        else:
            raise_error(_("Error"), _(u"Give the number of the death"))
Exemplo n.º 2
0
    def set_data_for(self):

        self.data = [(ps.date_report, ps.psarrivage.chicken_coop.full_name(), \
                      ps.nb_death, ps.remaining, ps.nb_eggs, ps.weight) \
                      for ps in PsRapport.select() \
                                         .order_by(('date_report', 'desc'))]
Exemplo n.º 3
0
    def set_data_for(self):

        self.data = [
            (ps.date_transfert, ps.psarrivage.chicken_coop.full_name(), ps.nb_chiks, ps.remaining, ps.num)
            for ps in PsRapport.select().order_by(("date_transfert", "desc"))
        ]