Пример #1
0
 def create_model(self, store):
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, self.store)
     sellable = Sellable(description=u"", price=currency(0), store=store)
     sellable.tax_constant = tax_constant
     sellable.unit_id = sysparam.get_object_id("SUGGESTED_UNIT")
     model = Service(sellable=sellable, store=store)
     return model
Пример #2
0
    def _set_product_tax_constant_default(self, store):
        if self.has_object("DEFAULT_PRODUCT_TAX_CONSTANT"):
            return

        from stoqlib.domain.sellable import SellableTaxConstant
        tax_constant = SellableTaxConstant.get_by_type(TaxType.NONE, store)
        self.set_object(store, "DEFAULT_PRODUCT_TAX_CONSTANT", tax_constant)
Пример #3
0
    def _set_product_tax_constant_default(self, store):
        if self.has_object("DEFAULT_PRODUCT_TAX_CONSTANT"):
            return

        from stoqlib.domain.sellable import SellableTaxConstant
        tax_constant = SellableTaxConstant.get_by_type(TaxType.NONE, store)
        self.set_object(store, "DEFAULT_PRODUCT_TAX_CONSTANT", tax_constant)
Пример #4
0
    def __init__(self):
        super(ServiceImporter, self).__init__()
        default_store = get_default_store()
        self.tax_constant = SellableTaxConstant.get_by_type(
            TaxType.SERVICE, default_store)

        self._code = 11
        assert self.tax_constant
Пример #5
0
 def create_model(self, store):
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE,
                                                    self.store)
     sellable = Sellable(description=u'', price=currency(0), store=store)
     sellable.tax_constant = tax_constant
     sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')
     model = Service(sellable=sellable, store=store)
     return model
Пример #6
0
    def __init__(self):
        super(ServiceImporter, self).__init__()
        default_store = get_default_store()
        self.tax_constant = SellableTaxConstant.get_by_type(
            TaxType.SERVICE, default_store)

        self._code = 11
        assert self.tax_constant
Пример #7
0
    def _create_product_tax_constant(self):
        from stoqlib.domain.sellable import SellableTaxConstant
        key = u"DEFAULT_PRODUCT_TAX_CONSTANT"
        if self.get_parameter_by_field(key, SellableTaxConstant):
            return

        tax_constant = SellableTaxConstant.get_by_type(
            TaxType.NONE, self.store)
        self._set_schema(key, tax_constant.id)
Пример #8
0
    def create_service(self, description=u"Description", price=10):
        from stoqlib.domain.sellable import Sellable, SellableTaxConstant
        from stoqlib.domain.service import Service

        tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, self.store)
        sellable = Sellable(price=price, description=description, store=self.store)
        sellable.tax_constant = tax_constant
        service = Service(sellable=sellable, store=self.store)
        return service
Пример #9
0
 def _set_delivery_default(self, store):
     if self.has_object("DELIVERY_SERVICE"):
         return
     from stoqlib.domain.sellable import (Sellable, SellableTaxConstant)
     from stoqlib.domain.service import Service
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, store)
     sellable = Sellable(store=store, description=_(u'Delivery'))
     sellable.tax_constant = tax_constant
     service = Service(sellable=sellable, store=store)
     self.set_object(store, "DELIVERY_SERVICE", service)
Пример #10
0
 def create_model(self, store):
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, self.store)
     sellable = Sellable(description=u'',
                         price=currency(0),
                         store=store)
     sellable.status = Sellable.STATUS_AVAILABLE
     sellable.tax_constant = tax_constant
     sellable.unit = sysparam(self.store).SUGGESTED_UNIT
     model = Service(sellable=sellable, store=store)
     return model
Пример #11
0
    def _set_delivery_default(self, store):
        if self.has_object("DELIVERY_SERVICE"):
            return
        from stoqlib.domain.sellable import Sellable, SellableTaxConstant
        from stoqlib.domain.service import Service

        tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, store)
        sellable = Sellable(store=store, description=_(u"Delivery"))
        sellable.tax_constant = tax_constant
        service = Service(sellable=sellable, store=store)
        self.set_object(store, "DELIVERY_SERVICE", service)
Пример #12
0
 def create_service(self, description=u'Description', price=10):
     from stoqlib.domain.sellable import Sellable, SellableTaxConstant
     from stoqlib.domain.service import Service
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE,
                                                    self.store)
     sellable = Sellable(price=price,
                         description=description,
                         store=self.store)
     sellable.tax_constant = tax_constant
     service = Service(sellable=sellable, store=self.store)
     return service
Пример #13
0
 def create_delivery_service(self):
     from stoqlib.domain.sellable import (Sellable,
                                          SellableTaxConstant)
     from stoqlib.domain.service import Service
     key = u"DELIVERY_SERVICE"
     store = new_store()
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, store)
     sellable = Sellable(description=_(u'Delivery'),
                         store=store)
     sellable.tax_constant = tax_constant
     service = Service(sellable=sellable, store=store)
     self._set_schema(key, service.id)
     store.commit(close=True)
Пример #14
0
 def get_taxes(self):
     service_tax = SellableTaxConstant.get_by_type(TaxType.SERVICE,
                                                   self.store)
     return [(_(u'No tax'), None), (service_tax.description, service_tax)]
Пример #15
0
 def get_taxes(self):
     service_tax = SellableTaxConstant.get_by_type(TaxType.SERVICE,
                                                   self.store)
     return [(_(u'No tax'), None), (service_tax.description, service_tax)]