本文整理汇总了Python中stoqlib.gui.slaves.paymentslave.MultipleMethodSlave类的典型用法代码示例。如果您正苦于以下问题:Python MultipleMethodSlave类的具体用法?Python MultipleMethodSlave怎么用?Python MultipleMethodSlave使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MultipleMethodSlave类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _PaymentsEditor
class _PaymentsEditor(BaseEditor):
"""Editor that offers a generic entry to input a string value."""
gladefile = "HolderTemplate"
title = _('Payments Editor')
model_type = object
size = (-1, 400)
def setup_slaves(self):
register_payment_slaves()
self.slave = MultipleMethodSlave(self, self, self.store,
self.model, None, currency(0),
finish_on_total=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
def on_confirm(self):
for payment in self.slave.payments:
if payment.is_preview():
payment.set_pending()
# Mimic a Wizard, so that we can use the payment slaves
def refresh_next(self, valid):
pass
def disable_back(self):
pass
开发者ID:LeonamSilva,项目名称:stoq,代码行数:26,代码来源:paymentseditor.py
示例2: _PaymentsEditor
class _PaymentsEditor(BaseEditor):
"""Editor that offers a generic entry to input a string value."""
gladefile = "HolderTemplate"
title = _('Payments Editor')
model_type = object
size = (-1, 400)
def __init__(self, store, model):
BaseEditor.__init__(self, store, model)
self.update_fully_paid(self._slave_valid)
def update_fully_paid(self, fully_paid): # pragma no cover
"""This gets called every time the user creates or removes a payment
Subclasses can override this method if the model requires aditional
decision if the model is fully paid or not
"""
pass
def setup_slaves(self):
register_payment_slaves()
self.slave = MultipleMethodSlave(self, self, self.store,
order=self.model,
outstanding_value=currency(0),
finish_on_total=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
def on_confirm(self):
for payment in self.slave.payments:
if payment.is_preview():
payment.set_pending()
# Set the payment status to paid for credit method.
# This avoid the credit to be used on another sale.
if payment.is_pending() and payment.method.method_name == u'credit':
payment.pay()
# Mimic a Wizard, so that we can use the payment slaves
def refresh_next(self, valid):
# setup_slaves gets called before BaseEditor is finished constructing
# itself. If this is the case, save the valid state so we can refresh
# later
if not hasattr(self, 'main_dialog'):
self._slave_valid = valid
return
self.update_fully_paid(valid)
def disable_back(self):
pass
开发者ID:Guillon88,项目名称:stoq,代码行数:50,代码来源:paymentseditor.py
示例3: setup_slaves
def setup_slaves(self):
register_payment_slaves()
self.slave = MultipleMethodSlave(self, self, self.store,
self.model, None, currency(0),
finish_on_total=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
开发者ID:Joaldino,项目名称:stoq,代码行数:7,代码来源:paymentseditor.py
示例4: CloseConsignmentPaymentStep
class CloseConsignmentPaymentStep(BaseWizardStep):
gladefile = 'HolderTemplate'
slave_holder = 'place_holder'
def __init__(self, wizard, previous, store, consignment,
outstanding_value=Decimal(0)):
self._method = PaymentMethod.get_by_name(store, u'money')
BaseWizardStep.__init__(self, store, wizard, previous=None)
self._consignment = consignment
self._outstanding_value = outstanding_value
self._setup_slaves()
def _setup_slaves(self):
self.slave = MultipleMethodSlave(self.wizard, self, self.store,
self.store.fetch(self._consignment),
None, self._outstanding_value,
finish_on_total=False)
self.attach_slave('place_holder', self.slave)
def _validate_step(self, value):
can_finish = value and self.slave.can_confirm()
self.wizard.refresh_next(can_finish)
def validate_step(self):
return True
def post_init(self):
self.register_validate_function(self._validate_step)
self.force_validation()
self._validate_step(False)
self.wizard.enable_finish()
def has_next_step(self):
return False
开发者ID:hackedbellini,项目名称:stoq,代码行数:34,代码来源:consignmentwizard.py
示例5: SaleReturnPaymentStep
class SaleReturnPaymentStep(WizardEditorStep):
gladefile = 'HolderTemplate'
model_type = ReturnedSale
#
# WizardEditorStep
#
def post_init(self):
self.register_validate_function(self._validation_func)
self.force_validation()
before_debt = currency(self.model.sale_total - self.model.paid_total)
now_debt = currency(before_debt - self.model.returned_total)
short = _("The client's debt has changed. "
"Use this step to adjust the payments.")
longdesc = _("The debt before was %s and now is %s. Cancel some unpaid "
"installments and create new ones.")
info(short,
longdesc % (converter.as_string(currency, before_debt),
converter.as_string(currency, now_debt)))
def setup_slaves(self):
register_payment_slaves()
outstanding_value = (self.model.total_amount_abs +
self.model.paid_total)
self.slave = MultipleMethodSlave(self.wizard, self, self.store,
self.model, None,
outstanding_value=outstanding_value,
finish_on_total=False,
allow_remove_paid=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
def validate_step(self):
return True
def has_next_step(self):
return False
#
# Callbacks
#
def _validation_func(self, value):
can_finish = value and self.slave.can_confirm()
self.wizard.refresh_next(can_finish)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:47,代码来源:salereturnwizard.py
示例6: SaleQuotePaymentStep
class SaleQuotePaymentStep(WizardEditorStep):
"""A step for creating payments for a |sale|
All this step does is to attach
:class:`stoqlib.gui.slaves.paymentslave.MultipleMethodSlave`, so
see it for more information
"""
gladefile = 'HolderTemplate'
model_type = Sale
#
# WizardEditorStep
#
def post_init(self):
self.register_validate_function(self._validation_func)
self.force_validation()
missing_value = self.slave.get_missing_change_value()
if missing_value < 0:
info(_(u"Your payments total is greater than the sale total. Maybe"
" you want to correct them."))
def setup_slaves(self):
register_payment_slaves()
self.slave = MultipleMethodSlave(
wizard=self.wizard,
parent=self,
store=self.store,
order=self.model,
payment_method=None,
finish_on_total=False,
allow_remove_paid=False,
require_total_value=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
def has_next_step(self):
return False
#
# Callbacks
#
def _validation_func(self, value):
can_finish = value and self.slave.can_confirm()
self.wizard.refresh_next(can_finish)
开发者ID:hackedbellini,项目名称:stoq,代码行数:47,代码来源:salequotewizard.py
示例7: setup_slaves
def setup_slaves(self):
register_payment_slaves()
outstanding_value = (self.model.total_amount_abs +
self.model.paid_total)
self.slave = MultipleMethodSlave(self.wizard, self, self.store,
self.model, None,
outstanding_value=outstanding_value,
finish_on_total=False,
allow_remove_paid=False)
self.slave.enable_remove()
self.attach_slave('place_holder', self.slave)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:11,代码来源:salereturnwizard.py
示例8: _setup_slaves
def _setup_slaves(self):
self.slave = MultipleMethodSlave(self.wizard, self, self.store,
self.store.fetch(self._consignment),
None, self._outstanding_value,
finish_on_total=False)
self.attach_slave('place_holder', self.slave)
开发者ID:hackedbellini,项目名称:stoq,代码行数:6,代码来源:consignmentwizard.py
注:本文中的stoqlib.gui.slaves.paymentslave.MultipleMethodSlave类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论