Exemple #1
0
    def __init__(self, store=None,
                 category=None,
                 cost=None,
                 commission=None,
                 description=None,
                 price=None):
        """Creates a new sellable
        :param store: a store
        :param category: category of this sellable
        :param cost: the cost, defaults to 0
        :param commission: commission for this sellable
        :param description: readable description of the sellable
        :param price: the price, defaults to 0
        """

        Domain.__init__(self, store=store)

        if category:
            if commission is None:
                commission = category.get_commission()
            if price is None and cost is not None:
                markup = category.get_markup()
                price = self._get_price_by_markup(markup, cost=cost)

        self.category = category
        self.commission = commission or currency(0)
        self.cost = cost or currency(0)
        self.description = description
        self.price = price or currency(0)
Exemple #2
0
    def __init__(self,
                 store=None,
                 category=None,
                 cost=None,
                 commission=None,
                 description=None,
                 price=None):
        """Creates a new sellable
        :param store: a store
        :param category: category of this sellable
        :param cost: the cost, defaults to 0
        :param commission: commission for this sellable
        :param description: readable description of the sellable
        :param price: the price, defaults to 0
        """

        Domain.__init__(self, store=store)

        if category:
            if commission is None:
                commission = category.get_commission()
            if price is None and cost is not None:
                markup = category.get_markup()
                price = self._get_price_by_markup(markup, cost=cost)

        self.category = category
        self.commission = commission or currency(0)
        self.cost = cost or currency(0)
        self.description = description
        self.price = price or currency(0)
Exemple #3
0
 def __init__(self, store=None, **kw):
     Domain.__init__(self, store=store, **kw)
     # These miss default parameters and needs to be set before
     # cfop, which triggers an implicit flush.
     self.branch = kw.pop('branch', None)
     if not 'cfop' in kw:
         self.cfop = sysparam.get_object(store, 'DEFAULT_RECEIVING_CFOP')
Exemple #4
0
 def __init__(self, store=None, **kw):
     Domain.__init__(self, store=store, **kw)
     # These miss default parameters and needs to be set before
     # cfop, which triggers an implicit flush.
     self.branch = kw.pop('branch', None)
     self.supplier = kw.pop('supplier', None)
     if not 'cfop' in kw:
         self.cfop = sysparam.get_object(store, 'DEFAULT_RECEIVING_CFOP')
Exemple #5
0
 def __init__(self, store=None, **kw):
     Domain.__init__(self, store=store, **kw)
     # These miss default parameters and needs to be set before
     # cfop, which triggers an implicit flush.
     self.branch = kw.pop("branch", None)
     self.purchase = kw.pop("purchase", None)
     self.supplier = kw.pop("supplier", None)
     if not "cfop" in kw:
         self.cfop = sysparam.get_object(store, "DEFAULT_RECEIVING_CFOP")
Exemple #6
0
 def __init__(self, store=None, **kw):
     Domain.__init__(self, store=store, **kw)
     # These miss default parameters and needs to be set before
     # cfop, which triggers an implicit flush.
     self.branch = kw.pop('branch', None)
     self.purchase = kw.pop('purchase', None)
     self.supplier = kw.pop('supplier', None)
     if not 'cfop' in kw:
         self.cfop = sysparam(store).DEFAULT_RECEIVING_CFOP
Exemple #7
0
    def __init__(self, store=None, **kw):
        if not 'sellable' in kw:
            raise TypeError('You must provide a sellable argument')
        if not 'order' in kw:
            raise TypeError('You must provide a order argument')

        # FIXME: Avoding shadowing sellable.cost
        kw['base_cost'] = kw['sellable'].cost

        if not 'cost' in kw:
            kw['cost'] = kw['sellable'].cost

        Domain.__init__(self, store=store, **kw)
Exemple #8
0
    def __init__(self, store=None, **kw):
        if not 'sellable' in kw:
            raise TypeError('You must provide a sellable argument')
        if not 'order' in kw:
            raise TypeError('You must provide a order argument')

        # FIXME: Avoding shadowing sellable.cost
        kw['base_cost'] = kw['sellable'].cost

        if not 'cost' in kw:
            kw['cost'] = kw['sellable'].cost

        Domain.__init__(self, store=store, **kw)
Exemple #9
0
 def __init__(self, store=None, **kw):
     if not "kw" in kw:
         if not "sellable" in kw:
             raise TypeError("You must provide a sellable argument")
     Domain.__init__(self, store=store, **kw)
Exemple #10
0
 def __init__(self, store=None, **kw):
     if not 'kw' in kw:
         if not 'sellable' in kw:
             raise TypeError('You must provide a sellable argument')
     Domain.__init__(self, store=store, **kw)
Exemple #11
0
 def __init__(self, store=None, **kw):
     if not "value" in kw:
         raise TypeError("You must provide a value argument")
     if not "base_value" in kw or not kw["base_value"]:
         kw["base_value"] = kw["value"]
     Domain.__init__(self, store=store, **kw)
 def _purchase_clone():
     self.purchase_clone = Domain.clone(self.purchase)
     return self.purchase_clone
Exemple #13
0
 def __init__(self, store=None, sellable=None, **kw):
     if sellable is None:
         raise TypeError('You must provide a sellable argument')
     Domain.__init__(self, store=store, sellable=sellable, **kw)
 def _purchase_clone():
     self.purchase_clone = Domain.clone(self.purchase)
     return self.purchase_clone
Exemple #15
0
 def __init__(self, store=None, **kw):
     if not 'value' in kw:
         raise TypeError('You must provide a value argument')
     if not 'base_value' in kw or not kw['base_value']:
         kw['base_value'] = kw['value']
     Domain.__init__(self, store=store, **kw)
Exemple #16
0
 def __init__(self, store=None, **kw):
     if not 'value' in kw:
         raise TypeError('You must provide a value argument')
     if not 'base_value' in kw or not kw['base_value']:
         kw['base_value'] = kw['value']
     Domain.__init__(self, store=store, **kw)
Exemple #17
0
 def __init__(self, store=None, **kw):
     if not 'kw' in kw:
         if not 'sellable' in kw:
             raise TypeError('You must provide a sellable argument')
     Domain.__init__(self, store=store, **kw)