本文整理汇总了Python中stoqlib.api.api.for_combo函数的典型用法代码示例。如果您正苦于以下问题:Python for_combo函数的具体用法?Python for_combo怎么用?Python for_combo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了for_combo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_widgets
def _setup_widgets(self):
devices = CardPaymentDevice.get_devices(self.method.store)
self.card_device.prefill(api.for_combo(devices))
providers = CreditProvider.get_card_providers(
self.method.store)
self.credit_provider.prefill(api.for_combo(providers))
self._radio_group = None
for ptype, name in CreditCardData.types.items():
self._add_card_type(name, ptype)
示例2: _setup_widgets
def _setup_widgets(self):
self.tax_constant.prefill(
api.for_combo(self.store.find(SellableTaxConstant)))
categories = set(self.store.find(SellableCategory,
SellableCategory.id != self.model.id))
# Remove all children recursively to avoid creating
# a circular hierarchy
categories -= self.model.get_children_recursively()
self.category.prefill(
api.for_combo(categories, attr='full_description'))
示例3: fields
def fields(self):
device_values = api.for_combo(
CardPaymentDevice.get_devices(self.store))
provider_values = api.for_combo(
CreditProvider.get_card_providers(self.store))
return collections.OrderedDict(
device=ChoiceField(_('Device'), proxy=True, mandatory=True,
values=device_values),
provider=ChoiceField(_('Provider'), proxy=True, mandatory=True,
values=provider_values),
auth=TextField(_('Authorization'), proxy=True, mandatory=True)
)
示例4: _setup_widgets
def _setup_widgets(self):
items = [(b.person.name, b)
for b in self.store.find(Branch)
if b is not self.branch]
self.destination_branch.prefill(locale_sorted(
items, key=operator.itemgetter(0)))
self.source_branch.set_text(self.branch.person.name)
employees = self.store.find(Employee)
self.source_responsible.prefill(api.for_combo(employees))
self.destination_responsible.prefill(api.for_combo(employees))
self.transfer_order.source_branch = self.branch
self.transfer_order.destination_branch = items[0][1]
示例5: _update_accounts
def _update_accounts(self):
if len(self._payments) != 1:
return
payment = self._payments[0]
create_transaction = payment.method.operation.create_transaction()
for combo in [self.destination_account, self.source_account]:
combo.set_sensitive(create_transaction)
if not create_transaction:
return
destination_combo = self.get_account_destination_combo()
for combo in [self.destination_account, self.source_account]:
combo.prefill(api.for_combo(
self.store.find(Account),
attr='long_description'))
if combo is destination_combo:
combo.select(payment.method.destination_account)
else:
combo.select(
sysparam.get_object(self.store, 'IMBALANCE_ACCOUNT'))
category_account = payment.category and payment.category.account
if category_account:
if payment.payment_type == payment.TYPE_IN:
self.source_account.select(category_account)
else:
self.destination_account.select(category_account)
示例6: testForComboAll
def testForComboAll(self):
client = self.create_client()
client.credit_limit = 99
clients = self.store.find(Client, credit_limit=99,
)
items = api.for_combo(clients)
self.assertEquals(items, [('Client', client)])
示例7: _setup_widgets
def _setup_widgets(self):
self._calc = CalculatorPopup(self.price, CalculatorPopup.MODE_SUB)
self.sale.set_text(unicode(self.model.sale.identifier))
self.description.set_text(self.model.sellable.get_description())
self.original_price.update(self.model.base_price)
self.price.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT,
step_incr=1, page_incr=10))
unit = self.model.sellable.unit
digits = QUANTITY_PRECISION if unit and unit.allow_fraction else 0
for widget in [self.quantity, self.reserved]:
widget.set_digits(digits)
widget.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT,
step_incr=1, page_incr=10))
manager = get_plugin_manager()
self.nfe_is_active = manager.is_active('nfe')
if not self.nfe_is_active:
self.cfop_label.hide()
self.cfop.hide()
if not self._can_reserve():
self.reserved.hide()
self.reserved_lbl.hide()
# We populate this even if it's hidden because we need a default value
# selected to add to the sale item
cfop_items = CfopData.get_for_sale(self.store)
self.cfop.prefill(api.for_combo(cfop_items))
self._update_total()
self.reserved.get_adjustment().set_upper(self.quantity_model.quantity)
示例8: _setup_widgets
def _setup_widgets(self):
self.total.set_bold(True)
purchase = self.model.purchase
if not purchase:
for widget in (self.purchase_number_label,
self.purchase_supplier_label,
self.identifier, self.supplier_label):
widget.hide()
elif purchase and purchase.is_paid():
for widget in (self.ipi, self.discount_value, self.icms_total,
self.secure_value, self.expense_value):
widget.set_sensitive(False)
self._setup_transporter_entry()
self._setup_freight_combo()
cfops = self.store.find(CfopData)
self.cfop.prefill(api.for_combo(cfops))
self.table.set_focus_chain([self.invoice_hbox,
self.cfop,
self.transporter,
self.freight_combo,
self.notes_box,
self.freight,
self.ipi,
self.icms_total,
self.discount_value,
self.secure_value,
self.expense_value])
示例9: test_for_combo_empty
def test_for_combo_empty(self):
client = self.create_client()
client.credit_limit = 99
results = self.store.find(Client, credit_limit=99)
items = api.for_combo(results,
empty=u'All')
self.assertEqual(items, [('All', None), ('Client', client)])
示例10: _setup_widgets
def _setup_widgets(self):
self.total.set_bold(True)
idents = sorted(p.identifier for p in self.purchases)
identifier = ', '.join(str(i) for i in idents)
self.identifier.set_text(identifier)
# TODO: Testar isso quando compras > 1
if len(self.purchases) == 1 and self.purchases[0].is_paid():
# This widgets would make the value of the installments change.
for widget in (self.ipi, self.discount_value, self.icms_total,
self.icms_st_total, self.secure_value, self.expense_value):
widget.set_sensitive(False)
# Only allow to edit the cfop if there is only one receiving for this invoice
self.cfop.set_sensitive(bool(not self.visual_mode and self._receiving_order))
self._setup_transporter_entry()
self._setup_freight_combo()
cfops = CfopData.get_for_receival(self.store)
self.cfop.prefill(api.for_combo(cfops))
self.table.set_focus_chain([self.invoice_hbox,
self.invoice_key,
self.cfop,
self.transporter,
self.freight_combo,
self.notes_box,
self.freight,
self.ipi,
self.icms_total,
self.icms_st_total,
self.discount_value,
self.secure_value,
self.expense_value])
示例11: _setup_widgets
def _setup_widgets(self):
self._calc = CalculatorPopup(self.price,
CalculatorPopup.MODE_SUB)
self.sale.set_text(unicode(self.model.sale.identifier))
self.description.set_text(self.model.sellable.get_description())
self.original_price.update(self.model.base_price)
for widget in [self.quantity, self.price]:
widget.set_adjustment(gtk.Adjustment(lower=1, upper=MAX_INT,
step_incr=1, page_incr=10))
self.reserved.set_adjustment(gtk.Adjustment(lower=0,
upper=self.quantity_model.quantity,
step_incr=1, page_incr=10))
first_page = self.tabs.get_nth_page(0)
self.tabs.set_tab_label_text(first_page, _(u'Basic'))
if not self.nfe_is_active:
self.cfop_label.hide()
self.cfop.hide()
if not self._can_reserve():
self.reserved.hide()
self.reserved_lbl.hide()
# We populate this even if it's hidden because we need a default value
# selected to add to the sale item
cfop_items = CfopData.get_for_sale(self.store)
self.cfop.prefill(api.for_combo(cfop_items))
self._setup_taxes()
self._update_total()
示例12: _setup_widgets
def _setup_widgets(self):
self.total.set_bold(True)
idents = sorted(p.identifier for p in self.purchases)
identifier = ', '.join(str(i) for i in idents)
self.identifier.set_text(identifier)
# TODO: Testar isso quando compras > 1
if len(self.purchases) == 1 and self.purchases[0].is_paid():
# This widgets would make the value of the installments change.
for widget in (self.ipi, self.discount_value, self.icms_total,
self.secure_value, self.expense_value):
widget.set_sensitive(False)
self._setup_transporter_entry()
self._setup_freight_combo()
cfops = self.store.find(CfopData)
self.cfop.prefill(api.for_combo(cfops))
self.table.set_focus_chain([self.invoice_hbox,
self.cfop,
self.transporter,
self.freight_combo,
self.notes_box,
self.freight,
self.ipi,
self.icms_total,
self.discount_value,
self.secure_value,
self.expense_value])
示例13: _setup_widgets
def _setup_widgets(self):
# Hide total and subtotal
self.table1.hide()
self.hbox4.hide()
# Hide invoice number details
self.invoice_number_label.hide()
self.invoice_number.hide()
# Hide cost center combobox
self.cost_center_lbl.hide()
self.cost_center.hide()
# Salesperson combo
salespersons = self.store.find(SalesPerson)
self.salesperson.prefill(api.for_person_combo(salespersons))
if not sysparam(self.store).ACCEPT_CHANGE_SALESPERSON:
self.salesperson.set_sensitive(False)
else:
self.salesperson.grab_focus()
# CFOP combo
if sysparam(self.store).ASK_SALES_CFOP:
cfops = self.store.find(CfopData)
self.cfop.prefill(api.for_combo(cfops))
else:
self.cfop_lbl.hide()
self.cfop.hide()
self.create_cfop.hide()
self.transporter_lbl.hide()
self.transporter.hide()
self.create_transporter.hide()
self._fill_clients_combo()
self._fill_clients_category_combo()
示例14: create_filters
def create_filters(self):
self.search.set_query(self._query)
self.set_text_field_columns(["description", "code", "barcode", "category_description", "manufacturer"])
branches = Branch.get_active_branches(self.store)
self.branch_filter = ComboSearchFilter(_("Show by:"), api.for_combo(branches, empty=_("All branches")))
self.branch_filter.select(api.get_current_branch(self.store))
self.add_filter(self.branch_filter, position=SearchFilterPosition.TOP)
示例15: testForComboAttr
def testForComboAttr(self):
individual = self.create_individual()
individual.father_name = u'Daddy'
individual.mother_name = u'Mommy'
results = self.store.find(Individual, father_name=u'Daddy')
items = api.for_combo(results, attr=u'mother_name')
self.assertEquals(items, [('Mommy', individual)])