Example #1
0
def ensure_sellable_constants(store):
    """ Create native sellable constants. """
    log.info("Creating sellable units")
    unit_list = [(u"Kg", UnitType.WEIGHT), (u"Lt", UnitType.LITERS),
                 (u"m ", UnitType.METERS)]
    for desc, enum in unit_list:
        SellableUnit(description=desc, unit_index=int(enum), store=store)

    log.info("Creating sellable tax constants")
    for enum in [
            TaxType.SUBSTITUTION, TaxType.EXEMPTION, TaxType.NONE,
            TaxType.SERVICE
    ]:
        desc = describe_constant(enum)
        SellableTaxConstant(description=desc,
                            tax_type=int(enum),
                            tax_value=None,
                            store=store)
Example #2
0
 def test_get_description(self):
     unit = SellableUnit(store=self.store, description=u'foo')
     self.assertEqual(unit.get_description(), u'foo')
Example #3
0
 def create_model(self, store):
     return SellableUnit(store=store, description=u'')
Example #4
0
 def test_get_description(self):
     unit = SellableUnit(store=self.store,
                         description=u'foo')
     self.assertEqual(unit.get_description(), u'foo')
Example #5
0
 def create_sellable_unit(self, description=u'', allow_fraction=True):
     from stoqlib.domain.sellable import SellableUnit
     return SellableUnit(store=self.store,
                         description=description,
                         allow_fraction=allow_fraction)