本文整理汇总了Python中lucterios.framework.xfercomponents.XferCompLabelForm类的典型用法代码示例。如果您正苦于以下问题:Python XferCompLabelForm类的具体用法?Python XferCompLabelForm怎么用?Python XferCompLabelForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XferCompLabelForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _entryline_editor
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
示例2: 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
示例3: edit
def edit(self, xfer):
xfer.change_to_readonly('type_of_account')
code_ed = xfer.get_components('code')
code_ed.mask = current_system_account().get_general_mask()
code_ed.set_action(xfer.request, xfer.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
descript, typeaccount = current_system_account().new_charts_account(self.item.code)
error_msg = ''
if typeaccount < 0:
if typeaccount == -2:
error_msg = _("Invalid code")
if self.item.code != '':
code_ed.set_value(self.item.code + '!')
if self.item.id is None:
xfer.get_components('type_of_account').set_value('---')
elif self.item.id is None:
field_type = self.item.get_field_by_name('type_of_account')
xfer.get_components('type_of_account').set_value(
get_value_if_choices(typeaccount, field_type))
xfer.get_components('name').set_value(descript)
xfer.params['type_of_account'] = typeaccount
elif typeaccount != self.item.type_of_account:
error_msg = _("Changment not allowed!")
code_ed.set_value(self.item.code + '!')
lbl = XferCompLabelForm('error_code')
lbl.set_location(1, xfer.get_max_row() + 1, 2)
lbl.set_value_center("{[font color='red']}%s{[/font]}" % error_msg)
xfer.add_component(lbl)
return
示例4: conf_wizard_accounting
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())
示例5: fillresponse_header
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)
示例6: fillresponse
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()
示例7: _create_custom_for_profit
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
示例8: fillresponse
def fillresponse(self):
img_title = XferCompImage('img')
img_title.set_location(0, 0, 1, 6)
img_title.set_value(self.icon_path())
self.add_component(img_title)
lab = XferCompLabelForm('title')
lab.set_location(1, 0, 2)
lab.set_value_as_title(_("Print models"))
self.add_component(lab)
self.fill_from_model(1, 1, False, ['name'])
self.fill_from_model(1, 2, True, ['kind'])
self.item.mode = int(self.item.mode)
if self.item.kind == 1:
self.fill_from_model(1, 3, False, ['mode'])
self.get_components('mode').set_action(
self.request, self.get_action('', ''), {'modal': FORMTYPE_REFRESH, 'close': CLOSE_NO})
if (self.item.mode == 1) and (self.item.value[:6] != '<model'):
self.item.value = "<model>\n<body>\n<text>%s</text></body>\n</model>" % self.item.value
if self.item.kind == 0:
self._fill_listing_editor()
elif (self.item.kind == 1) and (self.item.mode == 0):
self._fill_label_editor()
elif (self.item.kind == 2) or ((self.item.kind == 1) and (self.item.mode == 1)):
self._fill_report_editor()
self.add_action(
PrintModelSave.get_action(_("ok"), "images/ok.png"), {})
self.add_action(WrapAction(_('cancel'), 'images/cancel.png'), {})
示例9: edit_account_for_line
def edit_account_for_line(self, xfer, column, row, debit_rest, credit_rest):
num_cpt_txt = xfer.getparam('num_cpt_txt', '')
num_cpt = xfer.getparam('num_cpt', 0)
lbl = XferCompLabelForm('numCptlbl')
lbl.set_location(column, row, 3)
lbl.set_value_as_headername(_('account'))
xfer.add_component(lbl)
edt = XferCompEdit('num_cpt_txt')
edt.set_location(column, row + 1, 2)
edt.set_value(num_cpt_txt)
edt.set_size(20, 25)
edt.set_action(xfer.request, xfer.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
xfer.add_component(edt)
sel_val = []
current_account = None
if num_cpt_txt != '':
year = FiscalYear.get_current(xfer.getparam('year'))
sel_val, current_account = year.get_account_list(num_cpt_txt, num_cpt)
sel = XferCompSelect('num_cpt')
sel.set_location(column + 2, row + 1, 1)
sel.set_select(sel_val)
sel.set_size(20, 150)
sel.set_action(xfer.request, xfer.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
if current_account is not None:
sel.set_value(current_account.id)
self.item.account = current_account
self.item.set_montant(
float(xfer.getparam('debit_val', 0.0)), float(xfer.getparam('credit_val', 0.0)))
if abs(self.item.amount) < 0.0001:
self.item.set_montant(debit_rest, credit_rest)
xfer.add_component(sel)
return lbl, edt
示例10: fillresponse_header
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)
示例11: fillresponse
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)
示例12: fillresponse
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'), {})
示例13: fillresponse_header
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)
示例14: edit
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')
示例15: finalizeyear_condo
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)