当前位置: 首页>>代码示例>>Python>>正文


Python Sellable.barcode方法代码示例

本文整理汇总了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)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:14,代码来源:serviceimporter.py

示例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)
开发者ID:stoq,项目名称:stoq,代码行数:52,代码来源:productimporter.py

示例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
开发者ID:romaia,项目名称:stoq,代码行数:25,代码来源:test_product.py


注:本文中的stoqlib.domain.sellable.Sellable.barcode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。