本文整理匯總了Python中stoqlib.domain.event.Event.log_sale_item_discount方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.log_sale_item_discount方法的具體用法?Python Event.log_sale_item_discount怎麽用?Python Event.log_sale_item_discount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stoqlib.domain.event.Event
的用法示例。
在下文中一共展示了Event.log_sale_item_discount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: add_sellable
# 需要導入模塊: from stoqlib.domain.event import Event [as 別名]
# 或者: from stoqlib.domain.event.Event import log_sale_item_discount [as 別名]
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)
示例2: _maybe_log_discount
# 需要導入模塊: from stoqlib.domain.event import Event [as 別名]
# 或者: from stoqlib.domain.event.Event import log_sale_item_discount [as 別名]
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)