本文整理汇总了Python中stoqlib.domain.sellable.Sellable.barcode方法的典型用法代码示例。如果您正苦于以下问题:Python Sellable.barcode方法的具体用法?Python Sellable.barcode怎么用?Python Sellable.barcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.sellable.Sellable
的用法示例。
在下文中一共展示了Sellable.barcode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_one
# 需要导入模块: from stoqlib.domain.sellable import Sellable [as 别名]
# 或者: from stoqlib.domain.sellable.Sellable import barcode [as 别名]
def process_one(self, data, fields, store):
tax = store.fetch(self.tax_constant)
sellable = Sellable(store=store,
description=data.description,
price=int(data.price),
cost=int(data.cost))
sellable.tax_constant = tax
sellable.code = data.barcode
sellable.barcode = data.barcode
Service(sellable=sellable,
store=store)
示例2: process_one
# 需要导入模块: from stoqlib.domain.sellable import Sellable [as 别名]
# 或者: from stoqlib.domain.sellable.Sellable import barcode [as 别名]
def process_one(self, data, fields, store):
base_category = self._get_or_create(
SellableCategory,
store,
suggested_markup=Decimal(data.markup),
salesperson_commission=Decimal(data.commission),
category=None,
description=data.base_category,
)
# create a commission source
self._get_or_create(
CommissionSource,
store,
direct_value=Decimal(data.commission),
installments_value=Decimal(data.commission2),
category=base_category,
)
category = self._get_or_create(
SellableCategory,
store,
description=data.category,
suggested_markup=Decimal(data.markup2),
category=base_category,
)
sellable = Sellable(
store=store,
cost=Decimal(data.cost),
category=category,
description=data.description,
price=Decimal(data.price),
)
sellable.barcode = data.barcode
sellable.code = u"%02d" % self._code
self._code += 1
if u"unit" in fields:
if not data.unit in self.units:
raise ValueError(u"invalid unit: %s" % data.unit)
sellable.unit = store.fetch(self.units[data.unit])
sellable.tax_constant_id = self.tax_constant_id
product = Product(sellable=sellable, store=store)
supplier = store.fetch(self.supplier)
ProductSupplierInfo(
store=store, supplier=supplier, is_main_supplier=True, base_cost=Decimal(data.cost), product=product
)
Storable(product=product, store=store)
示例3: testSell
# 需要导入模块: from stoqlib.domain.sellable import Sellable [as 别名]
# 或者: from stoqlib.domain.sellable.Sellable import barcode [as 别名]
def testSell(self):
sale = self.create_sale()
sellable = Sellable(store=self.store)
sellable.barcode = u'xyz'
product = Product(sellable=sellable, store=self.store)
sale_item = sale.add_sellable(product.sellable)
branch = get_current_branch(self.store)
storable = self.create_storable(product, branch, 2)
stock_item = storable.get_stock_item(branch)
assert stock_item is not None
current_stock = stock_item.quantity
if current_stock:
storable.decrease_stock(current_stock, branch, 0, 0)
assert not storable.get_stock_item(branch).quantity
sold_qty = 2
storable.increase_stock(sold_qty, branch, 0, 0)
assert storable.get_stock_item(branch) is not None
assert storable.get_stock_item(branch).quantity == sold_qty
# now setting the proper sold quantity in the sellable item
sale_item.quantity = sold_qty
sale_item.sell(branch)
assert not storable.get_stock_item(branch).quantity