本文整理汇总了Python中stoqlib.domain.base.Domain.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.__init__方法的具体用法?Python Domain.__init__怎么用?Python Domain.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.base.Domain
的用法示例。
在下文中一共展示了Domain.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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: __init__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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)
示例6: __init__
# 需要导入模块: from stoqlib.domain.base import Domain [as 别名]
# 或者: from stoqlib.domain.base.Domain import __init__ [as 别名]
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)