Exemplo n.º 1
0
 def add_operation(self):
     ''' add operation '''
     unite_ = self.liste_unite[self.box_unite.currentIndex()]
     if unicode(self.libelle.text()) != "":
         if unicode(unite_) != "":
             produit = Produit()
             produit.libelle = unicode(self.libelle.text())
             produit.unite = unicode(unite_)
             produit.save()
             self.libelle.clear()
             self.table_op.refresh_()
             raise_success(_(u"Confirmation"), _(u"The product %s "
                           u" was recorded") % produit.libelle)
         else:
             raise_error(_(u"error"), \
                         _(u"Give the room number in the box"))
     else:
         raise_error(_(u"Error"), _(u"Give the name of the product"))
Exemplo n.º 2
0
    def __init__(self, parent=0, *args, **kwargs):
        super(G_reportViewWidget, self).__init__(parent=parent,\
                                                        *args, **kwargs)
        self.setWindowTitle(_(u"Management reports"))
        vbox = QtGui.QVBoxLayout()

        tablebox = QtGui.QVBoxLayout()
        tablebox.addWidget(F_BoxTitle(_(u"Table rapports")))
        self.table_op = StockRapTableWidget(parent=self)
        tablebox.addWidget(self.table_op)

        formbox = QtGui.QVBoxLayout()
        editbox = QtGui.QGridLayout()

        self.qte_utilise = IntLineEdit()
        self.qte_utilise.setDragEnabled(True)

        self.date_ = FormatDate(QtCore.QDate.currentDate())
        self.date_.setFont(QtGui.QFont("Courier New", 10, True))

        self.time = QtGui.QDateTimeEdit(QtCore.QTime.currentTime())

        self.liste_type = [_(u"input"), _(u"out")]
        #Combobox widget
        self.box_type = QtGui.QComboBox()
        for index in self.liste_type:
            self.box_type.addItem(u'%(type)s' % {'type': index})
        #Combobox widget
        self.liste_magasin = Magasin.all()
        self.box_mag = QtGui.QComboBox()
        for index in xrange(0, len(self.liste_magasin)):
            op = self.liste_magasin[index]
            sentence = u"%(name)s" % {'name': op.name}
            self.box_mag.addItem(sentence, QtCore.QVariant(op.id))
        #Combobox widget
        self.liste_produit = Produit.all()
        self.box_prod = QtGui.QComboBox()
        for index in xrange(0, len(self.liste_produit)):
            op = self.liste_produit[index]
            sentence = _(u"%(libelle)s") % {'libelle': op.libelle}
            self.box_prod.addItem(sentence, QtCore.QVariant(op.id))
            
        editbox.addWidget(QtGui.QLabel(_(u"Type")), 0, 0)
        editbox.addWidget(self.box_type, 1, 0)
        editbox.addWidget(QtGui.QLabel(_(u"Store")), 0, 1)
        editbox.addWidget(self.box_mag, 1, 1)
        editbox.addWidget(QtGui.QLabel(_(u"Product")), 0, 2)
        editbox.addWidget(self.box_prod, 1, 2)
        editbox.addWidget(QtGui.QLabel((_(u"Quantite utilise"))), 0, 3)
        editbox.addWidget(self.qte_utilise, 1, 3)
        editbox.addWidget(QtGui.QLabel((_(u"Date"))), 0, 4)
        editbox.addWidget(self.date_, 1, 4)
        butt = Button_save(_(u"Save"))
        butt.clicked.connect(self.add_operation)
        editbox.addWidget(butt, 1, 5)
    
        formbox.addLayout(editbox)
        editbox.setColumnStretch(7, 2)

        vbox.addLayout(formbox)
        vbox.addLayout(tablebox)
        self.setLayout(vbox)
Exemplo n.º 3
0
 def set_data_for(self):
     self.data = [(prod.libelle, prod.unite) \
                                 for prod in Produit.all()]
Exemplo n.º 4
0
#!/usr/bin/env python
# encoding= utf-8
#maintainer : Fad

from datetime import datetime
from model import Magasin, StockRapport, Produit

m = Magasin(name=u"magasin aliment", qte_maxi_stok=5000)
m.save()
p = Produit(libelle=u"poisson", unite="kg")
p.save()

print "produit", Produit.all()
print "magasin", Magasin.all()

sr = StockRapport()
sr.type_ = "poulailler"
sr.magasin = 1
sr.produit = 1
sr.qte_utilise = 50
sr.restant = 20
sr.date_rapp = datetime.now()
sr.registered_on = datetime.now()
sr.save()

print "rapport pour les stocks ",  StockRapport.all()