當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。