Esempio n. 1
0
 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))
Esempio n. 2
0
 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))
Esempio n. 3
0
 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))
Esempio n. 4
0
 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))