本文整理汇总了Python中lucterios.framework.xfercomponents.XferCompLabelForm.set_value_as_name方法的典型用法代码示例。如果您正苦于以下问题:Python XferCompLabelForm.set_value_as_name方法的具体用法?Python XferCompLabelForm.set_value_as_name怎么用?Python XferCompLabelForm.set_value_as_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucterios.framework.xfercomponents.XferCompLabelForm
的用法示例。
在下文中一共展示了XferCompLabelForm.set_value_as_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: thirdaddon_accounting
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def thirdaddon_accounting(item, xfer):
if WrapAction.is_permission(xfer.request, 'accounting.change_entryaccount'):
try:
entry_lines_filter = Q(entrylineaccount__third=item)
lines_filter = xfer.getparam('lines_filter', 0)
if lines_filter == 0:
entry_lines_filter &= Q(year=FiscalYear.get_current())
elif lines_filter == 1:
entry_lines_filter &= Q(year=FiscalYear.get_current()) & Q(close=False)
xfer.new_tab(_('entry of account'))
lbl = XferCompLabelForm('lbl_lines_filter')
lbl.set_value_as_name(_('Accounts filter'))
lbl.set_location(0, 1)
xfer.add_component(lbl)
edt = XferCompSelect("lines_filter")
edt.set_select([(0, _('All entries of current fiscal year')), (1, _(
'Only no-closed entries of current fiscal year')), (2, _('All entries for all fiscal year'))])
edt.set_value(lines_filter)
edt.set_location(1, 1)
edt.set_action(xfer.request, xfer.get_action(),
modal=FORMTYPE_REFRESH, close=CLOSE_NO)
xfer.add_component(edt)
entries = EntryAccount.objects.filter(entry_lines_filter)
link_grid_lines = XferCompGrid('entryaccount')
link_grid_lines.set_model(entries, EntryAccount.get_default_fields(), xfer)
link_grid_lines.set_location(0, 2, 2)
link_grid_lines.add_action(xfer.request, ActionsManage.get_action_url('accounting.EntryAccount', 'OpenFromLine', xfer),
modal=FORMTYPE_MODAL, unique=SELECT_SINGLE, close=CLOSE_NO)
link_grid_lines.add_action(xfer.request, ActionsManage.get_action_url('accounting.EntryAccount', 'Close', xfer),
modal=FORMTYPE_MODAL, unique=SELECT_MULTI, close=CLOSE_NO)
link_grid_lines.add_action(xfer.request, ActionsManage.get_action_url('accounting.EntryAccount', 'Link', xfer),
modal=FORMTYPE_MODAL, unique=SELECT_MULTI, close=CLOSE_NO)
xfer.add_component(link_grid_lines)
except LucteriosException:
pass
示例2: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse(self, costaccounting=0):
if self.getparam("SAVE") 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_costaccounting')
lbl.set_value_as_name(CostAccounting._meta.verbose_name)
lbl.set_location(1, 1)
dlg.add_component(lbl)
sel = XferCompSelect('costaccounting')
sel.set_select_query(CostAccounting.objects.filter(status=0))
if self.item is not None:
sel.set_value(self.item.costaccounting_id)
sel.set_location(1, 2)
dlg.add_component(sel)
dlg.add_action(self.get_action(_('Ok'), 'images/ok.png'), params={"SAVE": "YES"})
dlg.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
else:
if costaccounting == 0:
new_cost = None
else:
new_cost = CostAccounting.objects.get(id=costaccounting)
for item in self.items:
if (item.costaccounting is None) or (item.costaccounting.status == 0):
item.costaccounting = new_cost
item.save()
示例3: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse(self, limit_date=''):
if limit_date == '':
dlg = self.create_custom()
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0, 1, 6)
dlg.add_component(img)
lbl = XferCompLabelForm('lb_limit_date')
lbl.set_value_as_name(_('limit date'))
lbl.set_location(1, 1, 1)
dlg.add_component(lbl)
limite_date = XferCompDate('limit_date')
limite_date.set_needed(True)
limite_date.set_value((date.today() - timedelta(weeks=25)))
limite_date.set_location(1, 2, 1)
dlg.add_component(limite_date)
dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
else:
third_ids = [val_third['third'] for val_third in EntryLineAccount.objects.filter(
entry__date_value__gt=limit_date, third__gt=0).values('third')]
for third in Third.objects.filter(status=0):
if third.id not in third_ids:
third.status = 1
third.save()
示例4: edit
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def edit(self, xfer):
if xfer.item.id is None:
third = xfer.get_components('third')
xfer.remove_component('third')
xfer.remove_component('lbl_third')
lbl = XferCompLabelForm('lbl_third')
lbl.set_location(third.col - 1, third.row)
lbl.set_value_as_name(_('third'))
xfer.add_component(lbl)
sel = XferCompSelect('third')
sel.needed = True
sel.set_location(third.col, third.row)
owner_third_ids = []
for owner in Owner.objects.all():
owner_third_ids.append(owner.third_id)
items = Third.objects.all().exclude(id__in=owner_third_ids).distinct()
items = sorted(items, key=lambda t: six.text_type(t))
sel.set_select_query(items)
xfer.add_component(sel)
btn = XferCompButton('add_third')
btn.set_location(3, 0)
btn.set_is_mini(True)
btn.set_action(xfer.request, ActionsManage.get_action_url('accounting.Third', 'Add', xfer), close=CLOSE_NO,
modal=FORMTYPE_MODAL, params={'new_account': Params.getvalue('condominium-default-owner-account')})
xfer.add_component(btn)
else:
xfer.change_to_readonly('third')
示例5: fillresponse_body
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [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)
示例6: fillresponse_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse_header(self):
status_filter = self.getparam('status_filter', 0)
self.params['status_filter'] = status_filter
date_filter = self.getparam('date_filter', 0)
self.fieldnames = Expense.get_default_fields(status_filter)
lbl = XferCompLabelForm('lbl_status_filter')
lbl.set_value_as_name(_('Filter by type'))
lbl.set_location(0, 3)
self.add_component(lbl)
dep_field = self.item.get_field_by_name('status')
sel_list = list(dep_field.choices)
edt = XferCompSelect("status_filter")
edt.set_select(sel_list)
edt.set_value(status_filter)
edt.set_location(1, 3)
edt.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
self.add_component(edt)
lbl = XferCompLabelForm('lbl_date_filter')
lbl.set_value_as_name(_('Filter by date'))
lbl.set_location(0, 4)
self.add_component(lbl)
edt = XferCompSelect("date_filter")
edt.set_select([(0, _('only current fiscal year')), (1, _('all expenses'))])
edt.set_value(date_filter)
edt.set_location(1, 4)
edt.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
self.add_component(edt)
self.filter = Q(status=status_filter)
if date_filter == 0:
current_year = FiscalYear.get_current()
self.filter &= Q(date__gte=current_year.begin) & Q(date__lte=current_year.end)
示例7: fillresponse_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse_header(self):
self.new_tab(_('Fiscal year list'))
lbl = XferCompLabelForm('lbl_account_system')
lbl.set_value_as_name(_('accounting system'))
lbl.set_location(0, 1)
self.add_component(lbl)
select_account_system(self)
示例8: fillresponse_add_title
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse_add_title(self):
XferSearchEditor.fillresponse_add_title(self)
modelname = self.model.get_long_name()
saved_list = SavedCriteria.objects.filter(modelname=modelname)
new_row = self.get_max_row()
lbl = XferCompLabelForm('lbl_saved_criteria')
lbl.set_location(1, new_row + 1)
lbl.set_value_as_name(_("saved criteria"))
self.add_component(lbl)
sel = XferCompSelect('saved_criteria')
sel.set_location(2, new_row + 1, 2)
sel.set_needed(False)
sel.set_select_query(saved_list)
sel.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(sel)
if len(self.criteria_list) > 0:
from lucterios.CORE.views import SavedCriteriaAddModify
btn = XferCompButton('btn_saved_criteria')
btn.set_location(4, new_row + 1, 2)
btn.set_is_mini(True)
btn.set_action(self.request, SavedCriteriaAddModify.get_action("+", ""), close=CLOSE_NO,
params={'modelname': modelname, 'criteria': self.getparam('CRITERIA', '')})
self.add_component(btn)
if self.getparam('saved_criteria', 0) != 0:
saved_item = SavedCriteria.objects.get(
id=self.getparam('saved_criteria', 0))
self.params['CRITERIA'] = saved_item.criteria
self.read_criteria_from_params()
示例9: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse(self, begin_date, end_date):
self.item.set_dates(begin_date, end_date)
lbl = XferCompLabelForm('lbl_begin_date')
lbl.set_value_as_name(_('initial date'))
lbl.set_location(1, 0)
self.add_component(lbl)
date_init = XferCompDate("begin_date")
date_init.set_needed(True)
date_init.set_value(self.item.date_begin)
date_init.set_location(2, 0)
date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(date_init)
lbl = XferCompLabelForm('lbl_end_date')
lbl.set_value_as_name(_('current date'))
lbl.set_location(3, 0)
self.add_component(lbl)
date_end = XferCompDate("end_date")
date_end.set_needed(True)
date_end.set_value(self.item.date_end)
date_end.set_location(4, 0)
date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(date_end)
XferShowEditor.fillresponse(self)
self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Show', self),
close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0)
self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Email', self),
close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0)
示例10: fillresponse_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse_header(self):
contact_filter = self.getparam('filter', '')
show_filter = self.getparam('show_filter', 0)
lbl = XferCompLabelForm('lbl_filtre')
lbl.set_value_as_name(_('Filtrer by contact'))
lbl.set_location(0, 2)
self.add_component(lbl)
comp = XferCompEdit('filter')
comp.set_value(contact_filter)
comp.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
comp.set_location(1, 2)
self.add_component(comp)
lbl = XferCompLabelForm('lbl_showing')
lbl.set_value_as_name(_('Accounts displayed'))
lbl.set_location(0, 3)
self.add_component(lbl)
edt = XferCompSelect("show_filter")
edt.set_select([(0, _('Hide the account total of thirds')), (1, _('Show the account total of thirds')),
(2, _('Filter any thirds unbalanced'))])
edt.set_value(show_filter)
edt.set_location(1, 3)
edt.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
self.add_component(edt)
if show_filter != 0:
self.fieldnames = Third.get_other_fields()
self.filter = Q(status=0)
if contact_filter != "":
q_legalentity = Q(contact__legalentity__name__icontains=contact_filter)
q_individual = (Q(contact__individual__firstname__icontains=contact_filter) | Q(contact__individual__lastname__icontains=contact_filter))
self.filter &= (q_legalentity | q_individual)
示例11: fill_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fill_header(self, payer, reference):
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0)
self.add_component(img)
lbl = XferCompLabelForm('title')
lbl.set_value_as_title(_("select cheque to deposit"))
lbl.set_location(1, 0, 3)
self.add_component(lbl)
lbl = XferCompLabelForm('lbl_payer')
lbl.set_value_as_name(_("payer contains"))
lbl.set_location(0, 1)
self.add_component(lbl)
edt = XferCompEdit('payer')
edt.set_value(payer)
edt.set_location(1, 1)
edt.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(edt)
lbl = XferCompLabelForm('lbl_reference')
lbl.set_value_as_name(_("reference contains"))
lbl.set_location(2, 1)
self.add_component(lbl)
edt = XferCompEdit('reference')
edt.set_value(reference)
edt.set_location(3, 1)
edt.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(edt)
示例12: edit
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def edit(self, xfer):
lbl = XferCompLabelForm('lbl_begin_date')
lbl.set_value_as_name(_('begin date'))
lbl.set_location(1, 0)
xfer.add_component(lbl)
date = XferCompDate('begin_date')
date.set_location(2, 0)
date.set_needed(True)
val = Period.objects.all().aggregate(Max('end_date'))
if ('end_date__max' in val.keys()) and (val['end_date__max'] is not None):
date.set_value(val['end_date__max'] + timedelta(days=1))
xfer.add_component(date)
示例13: fillresponse_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fillresponse_header(self):
all_cost = self.getparam('all_cost', False)
sel = XferCompCheck("all_cost")
sel.set_value(all_cost)
sel.set_location(1, 3)
sel.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
self.add_component(sel)
lbl = XferCompLabelForm("all_costLbl")
lbl.set_location(2, 3)
lbl.set_value_as_name(_("Show all cost accounting"))
self.add_component(lbl)
if not all_cost:
self.filter = Q(status=0)
示例14: _fill_listing_editor
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def _fill_listing_editor(self):
lab = XferCompLabelForm('lbl_page_width')
lab.set_location(1, 3)
lab.set_value_as_name(_("list page width"))
self.add_component(lab)
edt = XferCompFloat('page_width', 0, 9999, 0)
edt.set_location(2, 3, 2)
edt.set_value(self.item.page_width)
self.add_component(edt)
lab = XferCompLabelForm('lbl_page_height')
lab.set_location(1, 4)
lab.set_value_as_name(_("list page height"))
self.add_component(lab)
edt = XferCompFloat('page_heigth', 0, 9999, 0)
edt.set_location(2, 4, 2)
edt.set_value(self.item.page_height)
self.add_component(edt)
lab = XferCompLabelForm('lbl_col_size')
lab.set_location(1, 5)
lab.set_value_as_infocenter(_("size"))
self.add_component(lab)
lab = XferCompLabelForm('lbl_col_title')
lab.set_location(2, 5)
lab.set_value_as_infocenter(_("title"))
self.add_component(lab)
lab = XferCompLabelForm('lbl_col_text')
lab.set_location(3, 5)
lab.set_value_as_infocenter(_("text"))
self.add_component(lab)
col_index = 0
for col_size, col_title, col_text in (self.item.columns + [[0, '', ''], [0, '', ''], [0, '', '']]):
edt = XferCompFloat('col_size_%d' % col_index, 0, 999, 0)
edt.set_location(1, 6 + col_index)
edt.set_value(col_size)
self.add_component(edt)
edt = XferCompMemo('col_title_%d' % col_index)
edt.set_location(2, 6 + col_index)
edt.set_value(col_title)
edt.set_size(75, 200)
self.add_component(edt)
edt = XferCompMemo('col_text_%d' % col_index)
edt.set_location(3, 6 + col_index)
edt.set_size(50, 300)
edt.with_hypertext = True
edt.set_value(col_text)
self.fill_menu_memo(edt)
self.add_component(edt)
col_index += 1
示例15: fill_filterCode
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_name [as 别名]
def fill_filterCode(self):
if self.add_filtering:
filtercode = self.getparam('filtercode', '')
lbl = XferCompLabelForm('filtercode_lbl')
lbl.set_value_as_name(_("Accounting code starting with"))
lbl.set_location(2, 3, 1)
self.add_component(lbl)
edt = XferCompEdit('filtercode')
edt.set_value(filtercode)
edt.set_location(3, 3, 2)
edt.set_action(self.request, self.__class__.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
self.add_component(edt)
if filtercode != '':
self.filter &= Q(account__code__startswith=filtercode)