Example #1
0
    def process_click(self, event):
        selection = self.GetSelection()
        tree_data = self.GetItemData(selection)
        if not tree_data:
            event.Skip()
            return
        data = tree_data.GetData()

        if isinstance(data, data_types.SaleData):
            sale.Sale(self.parent, data=data, editable=False)
        elif isinstance(data, data_types.ProductData):
            inventory.ProductData(self.parent,
                                  data.description,
                                  data=data,
                                  editable=False)
        elif isinstance(data, str):
            inventory.ProductData(self.parent,
                                  core.format_id_user(data),
                                  product_id=int(data),
                                  editable=False)
        elif isinstance(data, data_types.ProductCategoryData):
            categories.ProductCategoryData(self.parent,
                                           data.category,
                                           data=data)
        elif isinstance(data, data_types.WasteData):
            waste.Waste(self.parent, data=data)
        elif isinstance(data, data_types.ExpenseData):
            expense.Expense(self.parent, data=data)
Example #2
0
    def open_sale_edit(self, event):
        red = self.list_sales.GetSelection()
        if self.list_sales.GetRootItem() == red:
            return

        data = self.list_sales.GetItemData(red).GetData()
        if isinstance(data, data_types.ProductData):
            red = self.list_sales.GetItemParent(red)
            data = self.list_sales.GetItemData(red).GetData()

        sale.Sale(self, key=data.ID)
Example #3
0
    def open_view_sale(self, event):
        red = self.list_deliveries.GetSelection()
        if self.list_deliveries.GetRootItem() == red:
            event.Skip()
            return
        data = self.list_deliveries.GetItemData(red)
        if not data:
            event.Skip()
            return
        delivery_data = data.GetData()
        if not isinstance(delivery_data, data_types.DeliveryData):
            event.Skip()
            return

        sale.Sale(self, key=delivery_data.sale_ID, delivery_id=delivery_data.ID, editable=False)
Example #4
0
    def process_click(self, event):
        selection = self.list_edited_data.GetSelection()
        tree_data = self.list_edited_data.GetItemData(selection)
        if not tree_data:
            event.Skip()
            return
        data = tree_data.GetData()

        if isinstance(data, data_types.SaleData):
            import sale
            sale.Sale(self, data=data, editable=False)
        elif isinstance(data, data_types.ProductData):
            import inventory
            inventory.ProductData(self,
                                  data.description,
                                  data=data,
                                  editable=False)
        elif isinstance(data, data_types.ProductCategoryData):
            import categories
            categories.ProductCategoryData(self, data=data)
        elif isinstance(data, data_types.WasteData):
            import waste
            waste.Waste(self, data=data)
        elif isinstance(data, data_types.ExpenseData):
            import expense
            expense.Expense(self, data=data)
        elif isinstance(data, data_types.TransactionData):
            import transaction
            transaction.Transaction(self,
                                    transaction_type=data.type,
                                    data=data)
        elif isinstance(data, data_types.ClientData):
            import clients
            clients.ClientData(self,
                               data.name,
                               data.ID,
                               data=data,
                               editable=False)
        elif isinstance(data, data_types.TransactionCategoryData):
            import categories
            categories.TransactionCategoryData(self,
                                               data.category,
                                               data.ID,
                                               data=data)
Example #5
0
 def open_new_sale(self, event):
     sale.Sale(self.frame)
Example #6
0
 def open_new_sale(self, event=None):
     sale.Sale(self)
Example #7
0
 def sale_view(self, event):
     t = self.list_bought.GetFocusedItem()
     if t == -1:
         return
     sale_id = self.list_bought.GetItemData(t)
     sale.Sale(self, core.format_id_user(sale_id), key=sale_id, editable=False)
Example #8
0
 def open_sale_register(self, event):
     sale.Sale(self)
Example #9
0
 def more(self, event):
     sale.Sale(self.GetParent(),
               key=self.data.sale_ID,
               delivery_id=self.data.ID,
               editable=False)
     self.exit(None)