本文整理汇总了Python中stoqlib.lib.parameters.sysparam函数的典型用法代码示例。如果您正苦于以下问题:Python sysparam函数的具体用法?Python sysparam怎么用?Python sysparam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sysparam函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _check_branch
def _check_branch(self):
from stoqlib.database.runtime import (get_default_store, new_store,
get_current_station,
set_current_branch_station)
from stoqlib.domain.person import Company
from stoqlib.lib.parameters import sysparam
from stoqlib.lib.message import info
default_store = get_default_store()
set_current_branch_station(default_store, station_name=None)
compaines = default_store.find(Company)
if (compaines.count() == 0 or
not sysparam(default_store).MAIN_COMPANY):
from stoqlib.gui.base.dialogs import run_dialog
from stoqlib.gui.dialogs.branchdialog import BranchDialog
if self._ran_wizard:
info(_("You need to register a company before start using Stoq"))
else:
info(_("Could not find a company. You'll need to register one "
"before start using Stoq"))
store = new_store()
person = run_dialog(BranchDialog, None, store)
if not person:
raise SystemExit
branch = person.branch
sysparam(store).MAIN_COMPANY = branch.id
get_current_station(store).branch = branch
store.commit()
store.close()
开发者ID:qman1989,项目名称:stoq,代码行数:30,代码来源:shell.py
示例2: test_wizard_create_payment
def test_wizard_create_payment(self, yesno):
yesno.return_value = False
sysparam(self.store).update_parameter(
u'CREATE_PAYMENTS_ON_STOCK_DECREASE',
u'True')
till = self.create_till()
till.open_till()
branch = api.get_current_branch(self.store)
storable = self.create_storable(branch=branch, stock=1)
sellable = storable.product.sellable
wizard = StockDecreaseWizard(self.store)
step = wizard.get_current_step()
self.assertTrue(step.create_payments.get_visible())
step.create_payments.update(True)
step.reason.update('reason')
self.check_wizard(wizard, 'start-stock-decrease-step-create-payments')
self.assertSensitive(wizard, ['next_button'])
self.click(wizard.next_button)
step = wizard.get_current_step()
step.barcode.set_text(sellable.barcode)
step.sellable_selected(sellable)
step.quantity.update(1)
self.click(step.add_sellable_button)
self.click(wizard.next_button)
step = wizard.get_current_step()
self.assertTrue(isinstance(step, PaymentMethodStep))
开发者ID:LeonamSilva,项目名称:stoq,代码行数:32,代码来源:test_stockdecreasewizard.py
示例3: test_can_purchase_disallow_store_credit
def test_can_purchase_disallow_store_credit(self):
#: This parameter disallows the client to purchase with store credit
#: when he has late payments
sysparam(self.store).update_parameter(u'LATE_PAYMENTS_POLICY',
unicode(int(LatePaymentPolicy.DISALLOW_STORE_CREDIT)))
client = self.create_client()
bill_method = PaymentMethod.get_by_name(self.store, u'bill')
check_method = PaymentMethod.get_by_name(self.store, u'check')
money_method = PaymentMethod.get_by_name(self.store, u'money')
store_credit_method = PaymentMethod.get_by_name(self.store,
u'store_credit')
today = localtoday()
# client can pay if he doesn't have any payments
self.assertTrue(client.can_purchase(money_method, currency("0")))
# client can pay if he has payments that are not overdue
payment = self.create_payment(Payment.TYPE_IN, today, method=bill_method)
payment.group = self.create_payment_group()
payment.group.payer = client.person
self.assertTrue(client.can_purchase(money_method, currency("0")))
# for a client with overdue payments
payment = self.create_payment(Payment.TYPE_IN,
today - relativedelta(days=1),
method=money_method)
payment.status = Payment.STATUS_PENDING
payment.group = self.create_payment_group()
payment.group.payer = client.person
# client can pay if payment method is not store credit
self.assertTrue(client.can_purchase(check_method, currency("0")))
self.assertTrue(client.can_purchase(money_method, currency("0")))
# client can not pay if payment method is store credit
self.assertRaises(SellError, client.can_purchase, store_credit_method, currency("0"))
开发者ID:rosalin,项目名称:stoq,代码行数:35,代码来源:test_person.py
示例4: test_credit_limit_update
def test_credit_limit_update(self):
sysparam(self.store).update_parameter(
u"CREDIT_LIMIT_SALARY_PERCENT",
u"10")
client = self.create_client()
client.salary = 50
slave = ClientCreditSlave(self.store, client)
slave.salary.emit('changed')
self.assertEquals(slave.credit_limit.read(), 5)
# checks if credit limit updated correctly when salary changes
# and parameter salary percent is not 0
slave.salary.update(100)
slave.salary.emit('changed')
self.assertEquals(slave.credit_limit.read(), 10)
sysparam(self.store).update_parameter(
u"CREDIT_LIMIT_SALARY_PERCENT",
u"0")
# checks if credit limit does not update (correct behavior)
# when salary percent is 0 and salary changes
credit_limit = 0
client.credit_limit = credit_limit
slave.credit_limit.update(credit_limit)
slave.credit_limit.emit('changed')
slave.salary.update(200)
slave.salary.emit('changed')
self.assertEquals(slave.credit_limit.read(), credit_limit)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:32,代码来源:test_client_slave.py
示例5: _check_param_online_services
def _check_param_online_services(self):
from stoqlib.database.runtime import get_default_store, new_store
from stoqlib.lib.parameters import sysparam
import gtk
sparam = sysparam(get_default_store())
if sparam.ONLINE_SERVICES is None:
from kiwi.ui.dialogs import HIGAlertDialog
# FIXME: All of this is to avoid having to set markup as the default
# in kiwi/ui/dialogs:HIGAlertDialog.set_details, after 1.0
# this can be simplified when we fix so that all descriptions
# sent to these dialogs are properly escaped
dialog = HIGAlertDialog(
parent=None,
flags=gtk.DIALOG_MODAL,
type=gtk.MESSAGE_WARNING)
dialog.add_button(_("Not right now"), gtk.RESPONSE_NO)
dialog.add_button(_("Enable online services"), gtk.RESPONSE_YES)
dialog.set_primary(_('Do you want to enable Stoq online services?'))
dialog.set_details(PRIVACY_STRING, use_markup=True)
dialog.set_default_response(gtk.RESPONSE_YES)
response = dialog.run()
dialog.destroy()
store = new_store()
sysparam(store).ONLINE_SERVICES = int(bool(response == gtk.RESPONSE_YES))
store.commit()
store.close()
开发者ID:qman1989,项目名称:stoq,代码行数:28,代码来源:shell.py
示例6: _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()
开发者ID:rosalin,项目名称:stoq,代码行数:35,代码来源:salequotewizard.py
示例7: test_create
def test_create(self):
# Allow creating purchases in the past.
sysparam(self.store).update_parameter(
u"ALLOW_OUTDATED_OPERATIONS", u"1")
self.wizard = PurchaseWizard(self.store)
purchase_branch = self.create_branch()
purchase_order = PurchaseOrder(branch=purchase_branch)
sellable = self.create_sellable()
purchase_order.add_item(sellable=sellable)
self.wizard.model.identifier = 12345
self.wizard.model.open_date = localdate(2010, 1, 3).date()
self._check_start_step('wizard-purchase-start-step')
self._check_item_step('wizard-purchase-item-step')
self._check_payment_step('wizard-purchase-payment-step')
purchase = self.wizard.model
models = [purchase]
models.extend(purchase.get_items())
models.extend(purchase.payments)
models.append(purchase.group)
self.check_wizard(self.wizard, 'wizard-purchase-finish-step',
models=models)
self.click(self.wizard.next_button)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:26,代码来源:test_purchase_wizard.py
示例8: test_can_purchase_allow_all
def test_can_purchase_allow_all(self):
#: This parameter always allows the client to purchase, no matter if he
#: has late payments
sysparam(self.store).update_parameter(u'LATE_PAYMENTS_POLICY',
unicode(int(LatePaymentPolicy.ALLOW_SALES)))
client = self.create_client()
bill_method = PaymentMethod.get_by_name(self.store, u'bill')
check_method = PaymentMethod.get_by_name(self.store, u'check')
money_method = PaymentMethod.get_by_name(self.store, u'money')
store_credit_method = PaymentMethod.get_by_name(self.store,
u'store_credit')
today = localtoday()
# client can pay if he doesn't have any payments
client.credit_limit = Decimal("1000")
self.assertTrue(client.can_purchase(money_method, currency("200")))
# client can pay if he has payments that are not overdue
payment = self.create_payment(Payment.TYPE_IN, today, method=bill_method)
payment.group = self.create_payment_group()
payment.group.payer = client.person
self.assertTrue(client.can_purchase(check_method, currency("200")))
# client can pay even if he does have overdue payments
payment = self.create_payment(Payment.TYPE_IN,
today - relativedelta(days=1), method=check_method)
payment.group = self.create_payment_group()
payment.group.payer = client.person
self.assertTrue(client.can_purchase(store_credit_method, currency("200")))
# But he cannot pay if its above the credit limit
self.assertRaises(SellError, client.can_purchase, store_credit_method, currency("1001"))
开发者ID:rosalin,项目名称:stoq,代码行数:33,代码来源:test_person.py
示例9: test_get_logo_data
def test_get_logo_data(self):
image = self.create_image()
image.image = 'foobar'
sysparam(self.store).update_parameter(
u'CUSTOM_LOGO_FOR_REPORTS',
image.id)
data = get_logo_data(self.store)
self.assertEquals(data, 'data:image/png;base64,Zm9vYmFy')
开发者ID:LeonamSilva,项目名称:stoq,代码行数:8,代码来源:test_utils.py
示例10: _edit_item
def _edit_item(self, item):
store = api.new_store()
parameter = store.fetch(item)
retval = run_dialog(SystemParameterEditor, self, store, parameter)
if store.confirm(retval):
sysparam(store).rebuild_cache_for(item.field_name)
self.results.update(item)
store.close()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:8,代码来源:parametersearch.py
示例11: testShow
def testShow(self):
# this is necessary so previous tests will not interfere in here
sysparam(self.store).update_parameter(u"CREDIT_LIMIT_SALARY_PERCENT", u"0")
client = self.create_client()
client.salary = 100
slave = ClientStatusSlave(self.store, client)
self.check_slave(slave, "slave-clientstatus-show")
开发者ID:romaia,项目名称:stoq,代码行数:8,代码来源:test_client_slave.py
示例12: _create_transaction
def _create_transaction(store, till_entry):
AccountTransaction(description=till_entry.description,
source_account=sysparam(store).IMBALANCE_ACCOUNT,
account=sysparam(store).TILLS_ACCOUNT,
value=till_entry.value,
code=unicode(till_entry.id),
date=TransactionTimestamp(),
store=store,
payment=till_entry.payment)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:9,代码来源:tilleditor.py
示例13: testGetDefault
def testGetDefault(self):
location = CityLocation.get_default(self.store)
self.failUnless(isinstance(location, CityLocation))
self.assertEquals(location.city,
sysparam(self.store).CITY_SUGGESTED)
self.assertEquals(location.state,
sysparam(self.store).STATE_SUGGESTED)
self.assertEquals(location.country,
sysparam(self.store).COUNTRY_SUGGESTED)
开发者ID:romaia,项目名称:stoq,代码行数:9,代码来源:test_address.py
示例14: create_model
def create_model(self, store):
self._model_created = True
tax_constant = sysparam(store).DEFAULT_PRODUCT_TAX_CONSTANT
sellable = Sellable(store=store)
sellable.tax_constant = tax_constant
sellable.unit = sysparam(self.store).SUGGESTED_UNIT
model = Product(store=store, sellable=sellable)
Storable(product=model, store=store)
return model
开发者ID:romaia,项目名称:stoq,代码行数:9,代码来源:producteditor.py
示例15: setup_widgets
def setup_widgets(self):
marker('Setting up widgets')
# Only quotes have expire date.
self.expire_date.hide()
self.expire_label.hide()
# Hide operation nature widgets
self.operation_nature.hide()
self.nature_lbl.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')
if not sysparam(self.store).ACCEPT_CHANGE_SALESPERSON:
self.salesperson.set_sensitive(False)
else:
self.salesperson.grab_focus()
marker('Finished reading parameter')
self._fill_clients_combo()
self._fill_transporter_combo()
self._fill_cost_center_combo()
if sysparam(self.store).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 = Sale.get_last_invoice_number(self.store) + 1
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')
开发者ID:romaia,项目名称:stoq,代码行数:57,代码来源:salewizard.py
示例16: test_check_payment_mandatory_check_number
def test_check_payment_mandatory_check_number(self):
sysparam(self.store).update_parameter(u'MANDATORY_CHECK_NUMBER', u'True')
wizard = PurchaseWizard(self.store)
method = PaymentMethod.get_by_name(self.store, u'check')
order = self.create_purchase_order()
order.identifier = 123456
CheckMethodSlave(wizard, None, self.store, order, method, Decimal(200))
self.assertNotSensitive(wizard, ['next_button'])
开发者ID:LeonamSilva,项目名称:stoq,代码行数:11,代码来源:test_payment_slave.py
示例17: get_default
def get_default(cls, store):
"""Get the default city location according to the database parameters.
The is usually the same city as main branch.
:returns: the default city location
"""
city = sysparam(store).CITY_SUGGESTED
state = sysparam(store).STATE_SUGGESTED
country = sysparam(store).COUNTRY_SUGGESTED
return cls.get_or_create(store, city, state, country)
开发者ID:rosalin,项目名称:stoq,代码行数:11,代码来源:address.py
示例18: testCostPrecisionDigits
def testCostPrecisionDigits(self):
# Set a number of digts greated than 2
sysparam(self.store).update_parameter(
u'COST_PRECISION_DIGITS', u'5')
product = self.create_product()
product.sellable.cost = Decimal('1.23456')
editor = ProductEditor(self.store, product)
editor.code.update("12345")
# We expect the editor to show the correct value
self.check_editor(editor, 'editor-product-cost-precision-digits')
开发者ID:marianaanselmo,项目名称:stoq,代码行数:11,代码来源:test_producteditor.py
示例19: setup_proxies
def setup_proxies(self):
self._setup_widgets()
self.proxy = self.add_proxy(self.model,
StartSaleQuoteStep.proxy_widgets)
if sysparam(self.store).ASK_SALES_CFOP:
self.add_proxy(self.model, StartSaleQuoteStep.cfop_widgets)
expire_delta = sysparam(self.store).EXPIRATION_SALE_QUOTE_DATE
if expire_delta > 0:
self.expire_date.update(localtoday() +
relativedelta(days=expire_delta))
开发者ID:qman1989,项目名称:stoq,代码行数:11,代码来源:salequotewizard.py
示例20: before_start
def before_start(self, store):
account = store.find(Account,
code=unicode(self.tp.account_id)).one()
if account is None:
account = Account(description=self.get_account_id(),
code=unicode(self.tp.account_id),
account_type=Account.TYPE_BANK,
parent=sysparam(store).BANKS_ACCOUNT,
store=store)
self.account_id = account.id
self.source_account_id = sysparam(store).IMBALANCE_ACCOUNT.id
self.skipped = 0
开发者ID:leandrorchaves,项目名称:stoq,代码行数:12,代码来源:ofximporter.py
注:本文中的stoqlib.lib.parameters.sysparam函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论