Example #1
0
    def add_sellable(self, sellable):
        price = sellable.get_price_for_category(self.model.client_category)
        new_price = self.cost.read()

        # Percentage of discount
        discount = 100 - new_price * 100 / price

        if discount > 0 and self.manager:
            Event.log_sale_item_discount(store=self.store,
                                         sale_number=self.model.identifier,
                                         user_name=self.manager.username,
                                         discount_value=discount,
                                         product=sellable.description,
                                         original_price=price,
                                         new_price=new_price)

        SellableItemStep.add_sellable(self, sellable)
Example #2
0
    def add_sellable(self, sellable):
        price = sellable.get_price_for_category(self.model.client_category)
        new_price = self.cost.read()

        # Percentage of discount
        discount = 100 - new_price * 100 / price

        if discount > 0 and self.manager:
            Event.log_sale_item_discount(
                store=self.store,
                sale_number=self.model.identifier,
                user_name=self.manager.username,
                discount_value=discount,
                product=sellable.description,
                original_price=price,
                new_price=new_price)

        SellableItemStep.add_sellable(self, sellable)
Example #3
0
    def _maybe_log_discount(self):
        # If not authorized to apply a discount
        if self.manager is None:
            return

        price = self.model.sellable.get_price_for_category(self.model.sale.client_category)
        new_price = self.price.read()

        if new_price >= price:
            return

        discount = 100 - new_price * 100 / price

        Event.log_sale_item_discount(
            store=self.store, sale_number=self.model.sale.identifier,
            user_name=self.manager.username,
            discount_value=discount,
            product=self.model.sellable.description,
            original_price=price,
            new_price=new_price)
Example #4
0
    def _maybe_log_discount(self):
        # If not authorized to apply a discount or the CredentialsDialog is
        # cancelled, dont generate the log
        if not self.manager:
            return

        price = self.model.sellable.get_price_for_category(self.model.sale.client_category)
        new_price = self.price.read()

        if new_price >= price:
            return

        discount = 100 - new_price * 100 / price

        Event.log_sale_item_discount(
            store=self.store,
            sale_number=self.model.sale.identifier,
            user_name=self.manager.username,
            discount_value=discount,
            product=self.model.sellable.description,
            original_price=price,
            new_price=new_price)