本文整理汇总了Python中stoqlib.gui.wizards.abstractwizard.SellableItemStep类的典型用法代码示例。如果您正苦于以下问题:Python SellableItemStep类的具体用法?Python SellableItemStep怎么用?Python SellableItemStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SellableItemStep类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
self.cost.set_editable(True)
self.quantity.connect('validate', self._on_quantity__validate)
self.slave.klist.connect('selection-changed',
self._on_klist_selection_changed)
示例2: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
self.cost_label.set_label(_('Price:'))
self.cost.set_editable(True)
delivery = self._find_delivery()
if delivery is not None:
self._delivery_item = delivery.service_item
self._delivery = CreateDeliveryModel(
price=self._delivery_item.price, notes=self._delivery_item.notes,
transporter=delivery.transporter, address=delivery.address,
estimated_fix_date=self._delivery_item.estimated_fix_date)
else:
self._delivery = None
self._delivery_item = None
if isinstance(self.model, Sale):
self.delivery_btn = self.slave.add_extra_button(label=_("Add delivery"))
self.delivery_btn.set_sensitive(bool(len(self.slave.klist)))
else:
self.delivery_btn = None
self.discount_btn = self.slave.add_extra_button(label=_("Apply discount"))
self.discount_btn.set_sensitive(bool(len(self.slave.klist)))
self.slave.klist.connect('has-rows', self._on_klist__has_rows)
self.slave.klist.connect('selection-changed',
self._on_klist__selection_changed)
示例3: update_total
def update_total(self):
SellableItemStep.update_total(self)
quantities = {}
missing = {}
lead_time = 0
for i in self.slave.klist:
sellable = i.sellable
if sellable.service or not sellable.product.manage_stock:
continue
quantities.setdefault(sellable, 0)
quantities[sellable] += i.quantity
if quantities[sellable] > i._stock_quantity:
_lead_time = sellable.product.get_max_lead_time(
quantities[sellable], self.model.branch)
max_lead_time = max(lead_time, _lead_time)
missing[sellable] = Settable(
description=sellable.get_description(),
stock=i._stock_quantity,
ordered=quantities[sellable],
lead_time=_lead_time,
)
self.missing = missing
if missing:
msg = _('Not enough stock. '
'Estimated time to obtain missing items: %d days.') % max_lead_time
self.slave.set_message(
'<b>%s</b>' % (api.escape(msg)), self._show_missing_details)
else:
self.slave.clear_message()
示例4: sellable_selected
def sellable_selected(self, sellable, batch=None):
SellableItemStep.sellable_selected(self, sellable, batch=batch)
if sellable:
price = sellable.get_price_for_category(
self.model.client_category)
self.cost.set_text("%s" % price)
self.proxy.update('cost')
示例5: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
if not self.wizard.create_payments:
self.cost_label.hide()
self.cost.hide()
self.quantity.connect('validate', self._on_quantity__validate)
示例6: sellable_selected
def sellable_selected(self, sellable, batch=None):
# We may receive a batch if the user typed a batch number instead of a
# product code, but we pass batch=None here since the user must select
# the batch when confirming a sale.
SellableItemStep.sellable_selected(self, sellable, batch=None)
if sellable:
price = sellable.get_price_for_category(
self.model.client_category)
self.cost.update(price)
示例7: sellable_selected
def sellable_selected(self, sellable):
SellableItemStep.sellable_selected(self, sellable)
if sellable is None:
return
storable = sellable.product_storable
# FIXME: We should not have to override this method. This should
# be done automatically on SellableItemStep
self.stock_quantity.set_label(
"%s" % storable.get_balance_for_branch(branch=self.model.branch))
示例8: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self._delivery = None
self._delivery_item = None
self.delivery_button = self.slave.add_extra_button(label=_("Add Delivery"))
self.delivery_button.set_sensitive(bool(len(self.slave.klist)))
self.slave.klist.connect('has_rows', self._on_klist__has_rows)
self.delivery_button.connect('clicked',
self._on_delivery_button__clicked)
示例9: sellable_selected
def sellable_selected(self, sellable):
SellableItemStep.sellable_selected(self, sellable)
if sellable is None:
return
storable = sellable.product_storable
stock_item = storable.get_stock_item(self.branch)
self.stock_quantity.set_label("%s" % stock_item.quantity or 0)
quantity = self._get_stock_balance(sellable)
has_quantity = quantity > 0
self.quantity.set_sensitive(has_quantity)
self.add_sellable_button.set_sensitive(has_quantity)
if has_quantity:
self.quantity.set_range(1, quantity)
示例10: add_sellable
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)
示例11: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
self.cost_label.hide()
self.cost.hide()
示例12: sellable_selected
def sellable_selected(self, sellable, batch=None):
SellableItemStep.sellable_selected(self, sellable, batch=batch)
if sellable:
self.cost.update(sellable.price)
示例13: validate
def validate(self, value):
SellableItemStep.validate(self, value)
can_purchase = self.model.purchase_total > 0
self.wizard.refresh_next(value and can_purchase)
示例14: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
self.cost_label.set_label('Price:')
self.cost.set_editable(True)
示例15: setup_slaves
def setup_slaves(self):
SellableItemStep.setup_slaves(self)
self.hide_add_button()
self.cost.set_editable(True)
self.quantity.connect('validate', self._on_quantity__validate)