本文整理汇总了Python中stoqlib.domain.base.Domain类的典型用法代码示例。如果您正苦于以下问题:Python Domain类的具体用法?Python Domain怎么用?Python Domain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Domain类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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')
示例3: __init__
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)
示例4: __init__
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)
示例5: _purchase_clone
def _purchase_clone():
self.purchase_clone = Domain.clone(self.purchase)
return self.purchase_clone
示例6: __init__
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)
示例7: __init__
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)