本文整理汇总了Python中stoqlib.domain.product.Storable.is_batch方法的典型用法代码示例。如果您正苦于以下问题:Python Storable.is_batch方法的具体用法?Python Storable.is_batch怎么用?Python Storable.is_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.product.Storable
的用法示例。
在下文中一共展示了Storable.is_batch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_purchase_item
# 需要导入模块: from stoqlib.domain.product import Storable [as 别名]
# 或者: from stoqlib.domain.product.Storable import is_batch [as 别名]
def test_add_purchase_item(self):
receiving_order = self.create_receiving_order()
item = self.create_purchase_order_item()
with self.assertRaisesRegexp(ValueError, "The purchase item must be on "
"the same purchase of this receiving"):
receiving_order.add_purchase_item(item)
receiving_order = self.create_receiving_order()
item = self.create_purchase_order_item(receiving_order.purchase)
with self.assertRaisesRegexp(ValueError, "The quantity must be higher "
"than 0 and lower than the "
"purchase item's quantity"):
receiving_order.add_purchase_item(item, quantity=0)
receiving_order = self.create_receiving_order()
item = self.create_purchase_order_item(receiving_order.purchase)
item.quantity_received = 2
with self.assertRaisesRegexp(ValueError, "The quantity must be lower "
"than the item's pending "
"quantity"):
receiving_order.add_purchase_item(item, quantity=8)
storable = Storable(store=self.store, product=item.sellable.product)
storable.is_batch = True
p = receiving_order.add_purchase_item(item, batch_number=u'12')
self.assertEqual(p.batch.batch_number, u'12')
示例2: create_model
# 需要导入模块: from stoqlib.domain.product import Storable [as 别名]
# 或者: from stoqlib.domain.product.Storable import is_batch [as 别名]
def create_model(self, store):
self._model_created = True
sellable = Sellable(store=store)
model = Product(store=store, sellable=sellable)
no_storable = [Product.TYPE_WITHOUT_STOCK, Product.TYPE_PACKAGE]
if not self._product_type in no_storable:
storable = Storable(product=model, store=store)
if self._product_type == Product.TYPE_BATCH:
storable.is_batch = True
elif self._product_type == Product.TYPE_WITHOUT_STOCK:
model.manage_stock = False
elif self._product_type == Product.TYPE_CONSIGNED:
model.consignment = True
elif self._product_type == Product.TYPE_GRID:
model.is_grid = True
# Configurable products should not manage stock
model.manage_stock = False
elif self._product_type == Product.TYPE_PACKAGE:
model.is_package = True
# Package products should not manage stock
model.manage_stock = False
if self._template is not None:
sellable.tax_constant = self._template.sellable.tax_constant
sellable.unit = self._template.sellable.unit
sellable.category = self._template.sellable.category
sellable.base_price = self._template.sellable.base_price
sellable.cost = self._template.sellable.cost
model.manufacturer = self._template.manufacturer
model.brand = self._template.brand
model.family = self._template.family
model.ncm = self._template.ncm
model.icms_template = self._template.icms_template
model.ipi_template = self._template.ipi_template
for product_attr in self._template.attributes:
ProductAttribute(store=self.store,
product_id=model.id,
attribute_id=product_attr.attribute.id)
for supplier_info in self._template.suppliers:
ProductSupplierInfo(
store=self.store,
product=model,
supplier=supplier_info.supplier)
else:
sellable.tax_constant_id = sysparam.get_object_id(
'DEFAULT_PRODUCT_TAX_CONSTANT')
sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')
return model
示例3: create_model
# 需要导入模块: from stoqlib.domain.product import Storable [as 别名]
# 或者: from stoqlib.domain.product.Storable import is_batch [as 别名]
def create_model(self, store):
self._model_created = True
sellable = Sellable(store=store)
sellable.tax_constant_id = sysparam.get_object_id('DEFAULT_PRODUCT_TAX_CONSTANT')
sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')
model = Product(store=store, sellable=sellable)
if self._product_type != Product.TYPE_WITHOUT_STOCK:
storable = Storable(product=model, store=store)
if self._product_type == Product.TYPE_BATCH:
storable.is_batch = True
elif self._product_type == Product.TYPE_WITHOUT_STOCK:
model.manage_stock = False
elif self._product_type == Product.TYPE_CONSIGNED:
model.consignment = True
return model