예제 #1
0
파일: sales.py 프로젝트: nzmm/invoiceitx
    def data(self, index, role=Qt.DisplayRole):
        try:
            o = self._data[index.row()]
        except IndexError:
            return QVariant()

        if role == self.InvoiceNumberRole:
            return o['invoice_number']
        elif role == self.CustomerNameRole:
            return o['customer_name']
        elif role == self.NotesRole:
            return o['note']
        elif role == self.SaleDateTimeRole:
            dt = toLocalTime(o['sale_date'])
            return dt.isoformat()
        elif role == self.SaleTimeRole:
            dt = toLocalTime(o['sale_date'])
            return dt.time().isoformat()
        elif role == self.TotalPaymentRole:
            return "%.2f" % o['totals']['total_payment']
        elif role == self.RegisterIDRole:
            return o['register_id']
        elif role == self.SentRole:
            sale = self._cache.get_register_sale(o['id'])
            if sale is None:
                return ""
            return bool(sale.sent) and "*" or ""

        return QVariant()
예제 #2
0
파일: sale.py 프로젝트: nzmm/invoiceitx
 def saleDateTime(self):
     if self._sale is None:
         return None
     from utilx import toLocalTime
     return toLocalTime(self._sale['sale_date'])