本文整理汇总了Python中stoqlib.domain.product.Storable.get_stock_item方法的典型用法代码示例。如果您正苦于以下问题:Python Storable.get_stock_item方法的具体用法?Python Storable.get_stock_item怎么用?Python Storable.get_stock_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.product.Storable
的用法示例。
在下文中一共展示了Storable.get_stock_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIncreaseDecreaseStock
# 需要导入模块: from stoqlib.domain.product import Storable [as 别名]
# 或者: from stoqlib.domain.product.Storable import get_stock_item [as 别名]
def testIncreaseDecreaseStock(self):
branch = get_current_branch(self.store)
product = self.create_product()
storable = Storable(product=product, store=self.store)
stock_item = storable.get_stock_item(branch)
self.failIf(stock_item is not None)
storable.increase_stock(1, branch, 0, 0)
stock_item = storable.get_stock_item(branch)
self.assertEquals(stock_item.stock_cost, 0)
storable.increase_stock(1, branch, 0, 0, unit_cost=10)
stock_item = storable.get_stock_item(branch)
self.assertEquals(stock_item.stock_cost, 5)
stock_item = storable.decrease_stock(1, branch, 0, 0)
self.assertEquals(stock_item.stock_cost, 5)
storable.increase_stock(1, branch, 0, 0)
stock_item = storable.get_stock_item(branch)
self.assertEquals(stock_item.stock_cost, 5)
storable.increase_stock(2, branch, 0, 0, unit_cost=15)
stock_item = storable.get_stock_item(branch)
self.assertEquals(stock_item.stock_cost, 10)