本文整理汇总了Python中stoqlib.api.api.for_person_combo函数的典型用法代码示例。如果您正苦于以下问题:Python for_person_combo函数的具体用法?Python for_person_combo怎么用?Python for_person_combo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了for_person_combo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_widgets
def _setup_widgets(self):
branches = Branch.get_active_remote_branches(self.store)
self.destination_branch.prefill(api.for_person_combo(branches))
self.source_branch.set_text(self.branch.get_description())
employees = self.store.find(Employee)
self.source_responsible.prefill(api.for_person_combo(employees))
示例2: _setup_widgets
def _setup_widgets(self):
branches = Branch.get_active_remote_branches(self.store)
self.destination_branch.prefill(api.for_person_combo(branches))
self.source_branch.set_text(self.branch.get_description())
employees = self.store.find(Employee)
self.source_responsible.prefill(api.for_person_combo(employees))
self.invoice_number.set_property('mandatory', self._nfe_is_active)
# Set an initial invoice number to TransferOrder and Invoice
if not self.model.invoice_number:
new_invoice_number = Invoice.get_next_invoice_number(self.store)
self.model.invoice_number = new_invoice_number
示例3: _fill_transporter_combo
def _fill_transporter_combo(self):
marker('Filling transporters')
transporters = Transporter.get_active_transporters(self.store)
items = api.for_person_combo(transporters)
self.transporter.prefill(items)
self.transporter.set_sensitive(len(items))
marker('Filled transporters')
示例4: _setup_widgets
def _setup_widgets(self):
quote_group = str(self.wizard.quote_group.identifier)
self.quote_group.set_text(quote_group)
branches = Branch.get_active_branches(self.store)
self.branch_combo.prefill(api.for_person_combo(branches))
self.notes.set_accepts_tab(False)
示例5: populate
def populate(self, person):
from stoqlib.domain.person import (Client, Supplier, Transporter,
SalesPerson, Branch)
store = get_store_for_field(self)
person_type = self.person_type
if person_type == Supplier:
objects = Supplier.get_active_suppliers(store)
self.add_button.set_tooltip_text(_("Add a new supplier"))
self.edit_button.set_tooltip_text(_("Edit the selected supplier"))
elif person_type == Client:
objects = Client.get_active_clients(store)
self.add_button.set_tooltip_text(_("Add a new client"))
self.edit_button.set_tooltip_text(_("Edit the selected client"))
elif person_type == Transporter:
objects = Transporter.get_active_transporters(store)
self.add_button.set_tooltip_text(_("Add a new transporter"))
self.edit_button.set_tooltip_text(_("Edit the selected transporter"))
elif person_type == SalesPerson:
objects = SalesPerson.get_active_salespersons(store)
self.add_button.set_tooltip_text(_("Add a new sales person"))
self.edit_button.set_tooltip_text(_("Edit the selected sales person"))
elif person_type == Branch:
objects = Branch.get_active_branches(store)
self.add_button.set_tooltip_text(_("Add a new branch"))
self.edit_button.set_tooltip_text(_("Edit the selected branch"))
else:
raise AssertionError(self.person_type)
self.widget.prefill(api.for_person_combo(objects))
if person:
assert isinstance(person, person_type)
self.widget.select(person)
示例6: setup_proxies
def setup_proxies(self):
branches = self.store.find(Branch)
self.branch.prefill(api.for_person_combo(branches))
self.add_proxy(self.model, StationEditor.proxy_widgets)
if not self.edit_mode:
self.is_active.set_sensitive(False)
示例7: _fill_clients_combo
def _fill_clients_combo(self):
# FIXME: This should not be using a normal ProxyComboEntry,
# we need a specialized widget that does the searching
# on demand.
clients = Client.get_active_clients(self.store)
self.client.prefill(api.for_person_combo(clients))
self.client.mandatory = True
示例8: _setup_widgets
def _setup_widgets(self):
# Salesperson combo
salespersons = SalesPerson.get_active_salespersons(self.store)
self.salesperson.prefill(api.for_person_combo(salespersons))
change_salesperson = sysparam.get_int('ACCEPT_CHANGE_SALESPERSON')
if change_salesperson == ChangeSalespersonPolicy.ALLOW:
self.salesperson.grab_focus()
elif change_salesperson == ChangeSalespersonPolicy.DISALLOW:
self.salesperson.set_sensitive(False)
elif change_salesperson == ChangeSalespersonPolicy.FORCE_CHOOSE:
self.model.salesperson = None
self.salesperson.grab_focus()
else:
raise AssertionError
# CFOP combo
if sysparam.get_bool('ASK_SALES_CFOP'):
cfops = CfopData.get_for_sale(self.store)
self.cfop.prefill(api.for_combo(cfops))
else:
self.cfop_lbl.hide()
self.cfop.hide()
self.create_cfop.hide()
self._fill_clients_category_combo()
self._setup_clients_widget()
self._client_credit_set_visible(bool(self.client.read()))
示例9: _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()
示例10: setup_widgets
def setup_widgets(self):
marker('Setting up widgets')
# Only quotes have expire date.
self.expire_date.hide()
self.expire_label.hide()
# Hide client category widgets
self.client_category_lbl.hide()
self.client_category.hide()
# if the NF-e plugin is active, the client is mandantory in this
# wizard (in this situation, we have only quote sales).
if self.model.status == Sale.STATUS_QUOTE:
manager = get_plugin_manager()
mandatory_client = manager.is_active('nfe')
self.client.set_property('mandatory', mandatory_client)
marker('Filling sales persons')
salespersons = self.store.find(SalesPerson)
self.salesperson.prefill(api.for_person_combo(salespersons))
marker('Finished filling sales persons')
marker('Read parameter')
change_salesperson = sysparam.get_int('ACCEPT_CHANGE_SALESPERSON')
if change_salesperson == ChangeSalespersonPolicy.ALLOW:
self.salesperson.grab_focus()
elif change_salesperson == ChangeSalespersonPolicy.DISALLOW:
self.salesperson.set_sensitive(False)
elif change_salesperson == ChangeSalespersonPolicy.FORCE_CHOOSE:
self.model.salesperson = None
self.salesperson.grab_focus()
else:
raise AssertionError
marker('Finished reading parameter')
self._setup_clients_widget()
self._fill_transporter_combo()
self._fill_cost_center_combo()
if sysparam.get_bool('ASK_SALES_CFOP'):
self._fill_cfop_combo()
else:
self.cfop_lbl.hide()
self.cfop.hide()
self.create_cfop.hide()
# the maximum number allowed for an invoice is 999999999.
self.invoice_number.set_adjustment(
gtk.Adjustment(lower=1, upper=999999999, step_incr=1))
if not self.model.invoice_number:
new_invoice_number = Invoice.get_next_invoice_number(self.store)
self.invoice_model.invoice_number = new_invoice_number
else:
new_invoice_number = self.model.invoice_number
self.invoice_model.invoice_number = new_invoice_number
self.invoice_number.set_sensitive(False)
self.invoice_model.original_invoice = new_invoice_number
marker('Finished setting up widgets')
示例11: _setup_transporter_entry
def _setup_transporter_entry(self):
self.add_transporter.set_tooltip_text(_("Add a new transporter"))
self.edit_transporter.set_tooltip_text(_("Edit the selected transporter"))
items = Transporter.get_active_transporters(self.store)
self.transporter.prefill(api.for_person_combo(items))
self.transporter.set_sensitive(not items.is_empty())
self.edit_transporter.set_sensitive(not items.is_empty())
示例12: _setup_widgets
def _setup_widgets(self):
quote_group = str(self.wizard.quote_group.identifier)
self.quote_group.set_text(quote_group)
branches = Branch.get_active_branches(self.store)
self.branch_combo.prefill(api.for_person_combo(branches))
sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
self.branch_combo.set_sensitive(not sync_mode)
self.notes.set_accepts_tab(False)
示例13: _prefill_branches
def _prefill_branches(self):
branches = Branch.get_active_remote_branches(self.store)
current_branch = api.get_current_branch(self.store)
# Branches not allowed to execute foreign work orders can only send
# orders for those who can
if not current_branch.can_execute_foreign_work_orders:
branches = branches.find(can_execute_foreign_work_orders=True)
self.destination_branch.prefill(api.for_person_combo(branches))
示例14: _fill_clients_combo
def _fill_clients_combo(self):
marker('Filling clients')
# FIXME: This should not be using a normal ProxyComboEntry,
# we need a specialized widget that does the searching
# on demand.
clients = Client.get_active_clients(self.store)
self.client.prefill(api.for_person_combo(clients))
self.client.set_sensitive(len(self.client.get_model()))
marker('Filled clients')
示例15: _setup_widgets
def _setup_widgets(self):
# Salesperson combo
salespersons = self.store.find(SalesPerson)
self.salesperson.prefill(api.for_person_combo(salespersons))
if sysparam(self.store).ACCEPT_CHANGE_SALESPERSON:
self.salesperson.grab_focus()
else:
self.salesperson.set_sensitive(False)
self._fill_clients_combo()
self._fill_wo_categories_combo()