本文整理汇总了Python中lucterios.framework.xfercomponents.XferCompLabelForm.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python XferCompLabelForm.set_value方法的具体用法?Python XferCompLabelForm.set_value怎么用?Python XferCompLabelForm.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucterios.framework.xfercomponents.XferCompLabelForm
的用法示例。
在下文中一共展示了XferCompLabelForm.set_value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: change_to_readonly
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def change_to_readonly(self, cmp_name):
old_obj = self.get_components(cmp_name)
value = old_obj.value
if isinstance(old_obj, XferCompSelect):
if isinstance(old_obj.select_list, dict) and (value in old_obj.select_list.keys()):
value = old_obj.select_list[value]
if isinstance(old_obj.select_list, list):
for key, sel_val in old_obj.select_list:
if value == key:
value = sel_val
break
elif isinstance(old_obj, XferCompDate):
value = formats.date_format(value, "DATE_FORMAT")
elif isinstance(old_obj, XferCompDateTime):
value = formats.date_format(value, "DATETIME_FORMAT")
elif isinstance(old_obj, XferCompTime):
value = formats.date_format(value, "TIME_FORMAT")
elif isinstance(old_obj, XferCompFloat) and (value is not None):
value = ("%%.%df" % old_obj.prec) % value
if value is None:
value = "---"
self.remove_component(cmp_name)
self.tab = old_obj.tab
new_lbl = XferCompLabelForm(cmp_name)
new_lbl.set_value(value)
new_lbl.col = old_obj.col
new_lbl.row = old_obj.row
new_lbl.vmin = old_obj.vmin
new_lbl.hmin = old_obj.hmin
new_lbl.colspan = old_obj.colspan
new_lbl.rowspan = old_obj.rowspan
self.add_component(new_lbl)
示例2: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def fillresponse(self, item_name='', subject='', message='', model=0, withpayment=False):
if item_name != '':
self.item = Supporting.objects.get(id=self.getparam(item_name, 0))
self.item = self.item.get_final_child()
if self.getparam("OK") is None:
dlg = self.create_custom()
icon = XferCompImage('img')
icon.set_location(0, 0, 1, 6)
icon.set_value(self.icon_path())
dlg.add_component(icon)
lbl = XferCompLabelForm('lb_subject')
lbl.set_value_as_name(_('subject'))
lbl.set_location(1, 1)
dlg.add_component(lbl)
lbl = XferCompEdit('subject')
lbl.set_value(six.text_type(self.item))
lbl.set_location(2, 1)
dlg.add_component(lbl)
lbl = XferCompLabelForm('lb_message')
lbl.set_value_as_name(_('message'))
lbl.set_location(1, 2)
dlg.add_component(lbl)
contact = self.item.third.contact.get_final_child()
lbl = XferCompMemo('message')
lbl.set_value(Params.getvalue('payoff-email-message') % {
'name': contact.get_presentation(), 'doc': self.item.get_docname()})
lbl.with_hypertext = True
lbl.set_size(130, 450)
lbl.set_location(2, 2)
dlg.add_component(lbl)
selectors = PrintModel.get_print_selector(
2, self.item.__class__)[0]
lbl = XferCompLabelForm('lb_model')
lbl.set_value_as_name(selectors[1])
lbl.set_location(1, 3)
dlg.add_component(lbl)
sel = XferCompSelect('model')
sel.set_select(selectors[2])
sel.set_location(2, 3)
dlg.add_component(sel)
if self.item.payoff_have_payment() and (len(PaymentMethod.objects.all()) > 0):
lbl = XferCompLabelForm('lb_withpayment')
lbl.set_value_as_name(_('add payment methods in email'))
lbl.set_location(1, 4)
dlg.add_component(lbl)
sel = XferCompCheck('withpayment')
sel.set_value(True)
sel.set_location(2, 4)
dlg.add_component(sel)
dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"OK": "YES"})
dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
else:
html_message = "<html>"
html_message += message.replace('{[newline]}', '<br/>\n').replace('{[', '<').replace(']}', '>')
if self.item.payoff_have_payment() and withpayment:
html_message += get_html_payment(self.request.META.get('HTTP_REFERER', self.request.build_absolute_uri()), self.language, self.item)
html_message += "</html>"
self.item.send_email(subject, html_message, model)
示例3: fillresponse_body
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def fillresponse_body(self):
self.get_components("title").colspan = 2
row_id = self.get_max_row() + 1
lbl = XferCompLabelForm('title_exp')
lbl.set_value_as_headername(_("Expense"))
lbl.set_location(0, row_id, 2)
self.add_component(lbl)
lbl = XferCompLabelForm('title_rev')
lbl.set_value_as_headername(_("Revenue"))
lbl.set_location(2, row_id, 2)
self.add_component(lbl)
row_id = self.get_max_row()
self.fill_grid(row_id, self.model, 'budget_revenue', self.model.objects.filter(self.filter & Q(code__regex=current_system_account().get_revenue_mask())))
self.move_components('budget_revenue', 2, 0)
self.fill_grid(row_id, self.model, 'budget_expense', self.model.objects.filter(self.filter & Q(code__regex=current_system_account().get_expence_mask())))
self.remove_component('nb_budget_expense')
self.remove_component('nb_budget_revenue')
resultat_budget = Budget.get_total(self.getparam('year'), self.getparam('cost_accounting'))
if abs(resultat_budget) > 0.0001:
row_id = self.get_max_row() + 1
lbl = XferCompLabelForm('title_result')
if resultat_budget > 0:
lbl.set_value_as_name(_('result (profit)'))
else:
lbl.set_value_as_name(_('result (deficit)'))
lbl.set_location(0, row_id)
self.add_component(lbl)
lbl = XferCompLabelForm('result')
lbl.set_value(format_devise(resultat_budget, 5))
lbl.set_location(1, row_id)
self.add_component(lbl)
示例4: _get_from_custom
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def _get_from_custom(self, request, *args, **kwargs):
dlg = XferContainerCustom()
dlg.request = self.request
dlg.is_view_right = self.is_view_right
dlg.caption = self.caption
dlg.extension = self.extension
dlg.action = self.action
img_title = XferCompImage('img_title')
img_title.set_location(0, 0, 1, 2)
img_title.set_value(self.traitment_data[0])
dlg.add_component(img_title)
lbl = XferCompLabelForm("info")
lbl.set_location(1, 0)
dlg.add_component(lbl)
if self.getparam("RELOAD") is not None:
lbl.set_value(
"{[br/]}{[center]}" + six.text_type(self.traitment_data[2]) + "{[/center]}")
dlg.add_action(WrapAction(_("Close"), "images/close.png"), {})
else:
lbl.set_value(
"{[br/]}{[center]}" + six.text_type(self.traitment_data[1]) + "{[/center]}")
btn = XferCompButton("Next")
btn.set_location(1, 1)
btn.set_size(50, 300)
btn.set_action(self.request, self.get_action(
_('Traitment...'), ""), {'params': {"RELOAD": "YES"}})
btn.java_script = "parent.refresh()"
dlg.params["RELOAD"] = "YES"
dlg.add_component(btn)
dlg.add_action(WrapAction(_("Cancel"), "images/cancel.png"), {})
return dlg.get(request, *args, **kwargs)
示例5: _entryline_editor
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def _entryline_editor(self, xfer, serial_vals, debit_rest, credit_rest):
last_row = xfer.get_max_row() + 5
lbl = XferCompLabelForm('sep1')
lbl.set_location(0, last_row, 6)
lbl.set_value("{[center]}{[hr/]}{[/center]}")
xfer.add_component(lbl)
lbl = XferCompLabelForm('sep2')
lbl.set_location(1, last_row + 1, 5)
lbl.set_value_center(_("Add a entry line"))
xfer.add_component(lbl)
entry_line = EntryLineAccount()
entry_line.editor.edit_line(xfer, 0, last_row + 2, debit_rest, credit_rest)
if entry_line.has_account:
btn = XferCompButton('entrybtn')
btn.set_location(3, last_row + 5)
btn.set_action(xfer.request, ActionsManage.get_action_url(
'accounting.EntryLineAccount', 'Add', xfer), close=CLOSE_YES)
xfer.add_component(btn)
self.item.editor.show(xfer)
grid_lines = xfer.get_components('entrylineaccount')
xfer.remove_component('entrylineaccount')
new_grid_lines = XferCompGrid('entrylineaccount_serial')
new_grid_lines.set_model(self.item.get_entrylineaccounts(serial_vals), None, xfer)
new_grid_lines.set_location(grid_lines.col, grid_lines.row, grid_lines.colspan + 2, grid_lines.rowspan)
new_grid_lines.add_action_notified(xfer, EntryLineAccount)
xfer.add_component(new_grid_lines)
nb_lines = len(new_grid_lines.record_ids)
return nb_lines
示例6: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def fillresponse(self):
self.fields_desc.initial(self.item)
self.read_criteria_from_params()
self.fillresponse_add_title()
self.fillresponse_search_select()
self.fillresponse_search_values()
self.fillresponse_show_criteria()
row = self.get_max_row()
if isinstance(self.filter, Q) and (len(self.filter.children) > 0):
self.items = self.model.objects.filter(
self.filter)
else:
self.items = self.model.objects.all()
grid = XferCompGrid(self.field_id)
grid.set_model(self.items, self.fieldnames, self)
grid.add_actions(self, action_list=self.action_grid)
grid.set_location(0, row + 4, 4)
grid.set_size(200, 500)
self.add_component(grid)
lbl = XferCompLabelForm("nb")
lbl.set_location(0, row + 5, 4)
lbl.set_value(_("Total number of %(name)s: %(count)d") % {
'name': self.model._meta.verbose_name_plural, 'count': grid.nb_lines})
self.add_component(lbl)
for act_type, title, icon in self.action_list:
self.add_action(ActionsManage.get_act_changed(
self.model.__name__, act_type, title, icon), {'close': CLOSE_NO})
self.add_action(WrapAction(_('Close'), 'images/close.png'), {})
示例7: conf_wizard_accounting
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def conf_wizard_accounting(wizard_ident, xfer):
if isinstance(wizard_ident, list) and (xfer is None):
wizard_ident.append(("accounting_params", 21))
wizard_ident.append(("accounting_fiscalyear", 22))
wizard_ident.append(("accounting_journal", 23))
elif (xfer is not None) and (wizard_ident == "accounting_params"):
xfer.add_title(_("Diacamma accounting"), _('Parameters'), _('Configuration of accounting parameters'))
select_account_system(xfer)
fill_params(xfer, True)
elif (xfer is not None) and (wizard_ident == "accounting_fiscalyear"):
xfer.add_title(_("Diacamma accounting"), _('Fiscal year list'), _('Configuration of fiscal years'))
xfer.fill_grid(5, FiscalYear, 'fiscalyear', FiscalYear.objects.all())
try:
current_year = FiscalYear.get_current()
nb_account = len(ChartsAccount.objects.filter(year=current_year))
lbl = XferCompLabelForm('nb_account')
lbl.set_value(_("Total of charts of accounts in current fiscal year: %d") % nb_account)
lbl.set_location(0, 10)
xfer.add_component(lbl)
if nb_account == 0:
xfer.item = ChartsAccount()
xfer.item.year = current_year
btn = XferCompButton('initialfiscalyear')
btn.set_location(1, 10)
btn.set_action(xfer.request, ActionsManage.get_action_url(ChartsAccount.get_long_name(), 'AccountInitial', xfer), close=CLOSE_NO)
xfer.add_component(btn)
except LucteriosException as lerr:
lbl = XferCompLabelForm('nb_account')
lbl.set_value(six.text_type(lerr))
lbl.set_location(0, 10, 2)
xfer.add_component(lbl)
elif (xfer is not None) and (wizard_ident == "accounting_journal"):
xfer.add_title(_("Diacamma accounting"), _('Journals'), _('Configuration of journals'))
xfer.fill_grid(5, Journal, 'journal', Journal.objects.all())
示例8: show_third
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def show_third(self, xfer, right=""):
xfer.params["supporting"] = self.item.id
third = xfer.get_components("third")
third.colspan -= 2
if WrapAction.is_permission(xfer.request, right):
btn = XferCompButton("change_third")
btn.set_location(third.col + third.colspan, third.row)
btn.set_action(
xfer.request,
ActionsManage.get_action_url("payoff.Supporting", "Third", xfer),
modal=FORMTYPE_MODAL,
close=CLOSE_NO,
params={"code_mask": self.item.get_third_mask()},
)
xfer.add_component(btn)
if self.item.third is not None:
btn = XferCompButton("show_third")
btn.set_is_mini(True)
btn.set_location(third.col + third.colspan + 1, third.row)
btn.set_action(
xfer.request,
ActionsManage.get_action_url("accounting.Third", "Show", xfer),
modal=FORMTYPE_MODAL,
close=CLOSE_NO,
params={"third": self.item.third.id},
)
xfer.add_component(btn)
lbl = XferCompLabelForm("info")
lbl.set_color("red")
lbl.set_location(1, xfer.get_max_row() + 1, 4)
lbl.set_value(self.item.get_info_state())
xfer.add_component(lbl)
示例9: get_read_comp
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def get_read_comp(self):
param_cmp = XferCompLabelForm(self.name)
if self.type == 5: # password
param_cmp.set_value(''.ljust(len(self.value), '*'))
else:
param_cmp.set_value(self.get_read_text())
return param_cmp
示例10: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def fillresponse(self, year=0):
current_year = FiscalYear.objects.get(id=year)
if self.getparam("CONFIRME") is None:
nb_entry_noclose = current_year.check_to_close()
text_confirm = six.text_type(_('close-fiscal-year-confirme'))
if nb_entry_noclose > 0:
if nb_entry_noclose == 1:
text_confirm += six.text_type(_('warning, entry no validated'))
else:
text_confirm += six.text_type(_('warning, %d entries no validated') % nb_entry_noclose)
dlg = self.create_custom(self.model)
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0)
dlg.add_component(img)
lbl = XferCompLabelForm('title')
lbl.set_value_as_title(self.caption)
lbl.set_location(1, 0)
dlg.add_component(lbl)
lab = XferCompLabelForm('info')
lab.set_value(text_confirm)
lab.set_location(0, 1, 4)
dlg.add_component(lab)
signal_and_lock.Signal.call_signal("finalize_year", dlg)
dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), modal=FORMTYPE_MODAL, close=CLOSE_YES, params={'CONFIRME': 'YES'})
dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
else:
signal_and_lock.Signal.call_signal("finalize_year", self)
current_year.closed()
示例11: _create_custom_for_profit
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def _create_custom_for_profit(self, year, custom, val_profit):
from lucterios.framework.xfercomponents import XferCompImage, XferCompLabelForm, XferCompSelect
from diacamma.accounting.models import format_devise
if val_profit > 0.0001:
type_profit = 'bénéfice'
else:
type_profit = 'déficite'
img = XferCompImage("img")
img.set_location(0, 0)
img.set_value(get_icon_path("diacamma.accounting/images/account.png"))
custom.add_component(img)
lbl = XferCompLabelForm("title")
lbl.set_value_as_headername("Bénéfices et Pertes")
lbl.set_location(1, 0)
custom.add_component(lbl)
text = "{[i]}Vous avez un %s de %s.{[br/]}Vous devez definir sur quel compte l'affecter.{[br/]}{[/i]}" % (
type_profit, format_devise(val_profit, 4))
text += "{[br/]}En validant, vous commencerez '%s'{[br/]}{[br/]}{[i]}{[u]}Attention:{[/u]} Votre report à nouveau doit être totalement fait.{[/i]}" % six.text_type(
year)
lbl = XferCompLabelForm("info")
lbl.set_value(text)
lbl.set_location(0, 1, 2)
custom.add_component(lbl)
sel_cmpt = []
for account in year.chartsaccount_set.all().filter(code__startswith='10').order_by('code'):
sel_cmpt.append((account.id, six.text_type(account)))
sel = XferCompSelect("profit_account")
sel.set_select(sel_cmpt)
sel.set_location(1, 2)
custom.add_component(sel)
return custom
示例12: summary_dummy
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def summary_dummy(xfer):
if not hasattr(xfer, 'add_component'):
return True
else:
row = xfer.get_max_row() + 1
lab = XferCompLabelForm('dummytitle')
lab.set_value_as_infocenter("Dummy")
lab.set_location(0, row, 4)
xfer.add_component(lab)
lbl = XferCompLabelForm('dummy_time')
lbl.set_color('blue')
lbl.set_location(0, row + 1, 4)
lbl.set_centered()
lbl.set_value(datetime.now().ctime())
xfer.add_component(lbl)
btn = XferCompButton('btnscheduler')
btn.set_action(xfer.request, AddSchedulerTask.get_action('Task', ''))
btn.set_location(0, row + 2, 4)
xfer.add_component(btn)
lbl = XferCompLabelForm('dummy-value')
lbl.set_location(0, row + 3, 4)
lbl.set_value(Params.getvalue('dummy-value'))
xfer.add_component(lbl)
return True
示例13: finalizeyear_condo
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def finalizeyear_condo(xfer):
year = FiscalYear.get_current(xfer.getparam('year'))
if year is not None:
ventilate = xfer.getparam("ventilate", 0)
if xfer.observer_name == "core.custom":
if year.check_to_close() > 0:
raise LucteriosException(IMPORTANT, _("This fiscal year has entries not closed!"))
result = year.total_revenue - year.total_expense
if abs(result) > 0.001:
row = xfer.get_max_row() + 1
lbl = XferCompLabelForm('title_condo')
lbl.set_value(_('This fiscal year has a result no null equals to %s.') % format_devise(result, 5))
lbl.set_location(0, row, 2)
xfer.add_component(lbl)
lbl = XferCompLabelForm('question_condo')
lbl.set_value(_('Where do you want to ventilate this amount?'))
lbl.set_location(0, row + 1)
xfer.add_component(lbl)
sel_cmpt = [('0', _("For each owner"))]
for account in year.chartsaccount_set.filter(type_of_account=2).order_by('code'):
sel_cmpt.append((account.id, six.text_type(account)))
sel = XferCompSelect("ventilate")
sel.set_select(sel_cmpt)
sel.set_value(ventilate)
sel.set_location(1, row + 1)
xfer.add_component(sel)
elif xfer.observer_name == "core.acknowledge":
for set_cost in year.setcost_set.filter(year=year, set__is_active=True, set__type_load=0):
if ventilate == 0:
set_cost.set.ventilate_costaccounting(set_cost.cost_accounting, 1,
Params.getvalue("condominium-current-revenue-account"))
set_cost.cost_accounting.close()
ventilate_result(year, ventilate)
示例14: conf_wizard_contacts
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def conf_wizard_contacts(wizard_ident, xfer):
if isinstance(wizard_ident, list) and (xfer is None):
wizard_ident.append(("contacts_current", 5))
wizard_ident.append(("contacts_params", 40))
wizard_ident.append(("contacts_responsable", 41))
elif (xfer is not None) and (wizard_ident == "contacts_current"):
xfer.add_title(_("Lucterios contacts"), _("Our details"), _('configure our details'))
xfer.model = LegalEntity
xfer.item = LegalEntity.objects.get(id=1)
xfer.fill_from_model(1, xfer.get_max_row() + 1, True, desc_fields=LegalEntity.get_show_fields()[_('[email protected]')])
xfer.remove_component('structure_type')
btn = XferCompButton("btnconf")
btn.set_location(2, xfer.get_max_row() + 1)
btn.set_is_mini(True)
btn.set_action(xfer.request, CurrentStructureAddModify.get_action('', "images/edit.png"), close=CLOSE_NO)
xfer.add_component(btn)
elif (xfer is not None) and (wizard_ident == "contacts_params"):
xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"), _('configure your contacts'))
param_lists = ['contacts-mailtoconfig', 'contacts-createaccount']
Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
btn = XferCompButton('editparam')
btn.set_location(4, xfer.get_max_row())
btn.set_is_mini(True)
btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
params={'params': param_lists})
xfer.add_component(btn)
lbl = XferCompLabelForm("nb_function")
lbl.set_location(1, xfer.get_max_row() + 1)
lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Function._meta.verbose_name_plural, 'count': len(Function.objects.all())})
xfer.add_component(lbl)
lbl = XferCompLabelForm("nb_structuretype")
lbl.set_location(1, xfer.get_max_row() + 1)
lbl.set_value(TEXT_TOTAL_NUMBER % {'name': StructureType._meta.verbose_name_plural, 'count': len(StructureType.objects.all())})
xfer.add_component(lbl)
lbl = XferCompLabelForm("nb_customfield")
lbl.set_location(1, xfer.get_max_row() + 1)
lbl.set_value(TEXT_TOTAL_NUMBER % {'name': CustomField._meta.verbose_name_plural, 'count': len(CustomField.objects.all())})
xfer.add_component(lbl)
btn = XferCompButton("btnconf")
btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
xfer.add_component(btn)
lbl = XferCompLabelForm("nb_legalentity")
lbl.set_location(1, xfer.get_max_row() + 1)
lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LegalEntity._meta.verbose_name_plural, 'count': len(LegalEntity.objects.all())})
xfer.add_component(lbl)
lbl = XferCompLabelForm("nb_individual")
lbl.set_location(1, xfer.get_max_row() + 1)
lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Individual._meta.verbose_name_plural, 'count': len(Individual.objects.all())})
xfer.add_component(lbl)
btn = XferCompButton("btnimport")
btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
btn.set_action(xfer.request, ContactImport.get_action(_("Contact import"), "images/add.png"), close=CLOSE_NO, params={'step': 0})
xfer.add_component(btn)
elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
xfer.add_title(_("Lucterios contacts"), _('associates'), _('configure your association'))
xfer.params['legal_entity'] = 1
xfer.fill_grid(5, Responsability, "responsability", Responsability.objects.filter(legal_entity_id=1))
示例15: fillresponse_search_select
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value [as 别名]
def fillresponse_search_select(self):
selector, script_ref = self.fields_desc.get_select_and_script()
script_ref += """
var name=current.getValue();
var type=findFields[name];
parent.get('searchValueFloat').setVisible(type=='float');
parent.get('searchValueStr').setVisible(type=='str');
parent.get('searchValueBool').setVisible(type=='bool');
parent.get('searchValueDate').setVisible(type=='date' || type=='datetime');
parent.get('searchValueTime').setVisible(type=='time' || type=='datetime');
parent.get('searchValueList').setVisible(type=='list' || type=='listmult');
"""
script_ref += get_script_for_operator()
script_ref += """
if (type=='float') {
var prec=findLists[name].split(';');
parent.get('searchValueFloat').setValue('<FLOAT min=\"'+prec[0]+'\" max=\"'+prec[1]+'\" prec=\"'+prec[2]+'\"></FLOAT>');
}
if (type=='str') {
parent.get('searchValueStr').setValue('<STR></STR>');
}
if (type=='bool') {
parent.get('searchValueBool').setValue('<BOOL>n</BOOL>');
}
if (type=='date' || type=='datetime') {
parent.get('searchValueDate').setValue('<DATE>1900/01/01</DATE>');
}
if (type=='time' || type=='datetime') {
parent.get('searchValueTime').setValue('<DATE>00:00:00</DATE>');
}
if ((type=='list') || (type=='listmult')) {
var list=findLists[name].split(';');
var list_txt='';
for(i=0;i<list.length;i++) {
var val=list[i].split('||');
if (val.length>1) {
list_txt+='<CASE id=\"'+val[0]+'\">'+val[1]+'</CASE>';
}
}
parent.get('searchValueList').setValue('<SELECT>'+list_txt+'</SELECT>');
}
"""
label = XferCompLabelForm('labelsearchSelector')
label.set_value("{[bold]Nouveau critere{[/bold]")
label.set_location(0, 10, 1, 7)
self.add_component(label)
comp = XferCompSelect("searchSelector")
comp.set_select(selector)
comp.set_value("")
comp.set_location(1, 10, 1, 7)
comp.set_size(20, 200)
comp.java_script = script_ref
self.add_component(comp)
comp = XferCompSelect("searchOperator")
comp.set_select({})
comp.set_value("")
comp.set_size(20, 200)
comp.set_location(2, 10, 1, 7)
self.add_component(comp)