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


Python production.ProductionProducedItem类代码示例

本文整理汇总了Python中stoqlib.domain.production.ProductionProducedItem的典型用法代码示例。如果您正苦于以下问题:Python ProductionProducedItem类的具体用法?Python ProductionProducedItem怎么用?Python ProductionProducedItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ProductionProducedItem类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_valid_serial_range

 def test_is_valid_serial_range(self):
     pitem = ProductionProducedItem(store=self.store)
     pitem.product = self.create_product()
     self.assertTrue(ProductionProducedItem.is_valid_serial_range(
         pitem.product, 1, 2, self.store))
     pitem.serial_number = 1
     self.assertFalse(ProductionProducedItem.is_valid_serial_range(
         pitem.product, 1, 2, self.store))
开发者ID:hackedbellini,项目名称:stoq,代码行数:8,代码来源:test_production.py

示例2: test_get_last_serial_number

    def test_get_last_serial_number(self):
        pitem = ProductionProducedItem(store=self.store)
        pitem.product = self.create_product()
        last = ProductionProducedItem.get_last_serial_number(pitem.product, self.store)
        self.assertEquals(last, 0)

        pitem.serial_number = 10
        last = ProductionProducedItem.get_last_serial_number(pitem.product, self.store)
        self.assertEquals(last, 10)
开发者ID:amaurihamasu,项目名称:stoq,代码行数:9,代码来源:test_production.py

示例3: test_get_or_create_multiple_with_null

    def test_get_or_create_multiple_with_null(self):
        # Check if get_or_creating is working properly when using references
        # with null values.
        item_a = ProductionProducedItem.get_or_create(
            self.store, serial_number=456, product=None)

        self.assertEquals(item_a.serial_number, 456)
        self.assertEquals(item_a.product, None)

        item_b = ProductionProducedItem.get_or_create(
            self.store, serial_number=456, product=None)
        self.assertEquals(item_a, item_b)
开发者ID:rosalin,项目名称:stoq,代码行数:12,代码来源:test_domain.py

示例4: on_serial_number__validate

 def on_serial_number__validate(self, widget, value):
     qty = self._parent.quantity.read()
     if qty is ValueUnset:
         qty = 0
     first = value
     last = value + qty - 1
     if not ProductionProducedItem.is_valid_serial_range(self._product,
                                                         first, last, self.store):
         return ValidationError(_('There already is a serial number in '
                                  'the range %d - %d') % (first, last))
开发者ID:marianaanselmo,项目名称:stoq,代码行数:10,代码来源:productionslave.py

示例5: test_get_or_create_multiple

    def test_get_or_create_multiple(self):
        # This test is for  get_or_create call with more than one property
        product = self.create_product()

        # Make sure there is no item yet.
        item = self.store.find(ProductionProducedItem, serial_number=123,
                               product=product).one()
        self.assertEquals(item, None)

        # First call to get_or_create should create the object.
        item_a = ProductionProducedItem.get_or_create(
            self.store, serial_number=123, product=product)
        # And set the properties given
        self.assertEquals(item_a.serial_number, 123)
        self.assertEquals(item_a.product, product)

        # The second call to get_or_create should return the same object
        item_b = ProductionProducedItem.get_or_create(
            self.store, serial_number=123, product=product)
        self.assertEquals(item_a, item_b)
开发者ID:rosalin,项目名称:stoq,代码行数:20,代码来源:test_domain.py

示例6: test_send_to_stock

    def test_send_to_stock(self):
        pitem = ProductionProducedItem(store=self.store)
        pitem.order = self.create_production_order()
        pitem.product = self.create_storable().product
        pitem.send_to_stock()

        self.assertTrue(
            self.store.find(StockTransactionHistory,
                            object_id=pitem.id,
                            type=StockTransactionHistory.TYPE_PRODUCTION_SENT).one())
        pitem.send_to_stock()
        self.assertTrue(
            self.store.find(StockTransactionHistory,
                            object_id=pitem.id,
                            type=StockTransactionHistory.TYPE_PRODUCTION_SENT).one())
开发者ID:hackedbellini,项目名称:stoq,代码行数:15,代码来源:test_production.py

示例7: create_model

 def create_model(self, store):
     serial = ProductionProducedItem.get_last_serial_number(
         self._product, store)
     return Settable(serial_number=serial + 1)
开发者ID:marianaanselmo,项目名称:stoq,代码行数:4,代码来源:productionslave.py

示例8: test_get_pending_tests

 def test_get_pending_tests(self):
     pitem = ProductionProducedItem(store=self.store)
     pitem.product = self.create_product()
     self.assertEqual(pitem.get_pending_tests(), [])
开发者ID:hackedbellini,项目名称:stoq,代码行数:4,代码来源:test_production.py


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