本文整理汇总了Python中stoqlib.domain.sellable.Sellable.code方法的典型用法代码示例。如果您正苦于以下问题:Python Sellable.code方法的具体用法?Python Sellable.code怎么用?Python Sellable.code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.sellable.Sellable
的用法示例。
在下文中一共展示了Sellable.code方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_one
# 需要导入模块: from stoqlib.domain.sellable import Sellable [as 别名]
# 或者: from stoqlib.domain.sellable.Sellable import code [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 code [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: create_sellable
# 需要导入模块: from stoqlib.domain.sellable import Sellable [as 别名]
# 或者: from stoqlib.domain.sellable.Sellable import code [as 别名]
def create_sellable(self, price=None, product=True, description=u"Description", code=u""):
from stoqlib.domain.product import Product
from stoqlib.domain.service import Service
from stoqlib.domain.sellable import Sellable
tax_constant = sysparam(self.store).DEFAULT_PRODUCT_TAX_CONSTANT
if price is None:
price = 10
sellable = Sellable(cost=125, price=price, description=description, store=self.store)
sellable.code = code
sellable.tax_constant = tax_constant
if product:
Product(sellable=sellable, store=self.store)
else:
Service(sellable=sellable, store=self.store)
return sellable