本文整理汇总了Python中lucterios.CORE.parameters.Params类的典型用法代码示例。如果您正苦于以下问题:Python Params类的具体用法?Python Params怎么用?Python Params使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Params类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_show_fields
def get_show_fields(cls):
fields = [
"adherent", "date", ((Params.getvalue("event-degree-text"), 'degree'),)]
if Params.getvalue("event-subdegree-enable") == 1:
fields.append(
((Params.getvalue("event-subdegree-text"), 'subdegree'),))
return fields
示例2: test_payment_billpartial_with_tax
def test_payment_billpartial_with_tax(self):
Parameter.change_value('invoice-vat-mode', '2')
Params.clear()
details = [
{'article': 2, 'designation': 'Article 02', 'price': '100.00', 'quantity': 1}]
self._create_bill(details, 1, '2015-04-02', 4, True)
self.factory.xfer = PayoffAddModify()
self.call(
'/diacamma.payoff/payoffAddModify', {'SAVE': 'YES', 'supporting': 6, 'amount': '60.0', 'payer': "Ma'a Dalton", 'date': '2015-04-01', 'mode': 0, 'reference': 'abc', 'bank_account': 0}, False)
self.assert_observer(
'core.acknowledge', 'diacamma.payoff', 'payoffAddModify')
self.factory.xfer = BillShow()
self.call('/diacamma.invoice/billShow', {'bill': 6}, False)
self.assert_observer(
'core.custom', 'diacamma.invoice', 'billShow')
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="title"]', "{[br/]}{[center]}{[u]}{[b]}facture{[/b]}{[/u]}{[/center]}")
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="status"]', "validé")
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="total_rest_topay"]', "40.00€")
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="vta_sum"]', "4.76€")
self.assert_count_equal('ACTIONS/ACTION', 5)
self.assert_action_equal('ACTIONS/ACTION[1]', (six.text_type(
'Règlement'), 'diacamma.payoff/images/payments.png', 'diacamma.payoff', 'payableShow', 0, 1, 1))
self.factory.xfer = PayableShow()
self.call('/diacamma.payoff/supportingPaymentMethod', {'bill': 6, 'item_name': 'bill'}, False)
self.assert_observer('core.custom', 'diacamma.payoff', 'supportingPaymentMethod')
self.assert_xml_equal('COMPONENTS/LABELFORM[@name="num_txt"]', 'A-2')
self.check_payment(6, 'facture A-2 - 2 avril 2015', '38.1', '1.9')
示例3: show
def show(self, xfer):
if xfer.item.cost_accounting is None:
xfer.remove_component("cost_accounting")
xfer.remove_component("lbl_cost_accounting")
xfer.params['new_account'] = Params.getvalue('invoice-account-third')
xfer.move(0, 0, 1)
lbl = XferCompLabelForm('title')
lbl.set_location(1, 0, 4)
lbl.set_value_as_title(get_value_if_choices(
self.item.bill_type, self.item.get_field_by_name('bill_type')))
xfer.add_component(lbl)
details = xfer.get_components('detail')
if Params.getvalue("invoice-vat-mode") != 0:
if Params.getvalue("invoice-vat-mode") == 1:
details.headers[2] = XferCompHeader(details.headers[2].name, _(
'price excl. taxes'), details.headers[2].type, details.headers[2].orderable)
details.headers[6] = XferCompHeader(details.headers[6].name, _(
'total excl. taxes'), details.headers[6].type, details.headers[6].orderable)
elif Params.getvalue("invoice-vat-mode") == 2:
details.headers[2] = XferCompHeader(details.headers[2].name, _(
'price incl. taxes'), details.headers[2].type, details.headers[2].orderable)
details.headers[6] = XferCompHeader(details.headers[6].name, _(
'total incl. taxes'), details.headers[6].type, details.headers[6].orderable)
xfer.get_components('lbl_total_excltax').set_value_as_name(
_('total excl. taxes'))
xfer.filltab_from_model(1, xfer.get_max_row() + 1, True,
[((_('VTA sum'), 'vta_sum'), (_('total incl. taxes'), 'total_incltax'))])
if self.item.status == 0:
SupportingEditor.show_third(self, xfer, 'invoice.add_bill')
else:
SupportingEditor.show_third_ex(self, xfer)
details.actions = []
if self.item.bill_type != 0:
SupportingEditor.show(self, xfer)
return
示例4: _params
def _params(self):
cur_p = self.old_db.open()
cur_p.execute(
"SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_facture' and paramName in ('ModeTVA','DefaultCompteVente','compteTVAVente','CompteRemise','CompteFraisBank','CompteCaisse')")
for param_name, param_value in cur_p.fetchall():
pname = ''
if param_name == 'ModeTVA':
pname = 'invoice-vat-mode'
if param_value == '':
param_value = '0'
elif param_name == 'DefaultCompteVente':
pname = 'invoice-default-sell-account'
param_value = convert_code(param_value)
elif param_name == 'compteTVAVente':
pname = 'invoice-vatsell-account'
param_value = convert_code(param_value)
elif param_name == 'CompteRemise':
pname = 'invoice-reduce-account'
param_value = convert_code(param_value)
elif param_name == 'CompteFraisBank':
pname = 'payoff-bankcharges-account'
param_value = convert_code(param_value)
elif param_name == 'CompteCaisse':
pname = 'payoff-cash-account'
param_value = convert_code(param_value)
if pname != '':
self.print_debug(
"=> parameter of invoice %s - %s", (pname, param_value))
Parameter.change_value(pname, param_value)
Params.clear()
示例5: test_parameters_float
def test_parameters_float(self):
param = Parameter.objects.create(
name='param_float', typeparam=2)
param.args = "{'Min':20, 'Max':30, 'Prec':2}"
param.value = '22.25'
param.save()
Params.fill(self.xfer, ['param_float'], 1, 1, True)
Params.fill(self.xfer, ['param_float'], 1, 2, False)
self.callparam()
self.assert_count_equal('COMPONENTS/*', 4)
self.assert_count_equal(
'COMPONENTS/LABELFORM[@name="lbl_param_float"]', 2)
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="param_float"]', '22.25')
self.assert_xml_equal('COMPONENTS/FLOAT[@name="param_float"]', '22.25')
self.assert_attrib_equal(
'COMPONENTS/FLOAT[@name="param_float"]', 'min', '20.0')
self.assert_attrib_equal(
'COMPONENTS/FLOAT[@name="param_float"]', 'max', '30.0')
self.assert_attrib_equal(
'COMPONENTS/FLOAT[@name="param_float"]', 'prec', '2')
self.factory.xfer = ParamSave()
self.call(
'/CORE/paramSave', {'params': 'param_float', 'param_float': '26.87'}, False)
self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
self.assertEqual(Params.getvalue('param_float'), 26.87)
示例6: setUp
def setUp(self):
self.factory = XmlRequestFactory(self.xfer_class, self.language)
self.client = XmlClient(self.language)
self.response = None
self.clean_resp()
Params.clear()
notfree_mode_connect()
示例7: _params
def _params(self):
cur_p = self.old_db.open()
cur_p.execute(
"SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_membres' and paramName in ('EquipeEnable', 'EquipeText', 'ActiviteEnable', 'ActiviteText', 'AgeEnable', 'LicenceEnabled', 'FiltreGenre', 'Numero', 'Naissance', 'compteTiersDefault', 'connexion')")
for param_name, param_value in cur_p.fetchall():
pname = ''
if param_name == "EquipeEnable":
pname = "member-team-enable"
if param_name == "EquipeText":
pname = "member-team-text"
if param_name == "ActiviteEnable":
pname = "member-activite-enable"
if param_name == "ActiviteText":
pname = "member-activite-text"
if param_name == "AgeEnable":
pname = "member-age-enable"
if param_name == "LicenceEnabled":
pname = "member-licence-enabled"
if param_name == "FiltreGenre":
pname = "member-filter-genre"
if param_name == "Numero":
pname = "member-numero"
if param_name == "Naissance":
pname = "member-birth"
if param_name == "compteTiersDefault":
pname = "invoice-account-third"
param_value = convert_code(param_value)
if param_name == "connexion":
pname = "member-connection"
if pname != '':
self.print_debug(
"=> parameter of invoice %s - %s", (pname, param_value))
Parameter.change_value(pname, param_value)
Params.clear()
示例8: fillresponse
def fillresponse(self):
XferContainerCustom.fillresponse(self)
self.new_tab(_('EMail configuration'))
img = XferCompImage('img_conf')
img.set_value(self.icon_path())
img.set_location(0, 0, 1, 6)
self.add_component(img)
conf_params = ['mailing-smtpserver', 'mailing-smtpport',
'mailing-smtpsecurity', 'mailing-smtpuser', 'mailing-smtppass',
'mailing-delay-batch', 'mailing-nb-by-batch']
Params.fill(self, conf_params, 1, 1)
btn = XferCompButton('editparam')
btn.set_location(3, 1, 1, 5)
btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': conf_params})
self.add_component(btn)
if will_mail_send():
btn = XferCompButton('tryemail')
btn.set_location(1, 10, 2)
btn.set_action(self.request, SendEmailTry.get_action(_('Send'), ''), close=CLOSE_NO)
self.add_component(btn)
self.new_tab(_('Default message'))
img = XferCompImage('img_msg')
img.set_value(self.icon_path())
img.set_location(0, 0, 1, 6)
self.add_component(img)
msg_params = ['mailing-msg-connection']
Params.fill(self, msg_params, 1, 1)
btn = XferCompButton('editmsg')
btn.set_location(1, 10, 2)
btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': msg_params})
self.add_component(btn)
示例9: test_params
def test_params(self):
self.factory.xfer = CategoryConf()
self.call('/diacamma.member/categoryConf', {}, False)
self.assert_observer(
'core.custom', 'diacamma.member', 'categoryConf')
self.assert_count_equal('COMPONENTS/*', 37)
self.assert_count_equal('COMPONENTS/TAB', 4)
self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
self.assert_xml_equal('COMPONENTS/TAB[3]', 'Équipe')
self.assert_xml_equal('COMPONENTS/TAB[4]', 'Activité')
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="member-team-text"]', 'Équipe')
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="member-activite-text"]', 'Activité')
Parameter.change_value("member-team-text", 'Cours')
Parameter.change_value("member-activite-text", 'Sport')
Params.clear()
self.factory.xfer = CategoryConf()
self.call('/diacamma.member/categoryConf', {}, False)
self.assert_observer(
'core.custom', 'diacamma.member', 'categoryConf')
self.assert_count_equal('COMPONENTS/*', 37)
self.assert_count_equal('COMPONENTS/TAB', 4)
self.assert_xml_equal('COMPONENTS/TAB[1]', 'Paramètres')
self.assert_xml_equal('COMPONENTS/TAB[2]', 'Age')
self.assert_xml_equal('COMPONENTS/TAB[3]', 'Cours')
self.assert_xml_equal('COMPONENTS/TAB[4]', 'Sport')
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="member-team-text"]', 'Cours')
self.assert_xml_equal(
'COMPONENTS/LABELFORM[@name="member-activite-text"]', 'Sport')
示例10: before_save
def before_save(self, xfer):
self.item.vta_rate = 0
if (Params.getvalue("invoice-vat-mode") != 0) and (self.item.article is not None) and (self.item.article.vat is not None):
self.item.vta_rate = float(self.item.article.vat.rate / 100)
if Params.getvalue("invoice-vat-mode") == 2:
self.item.vta_rate = -1 * self.item.vta_rate
return
示例11: conf_wizard_member
def conf_wizard_member(wizard_ident, xfer):
if isinstance(wizard_ident, list) and (xfer is None):
wizard_ident.append(("member_season", 11))
wizard_ident.append(("member_subscriptiontype", 12))
wizard_ident.append(("member_category", 13))
wizard_ident.append(("member_params", 14))
elif (xfer is not None) and (wizard_ident == "member_season"):
xfer.add_title(_("Diacamma member"), _('Season'), _('Configuration of season'))
xfer.fill_grid(5, Season, "season", Season.objects.all())
elif (xfer is not None) and (wizard_ident == "member_subscriptiontype"):
xfer.add_title(_("Diacamma member"), _('Subscriptions'), _('Configuration of subscription'))
xfer.fill_grid(15, SubscriptionType, "subscriptiontype", SubscriptionType.objects.all())
xfer.get_components("subscriptiontype").colspan = 6
fill_params(xfer, ["member-subscription-mode", "member-subscription-message"], True)
elif (xfer is not None) and (wizard_ident == "member_category"):
xfer.add_title(_("Diacamma member"), _("Categories"), _('Configuration of categories'))
xfer.new_tab(_('Parameters'))
fill_params(xfer, ["member-team-enable", "member-team-text", "member-activite-enable", "member-activite-text", "member-age-enable"], True)
if Params.getvalue("member-age-enable") == 1:
xfer.new_tab(_('Age'))
xfer.fill_grid(1, Age, "age", Age.objects.all())
if Params.getvalue("member-team-enable") == 1:
xfer.new_tab(Params.getvalue("member-team-text"))
xfer.fill_grid(1, Team, "team", Team.objects.all())
if Params.getvalue("member-activite-enable") == 1:
xfer.new_tab(Params.getvalue("member-activite-text"))
xfer.fill_grid(1, Activity, "activity", Activity.objects.all())
elif (xfer is not None) and (wizard_ident == "member_params"):
xfer.add_title(_("Diacamma member"), _('Parameters'), _('Configuration of main parameters'))
fill_params(xfer, ["member-licence-enabled", "member-filter-genre", "member-numero", "member-birth", "member-connection"], True)
示例12: get_connection_info
def get_connection_info(self):
from django.conf import settings
import lucterios.CORE
import os
LucteriosSession.clean_anonymous()
info_cnx = {}
info_cnx['TITLE'] = six.text_type(settings.APPLIS_NAME)
info_cnx['SUBTITLE'] = settings.APPLIS_SUBTITLE()
info_cnx['VERSION'] = six.text_type(settings.APPLIS_VERSION)
info_cnx['SERVERVERSION'] = six.text_type(lucterios.CORE.__version__)
info_cnx['COPYRIGHT'] = six.text_type(settings.APPLIS_COPYRIGHT)
info_cnx['LOGONAME'] = settings.APPLIS_LOGO.decode()
info_cnx['BACKGROUND'] = settings.APPLIS_BACKGROUND.decode()
info_cnx['STYLE'] = settings.APPLIS_STYLE.decode()
info_cnx['SUPPORT_EMAIL'] = six.text_type(settings.APPLI_EMAIL)
info_cnx['SUPPORT_HTML'] = six.text_type(settings.APPLI_SUPPORT())
info_cnx['INFO_SERVER'] = get_info_server()
setting_module_name = os.getenv("DJANGO_SETTINGS_MODULE", "???.???")
info_cnx['INSTANCE'] = setting_module_name.split('.')[0]
info_cnx['MESSAGE_BEFORE'] = Params.getvalue("CORE-MessageBefore")
info_cnx['LANGUAGE'] = self.language
info_cnx['MODE'] = six.text_type(Params.getvalue("CORE-connectmode"))
if self.request.user.is_authenticated:
info_cnx['LOGIN'] = self.request.user.username
info_cnx['REALNAME'] = "%s %s" % (self.request.user.first_name, self.request.user.last_name)
info_cnx['EMAIL'] = self.request.user.email
else:
info_cnx['LOGIN'] = ''
info_cnx['REALNAME'] = ''
info_cnx['EMAIL'] = ''
self.responsejson['connexion'] = info_cnx
示例13: fillresponse
def fillresponse(self, account_system=''):
if account_system != '':
if self.confirme(_('Do you confirm to select "%s" like accounting system?{[br/]}{[br/]}{[i]}{[u]}Warning{[/u]}: This choose is definitive.{[/i]}') %
accounting_system_name(account_system)):
Parameter.change_value('accounting-system', account_system)
Params.clear()
clear_system_account()
示例14: total
def total(self):
if Params.getvalue("invoice-vat-mode") == 2:
return self.total_incltax
elif Params.getvalue("invoice-vat-mode") == 1:
return self.total_excltax
else:
return format_devise(self.get_total(), 5)
示例15: test_connect_anonymous
def test_connect_anonymous(self):
Params.clear()
self.calljson('/CORE/authentification', {'username': '', 'password': ''})
self.assert_observer('core.auth', 'CORE', 'authentification')
self.assert_json_equal('', '', 'BADAUTH')
param = Parameter.objects.get(name='CORE-connectmode')
param.value = '1'
param.save()
Params.clear()
self.calljson('/CORE/authentification', {'username': '', 'password': ''})
self.assert_observer('core.auth', 'CORE', 'authentification')
self.assert_json_equal('', '', 'OK')
self.assertEqual(self.response_json['connexion']['LOGIN'], '')
self.assertEqual(self.response_json['connexion']['REALNAME'], '')
self.assertEqual(self.response_json['connexion']['MODE'], '1')
self.calljson('/CORE/menu', {})
self.assert_observer('core.menu', 'CORE', 'menu')
self.assertEqual(len(self.response_json['menus']), 1)
self.assertEqual(self.response_json['menus'][0]['id'], 'dummy.foo')
self.assertEqual(self.response_json['menus'][0]['text'], six.text_type('Dummy'))
self.assertEqual(len(self.response_json['menus'][0]['menus']), 6)