本文整理汇总了Python中stoqlib.domain.inventory.Inventory.has_open方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.has_open方法的具体用法?Python Inventory.has_open怎么用?Python Inventory.has_open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.has_open方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_view
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def _update_view(self):
self.proxy.update("status_str")
has_open_inventory = bool(Inventory.has_open(self.store, api.get_current_branch(self.store)))
tab = self._get_tab("execution_holder")
# If it's not opened, it's at least approved.
# So, we can enable the execution slave
tab.set_sensitive(
self.model.status == WorkOrder.STATUS_WORK_IN_PROGRESS and not has_open_inventory and not self.visual_mode
)
has_items = bool(self.model.order_items.count())
if self.model.can_approve():
label = _("Approve")
elif self.model.can_work() and not has_items:
label = _("Start")
elif self.model.can_work():
label = _("Continue")
elif self.model.can_pause():
label = _("Pause")
else:
label = ""
self.toggle_status_btn.set_label(label)
self.toggle_status_btn.set_sensitive(not self.visual_mode and self.model.client is not None)
self.toggle_status_btn.set_visible(bool(label))
stock_id, tooltip = get_workorder_state_icon(self.model)
if stock_id is not None:
self.state_icon.set_from_stock(stock_id, gtk.ICON_SIZE_MENU)
self.state_icon.set_visible(True)
self.state_icon.set_tooltip_text(tooltip)
else:
self.state_icon.hide()
示例2: _can_open
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def _can_open(self):
branch = api.get_current_branch(self.store)
if Inventory.has_open(self.store, branch):
return False
# It doesn't make sense to open an inventory if we don't have any stock
return self.store.find(ProductStockItem, branch=branch).count() > 0
示例3: new_sale
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def new_sale(self):
store = self.window.store
if Inventory.has_open(store, api.get_current_branch(store)):
warning(_("You cannot create a quote with an open inventory."))
return
with api.new_store() as store:
run_dialog(SaleQuoteWizard, None, store)
示例4: setup_proxies
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def setup_proxies(self):
# Avoid changing widget states in __init__, so that plugins have a
# chance to override the default settings
has_open_inventory = Inventory.has_open(self.store,
api.get_current_branch(self.store))
self.receive_now.set_sensitive(not bool(has_open_inventory))
self._setup_transporter_entry()
self.proxy = self.add_proxy(self.model, self.proxy_widgets)
示例5: _setup_widgets
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def _setup_widgets(self):
self.edit_button.set_sensitive(False)
if not self.visual_mode:
self.start_production_check.hide()
has_open_inventory = Inventory.has_open(self.store,
get_current_branch(self.store))
self.start_production_check.set_sensitive(not bool(has_open_inventory))
self.materials.set_columns(self._get_columns())
for production_item in self.model.get_items():
self._add_materials(production_item)
示例6: new_sale_with_wo
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def new_sale_with_wo(self):
store = self.window.store
if Inventory.has_open(store, api.get_current_branch(store)):
warning(_("You cannot create a quote with an open inventory."))
return
with api.new_store() as store:
run_dialog(WorkOrderQuoteWizard, None, store)
if store.committed:
# We are unable to just refresh the ui, so 'deactivate' and
# 'activate' the launcher to mimic the refresh
self.window.switch_application('launcher')
示例7: _get_available_branches_to_inventory
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def _get_available_branches_to_inventory(self):
"""Returns a list of branches where we can open an inventory.
Note that we can open a inventory if:
- There's no inventory opened yet (in the same branch)
- The branch must have some stock
"""
available_branches = []
for branch in self._get_branches():
has_open_inventory = Inventory.has_open(self.store, branch)
if not has_open_inventory:
stock = self.store.find(ProductStockItem, branch=branch)
if stock.count() > 0:
available_branches.append(branch)
return available_branches
示例8: has_open_inventory
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def has_open_inventory(self):
has_open = Inventory.has_open(self.store,
api.get_current_branch(self.store))
return bool(has_open)
示例9: _has_open_inventory
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def _has_open_inventory(self):
store = self._parent.store
has_open = Inventory.has_open(store, api.get_current_branch(store))
return bool(has_open)
示例10: has_open_inventory
# 需要导入模块: from stoqlib.domain.inventory import Inventory [as 别名]
# 或者: from stoqlib.domain.inventory.Inventory import has_open [as 别名]
def has_open_inventory(self):
return Inventory.has_open(self.store,
api.get_current_branch(self.store))