本文整理汇总了Python中stoqlib.domain.person.Client类的典型用法代码示例。如果您正苦于以下问题:Python Client类的具体用法?Python Client怎么用?Python Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _credit_limit_salary_changed
def _credit_limit_salary_changed(new_value, store):
from stoqlib.domain.person import Client
old_value = sysparam(store).CREDIT_LIMIT_SALARY_PERCENT
if new_value == old_value:
return
new_value = Decimal(new_value)
Client.update_credit_limit(new_value, store)
示例2: _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.
items = Client.get_active_items(self.store)
self.client.prefill(items)
self.client.mandatory = True
示例3: _create_client
def _create_client(self, store):
from stoqlib.domain.address import Address, CityLocation
from stoqlib.domain.person import Client, Person
person = Person(name=u'Person', store=store)
city = CityLocation.get_default(store)
Address(store=store,
street=u'Rua Principal',
streetnumber=123,
postal_code=u'12345-678',
is_main_address=True,
person=person,
city_location=city)
client = Client(person=person, store=store)
client.credit_limit = currency("1000")
return client
示例4: 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)
示例5: _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')
示例6: test_update_credit_limit
def test_update_credit_limit(self):
client = self.create_client()
client.salary = 100
# just setting paramater to a value that won't interfere in
# the tests
sysparam(self.store).update_parameter(
u"CREDIT_LIMIT_SALARY_PERCENT",
u"5")
# testing if updates
Client.update_credit_limit(10, self.store)
client.credit_limit = AutoReload
self.assertEquals(client.credit_limit, 10)
# testing if it does not update
client.credit_limit = 200
Client.update_credit_limit(0, self.store)
self.assertEquals(client.credit_limit, 200)
示例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.
# This is to keep the clients in cache
clients_cache = list(Client.get_active_clients(self.store))
clients_cache # pyflakes
# We are using ClientView here to show the fancy name as well
clients = ClientView.get_active_clients(self.store)
items = [(c.get_description(), c.client) for c in clients]
items = locale_sorted(items, key=operator.itemgetter(0))
self.client.prefill(items)
# TODO: Implement a has_items() in kiwi
self.client.set_sensitive(len(self.client.get_model()))
示例8: _fill_clients_combo
def _fill_clients_combo(self):
clients = Client.get_active_clients(self.store)
self.client.prefill(api.for_person_combo(clients))
示例9: _fill_clients_combo
def _fill_clients_combo(self):
items = Client.get_active_items(self.store)
self.client.prefill(items)
self.client.set_sensitive(len(self.client.get_model()))