本文整理匯總了Python中stoqlib.domain.sellable.SellableCategory.get_base_categories方法的典型用法代碼示例。如果您正苦於以下問題:Python SellableCategory.get_base_categories方法的具體用法?Python SellableCategory.get_base_categories怎麽用?Python SellableCategory.get_base_categories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stoqlib.domain.sellable.SellableCategory
的用法示例。
在下文中一共展示了SellableCategory.get_base_categories方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_base_categories
# 需要導入模塊: from stoqlib.domain.sellable import SellableCategory [as 別名]
# 或者: from stoqlib.domain.sellable.SellableCategory import get_base_categories [as 別名]
def test_get_base_categories(self):
categories = SellableCategory.get_base_categories(self.store)
count = categories.count()
base_category = SellableCategory(description=u"Monitor",
store=self.store)
category = SellableCategory(description=u"LCD Monitor",
category=base_category,
store=self.store)
categories = SellableCategory.get_base_categories(self.store)
self.failUnless(base_category in categories)
self.failIf(category in categories)
self.assertEqual(categories.count(), count + 1)
示例2: _setup_widgets
# 需要導入模塊: from stoqlib.domain.sellable import SellableCategory [as 別名]
# 或者: from stoqlib.domain.sellable.SellableCategory import get_base_categories [as 別名]
def _setup_widgets(self):
# open inventory button
self.main_dialog.ok_button.set_label(_(u"_Open"))
# select all the branches that are able to open an inventory
branches = []
for branch in self._branches:
branches.append((branch.person.name, branch))
self.branch_combo.prefill(branches)
self.branch_combo.select(branches[0][1])
self.username.set_text(self.model.user.person.name)
self.open_time.set_text(self.model.open_date.strftime("%X"))
# load categories
self.category_tree.set_columns(self._get_columns())
for category in SellableCategory.get_base_categories(self.store):
self._append_category(category)
self.category_tree.connect(
'cell-edited', self._on_category_tree__cell_edited)
示例3: _setup_widgets
# 需要導入模塊: from stoqlib.domain.sellable import SellableCategory [as 別名]
# 或者: from stoqlib.domain.sellable.SellableCategory import get_base_categories [as 別名]
def _setup_widgets(self):
self.product_manufacturer.prefill(
api.for_combo(self.store.find(ProductManufacturer)))
self.product_brand.prefill(
[(m, m) for m in
sorted(Product.find_distinct_values(self.store, Product.brand))])
self.product_family.prefill(
[(m, m) for m in
sorted(Product.find_distinct_values(self.store, Product.family))])
self.username.set_text(self.model.user.person.name)
self.open_time.set_text(self.model.open_date.strftime("%X"))
# load categories
self.category_tree.set_columns(self._get_columns())
for category in SellableCategory.get_base_categories(self.store):
self._append_category(category)
self._uncategorized_products = self._append_category(
_UncategorizedProductsCategory())