def getReportSectionListForObject(doc):
    """ Get all possible report section for object. """
    report_section_list = []
    doc = doc.getObject()
    title = doc.getTitle()
    report_section_list.append(
        ReportSection(level=1, title=title, form_id=None))
    for action in portal.portal_actions.listFilteredActionsFor(
            doc)['object_view']:
        form_id = action['url'].split('/')[-1].split('?')[0]
        action_title = action['title']
        if action_title != 'History' and action_title != 'Metadata':
            report_section_list.append(
                ReportSection(path=doc.getPath(),
                              form_id=form_id,
                              level=2,
                              title='%s - %s' %
                              (title, translateString(action_title))))
    return report_section_list
Beispiel #2
0
def addReportSection(**kw):
    kw.setdefault('form_id', 'Account_viewAccountingTransactionList')
    kw.setdefault('selection_name', 'account_preference_selection')
    kw.setdefault('selection_columns', account_columns)
    kw.setdefault('listbox_display_mode', 'FlatListMode')
    title = kw['title']
    if export:  # in export more we do not insert report sections headers and use
        # a list view form
        kw.pop('title')
        kw['form_id'] = 'Account_viewAccountingTransactionListExport'
    report_section_list.append((title, ReportSection(**kw)))
def getReportSectionForObject(doc):
    """ Get all possible report section for object. """
    doc = doc.getObject()
    actions = portal.portal_actions.listFilteredActionsFor(doc)
    # use the default view
    action = actions['object_view'][0]
    # unless a print action exists
    if actions.get('object_print'):
        # we ignore the default print action.
        valid_print_dialog_list = [
            ai for ai in actions['object_print']
            if getFormIdFromAction(ai) != 'Base_viewPrintDialog'
        ]
        if valid_print_dialog_list:
            action = valid_print_dialog_list[0]

    form_id = getFormIdFromAction(action)
    return ReportSection(path=doc.getPath(),
                         form_id=form_id,
                         title=doc.getTitleOrId())
Beispiel #4
0
                                                       'No description')
        requirement = attachement_type_dict[title].get('requirement',
                                                       'No requirement')
    else:
        description = 'No description'
        requirement = 'Requirement not found'

    selection_params = {
        'title': title,
        'description': N_(description),
        'attachment_list': content_group_dict[title]
    }

    # XXX display requirement word only on required attachments
    if requirement == 'Required':
        selection_params.update({'requirement': N_(requirement)})
    else:
        selection_params.update({'requirement': ''})

    result.append(
        ReportSection(
            path=context.getPhysicalPath(),
            #      title=title,
            level=1,
            form_id='PDFDocument_viewAttachmentReportSection',
            selection_name='attachment_selection',
            selection_params=selection_params,
            listbox_display_mode='FlatListMode'))

return result
Beispiel #5
0
from Products.ERP5Form.Report import ReportSection
return (ReportSection(
    form_id='AccountingTransactionModule_viewNetSalaryReportSection'), )
Beispiel #6
0
from Products.ERP5Form.Report import ReportSection

return [
    ReportSection(title='1. First', level=1),
    ReportSection(title='1.1 First / First', level=2),
    ReportSection(title='1.2 First / Second', level=2),
    ReportSection(title='1.2.1 First / Second / First', level=3),
    ReportSection(title='2. Second', level=1),
]
Beispiel #7
0
        'funding_title',
        'Funding',
    ),
    (
        'project_title',
        'Project',
    ),
    ('product_line', 'Product Line'),
    ('string_index', 'String Index'),
    ('date', 'Operation Date'),
    ('debit_price', 'Converted Debit'),
    ('credit_price', 'Converted Credit'),
    ('price', 'Converted Net'),
    ('currency', 'Accounting Currency'),
    ('debit', 'Debit'),
    ('credit', 'Credit'),
    ('quantity', 'Net'),
    ('resource', 'Transaction Currency'),
    ('translated_portal_type', 'Line Type'),
    ('parent_translated_portal_type', 'Transaction Type'),
    ('translated_simulation_state_title', 'State'),
)

return [
    ReportSection(
        form_id=
        'AccountingTransactionModule_viewAccountingLineReportReportSection',
        selection_columns=selection_columns,
        path=context.getPhysicalPath())
]
Beispiel #8
0
from Products.ERP5Form.Report import ReportSection
request = container.REQUEST
return ReportSection(form_id='DeliveryModule_viewDeliveryLineList',
                     path=context.getPhysicalPath(),
                     selection_params=dict(
                         portal_type=request['portal_type'],
                         module_selection_name=request['selection_name'])),
Beispiel #9
0
from Products.ERP5Form.Report import ReportSection
from Products.ERP5Type.DateUtils import getIntervalListBetweenDates
from DateTime import DateTime

result = []
# civil status
result.append(
    ReportSection(path=context.getPhysicalPath(),
                  title=context.Base_translateString('Civil Status'),
                  form_id='Person_viewPersonDetailedCivilStatus'))

# career list
result.append(
    ReportSection(path=context.getPhysicalPath(),
                  title=context.Base_translateString('Careers'),
                  listbox_display_mode='FlatListMode',
                  form_id='Person_viewPersonDetailedCareerList'))

# event list only if event module exists
if context.getPortalObject().hasObject('event_module'):
    result.append(
        ReportSection(path=context.getPhysicalPath(),
                      title=context.Base_translateString('Events'),
                      listbox_display_mode='FlatListMode',
                      form_id='Person_viewPersonDetailedEventList'))

# contributions list
if context.getReference() not in (None, ""):
    # list only if user has a login defined
    aggregation_level = context.REQUEST.get('aggregation_level')
    from_date = context.REQUEST.get('from_date')
  the form of report sections.

  TODO: cache this result in RAM 
  on a per transaction level.
"""
REQUEST = context.REQUEST
if display_success is None:
    display_success = REQUEST.form.get('display_success')
if display_raw_result is None:
    display_raw_result = REQUEST.form.get('display_raw_result')

from Products.ERP5Form.Report import ReportSection
result = []

for alarm in context.contentValues():
    if alarm.isEnabled() and \
      (display_success or alarm.sense()) and\
      (display_raw_result or alarm.getReportMethodId()):
        if alarm.getReportMethodId():
            form_id = alarm.getReportMethodId()
        else:
            form_id = 'Alarm_viewReport'
        result.append(
            ReportSection(title=alarm.getTitle(),
                          path=alarm.getPhysicalPath(),
                          level=1,
                          form_id=form_id,
                          listbox_display_mode='FlatListMode'))

return result
  if o.getPortalType() == 'Person' or\
      not o.isMemberOf(section_category):
        # don't show entities belonging to the group we are reporting
    if omit_balanced_accounts and (
        round(simulation_tool.getInventoryAssetPrice(
                    mirror_section_uid=party.uid,
                    ignore_unknown_columns=True,
                    precision=precision,
                    node_category_strict_membership=(
                          'account_type/asset/receivable',
                          'account_type/liability/payable'),
                    **params
                    ), precision) == 0.):
      pass
    else:
      title = o.getTitle()
      if o.getProperty('role', None):
        title += ' (%s)' % o.getRoleTranslatedTitle()
      result.append(
                 ReportSection(title=title,
                               level=1,
                               path=o.getPhysicalPath(),
                               form_id='Entity_viewAccountingTransactionList',
                               selection_name='other_parties_report_selection',
                               selection_params=params,
                               selection_columns=entity_columns,
                               selection_sort_order=[('stock.date', 'ascending'),
                                                      ('stock.uid', 'ascending'),],))

return result
    )

    for journal, journal_name in common_selection_params['journal_list']:
        # get all resources that have been used with this inventory parameters
        resource_list = [
            brain.resource_relative_url
            for brain in portal.portal_simulation.getInventoryList(
                group_by_node=0,
                group_by_section=0,
                group_by_resource=1,
                parent_portal_type=journal,
                strict_base_contribution_uid=base_amount_uid_list,
                **inventory_kw)
        ]

        for resource_relative_url in resource_list:
            resource = portal.restrictedTraverse(resource_relative_url)
            selection_params['journal'] = journal
            selection_params[
                'resource_relative_url'] = resource.getRelativeUrl()
            selection_params['section_title'] = '%s (%s/%s)' % (
                section_title, journal_name, resource.getTranslatedTitle())
            report_section_list.append(
                ReportSection(
                    path=context.getPhysicalPath(),
                    form_id='TaxReturn_viewDetailReportSection',
                    selection_name='tax_return_detail_report_section_selection',
                    selection_params=selection_params.copy()))

return report_section_list
variation_category_dict = {}
for variation_category in reference_variation_category_list:
  base_category = variation_category.split('/',1)[0]
  if variation_category_dict.has_key( base_category ):
    variation_category_dict[base_category].append( variation_category )
  else:
    variation_category_dict[base_category] = [variation_category]

variation_key_list = cartesianProduct( variation_category_dict.values() )


for variation_key in variation_key_list:
  params =  { 
    'reference_variation_category_list' : variation_key,
  }

  result.append(
    # Context is report form
    ReportSection(path=context.getPhysicalPath(), 
                  title='Resource variation',   
                  level=1,
                  form_id='Transformation_viewExpanded',
                  selection_name='transformation_expanded_selection',
                  selection_params=params,
#                  selection_columns="Id",
                  listbox_display_mode='FlatListMode'
    )             
  )

return result
analytic_column_list = ()
if hide_analytic:
    selection_params['group_by'] = ('explanation_uid', 'mirror_section_uid',
                                    'payment_uid', 'node_uid')
else:
    analytic_column_list = context.accounting_module.AccountModule_getAnalyticColumnList(
    )
    selection_params['analytic_column_list'] = analytic_column_list

selection_columns = (
    ('specific_reference', 'Transaction Reference'),
    ('date', 'Date'),
    ('title', 'Accounting Transaction Title'),
    ('parent_reference', 'Document Reference'),
)
if len(portal_type) > 1:
    selection_columns += (('portal_type', 'Transaction Type'), )
selection_columns += analytic_column_list + (
    ('node_title', 'Account'), ('mirror_section_title', 'Third Party'),
    ('debit', 'Debit'), ('credit', 'Credit'))

return [
    ReportSection(path=context.getPhysicalPath(),
                  title=Base_translateString('Transactions'),
                  selection_name='journal_selection',
                  form_id='AccountingTransactionModule_viewJournalSection',
                  selection_columns=selection_columns,
                  selection_params=selection_params)
]
Beispiel #15
0
from Products.ERP5Form.Report import ReportSection
result = []
selection_columns = [('simulation_state', 'State')]
#Add dynamicaly ticket type columns to the form
#The name of column must be without spaces
for ticket_type in context.getPortalTicketTypeList():
  selection_columns.append((ticket_type.replace(' ',''),ticket_type))
selection_columns.append(('unassigned', 'Unassigned'))
selection_columns.append(('total', 'Total'))

result.append(ReportSection(
              path=context.getPhysicalPath(),
              selection_columns=selection_columns,
              listbox_display_mode='FlatListMode',
              title=context.Base_translateString('Events'),
              form_id='EventModule_viewEventActivityList'))
return result
"""Return a list of Report Section"""
from Products.ERP5Form.Report import ReportSection

kw = {
    'path': context.getPhysicalPath(),
    'form_id': 'Foo_viewDummyListBox',
    'level': 1,
    #  'listbox_display_mode': 'FlatListMode',
    #  'selection_params': {},
    'temporary_selection': False,
}
return [ReportSection(**kw) for _ in xrange(3)]
Beispiel #17
0
from Products.ERP5Form.Report import ReportSection
result = []
selection_columns = [('ticket_title', 'Title')]
selection_columns.append(('ticket_type', 'Module'))
selection_columns.append(('resource','Type'))
#Add dynamicaly event states columns to the form
#The name of column must be without spaces
for event_state in context.ERP5Site_getWorkflowStateItemList(
    portal_type=context.getPortalEventTypeList(), state_var='simulation_state', translate=False, display_none_category=False):
  if event_state[1]!='deleted':
    selection_columns.append((event_state[1],event_state[0]))
selection_columns.append(('total', 'Total'))

result.append(ReportSection(
              path=context.getPhysicalPath(),
              selection_columns=selection_columns,
              listbox_display_mode='FlatListMode',
              form_id='EventModule_viewEventDetailedList'))
return result
Beispiel #18
0
    ('credit_price', 'Credit'),
    ('running_total_price', 'Running Balance'),
    ('grouping_reference', 'Grouping Reference'),
    ('grouping_date', 'Grouping Date'),
    ('modification_date', 'Modification Date'),
    ('getTranslatedSimulationStateTitle', 'State'),
)

if export:
    selection_columns = context.AccountModule_getGeneralLedgerColumnItemList()

report_section_list = []
if from_date and detailed_from_date_summary:
    report_section_list.append(
        ReportSection(
            form_id='',
            level=4,
            title=translateString('Not Grouped Lines in Beginning Balance')))

    report_section_list.append(
        ReportSection(
            path=node,
            form_id='Account_viewNotGroupedAccountingTransactionList',
            selection_name='account_preference_selection',
            selection_params=params,
            selection_columns=selection_columns,
            listbox_display_mode='FlatListMode',
            selection_sort_order=[('stock.date', 'ascending'),
                                  ('stock.uid', 'ascending')],
        ))

    report_section_list.append(
Beispiel #19
0
from Products.ERP5Form.Report import ReportSection
return (ReportSection(
    form_id='AccountingTransactionModule_viewPaySheetLineReportSection'), )
from Products.ERP5Form.Report import ReportSection

report_section_list = []

for section_info in context.TaxReturn_getSectionInformationList():
    section_title = section_info['section_title']
    selection_params = section_info['selection_params']
    selection_params['section_title'] = section_title
    report_section_list.append(
        ReportSection(
            path=context.getPhysicalPath(),
            form_id='TaxReturn_viewSummaryReportSection',
            selection_name='tax_return_summary_report_section_selection',
            selection_params=selection_params))

return report_section_list
entity_columns = (
    ('title', 'Title'),
    ('getStopDate', 'Date'),
    ('reference', 'Invoice No'),
    ('getDestinationSectionTitle', 'Third Party'),
    ('source_reference', 'Reference'),
    ('simulation_state', 'State'),
    ('source_debit', 'Debit'),
    ('source_credit', 'Credit'),
    ('source_balance', 'Balance'),
)

for entity in entities:
    result.append(
        ReportSection(path=context.getPhysicalPath(),
                      title='Bank accounts for %s' % entity.getTitle(),
                      level=1,
                      form_id=None))

    for bank in entity.searchFolder(portal_type='Bank Account'):
        o = bank.getObject()
        result.append(
            ReportSection(
                title='%s (%s)' % (o.getTitle(), entity.getTitle()),
                level=2,
                path=o.getPhysicalPath(),
                form_id='BankAccount_viewAccountingTransactionList',
                ##  XXX Here we must use accounting_selection, because stat scripts read this selection
                selection_name='accounting_selection',
                selection_params=params,
                selection_columns=entity_columns,
            ))
Beispiel #22
0
from Products.ERP5Form.Report import ReportSection
request = container.REQUEST

if context.getSourcePayment():
  # As we are showing quantities and not asset prices, we use the precision
  # from this bank account currency.
  request.set('precision',
      context.getQuantityPrecisionFromResource(
        context.getSourcePaymentValue().getPriceCurrency()))

report_section_list = [
  ReportSection(form_id='BankReconciliation_view',
                path=context.getPhysicalPath()),
]

if request.get('show_reconcilied', True):
  report_section_list.append(
    ReportSection(form_id='BankReconciliation_viewBankReconciliationReportSection',
                  path=context.getPhysicalPath(),
                  selection_name="bank_reconciliation_report_selection",
                  selection_params={'title': 'Reconciled Transactions',
                                    'reconciliation_mode': 'unreconcile'}))
if request.get('show_non_reconcilied', True):
  report_section_list.append(
    ReportSection(form_id='BankReconciliation_viewBankReconciliationReportSection',
                  selection_name="bank_reconciliation_report_selection",
                  path=context.getPhysicalPath(),
                  selection_params={'title': 'Not Reconciled Transactions',
                                    'reconciliation_mode': 'reconcile'}))

return report_section_list
from Products.ERP5Form.Report import ReportSection
from Products.ERP5Type.Message import translateString
request = container.REQUEST

report_section_list = []
if request['delivery_line_list_mode']:
    report_section_list.append(
        ReportSection(
            form_id='DeliveryModule_viewShipmentLineList',
            path=context.getPhysicalPath(),
            title=str(
                translateString(
                    context.DeliveryModule_viewShipmentLineList.getProperty(
                        'title'))),
            selection_params=dict(
                module_selection_name=request['selection_name'])))
if request['delivery_list_mode']:
    report_section_list.append(
        ReportSection(form_id='DeliveryModule_viewShipmentDeliveryList',
                      path=context.getPhysicalPath(),
                      title=str(
                          translateString(
                              context.DeliveryModule_viewShipmentDeliveryList.
                              getProperty('title'))),
                      selection_params=dict(
                          module_selection_name=request['selection_name'])))

return report_section_list
Beispiel #24
0
selection_name = 'project_monthly_report_selection'
portal.portal_selections.setListboxDisplayMode(request, 'ReportTreeMode',
                                              selection_name=selection_name)

result = []
from Products.ERP5Form.Report import ReportSection

project_dict = {}
for project_relative_url in project_relative_url_dict.keys():
  project_dict[project_relative_url] = portal.restrictedTraverse(project_relative_url)
param_list = [object_dict, summary_dict, column_list, project_dict,
              monthly_project_to_display_dict, False, full_date_string]

result.append(ReportSection(
              path=context.getPhysicalPath(),
              param_list=param_list,
              method_id='Project_getMonthlyReportContext',
              listbox_display_mode='ReportTreeMode',
              form_id='Project_viewMonthlyReportData'))

param_list = [total_object_dict, total_summary_dict, column_list, project_dict,
              total_project_to_display_dict, True, full_date_string]
result.append(ReportSection(
              path=context.getPhysicalPath(),
              param_list=param_list,
              method_id='Project_getMonthlyReportContext',
              listbox_display_mode='ReportTreeMode',
              form_id='Project_viewMonthlySummaryReportData'))
return result
}

balance_columns = (
    ('title'          , 'Account')
  , ('opening_balance', 'Opening Balance')
  , ('debit_movement' , 'Debit Movements')
  , ('credit_movement', 'Credit Movements')
  , ('closing_balance', 'Closing Balance')
)

result.append( ReportSection(
                  path                 = portal.account_module.getPhysicalPath()
                  # FIXME: translate later (?)
                , title                = portal.Localizer.erp5_ui.gettext('Trial Balance').encode('utf8')
                , level                = 1
                , form_id              = 'AccountModule_viewAccountListForTrialBalance'
                , selection_name       = 'accounting_selection'
                , selection_params     = params
                , listbox_display_mode = 'FlatListMode'
                , selection_columns    = balance_columns
                ))

# Add a spacer
result.append( ReportSection( path    = portal.account_module.getPhysicalPath()
                            , title   = '\n'
                            , form_id = None
                            ))

# Add summary lines
result.append( ReportSection(
                  path                 = portal.account_module.getPhysicalPath()
Beispiel #26
0
"""Collect all possible (sub contained) Ram Cache Plugins.
   This collection will be used in respective report form."""
from Products.ERP5Form.Report import ReportSection

result = []
for ram_cache_plugin in context.getPortalObject().portal_catalog(
                                             portal_type = 'Ram Cache',
                                             path ='%' + context.getRelativeUrl() +'%'):
  result.append(ReportSection(path = ram_cache_plugin.getRelativeUrl(), 
                              form_id = 'RamCache_viewStatisticList',
                              title = '%s/%s' %(ram_cache_plugin.getParentValue().getTitle(),
                                                ram_cache_plugin.getTitle()),))
return result
Beispiel #27
0
        continue
    existing_section_dict[key] = True

    selection_params = default_selection_params.copy()
    selection_params['from_date'] = from_date
    selection_params['at_date'] = at_date
    selection_params['node_uid'] = inventory.node_uid
    selection_params['payment_uid'] = inventory.payment_uid or Query(
        payment_uid=None)
    selection_params.setdefault('mirror_section_uid', None)
    addReportSection(path=inventory.node_relative_url,
                     selection_params=selection_params,
                     title=getFullAccountName(key))
    total_params['node_uid'].add(inventory.node_uid)

report_section_list = [
    x[1] for x in sorted(report_section_list, key=lambda x: x[0])
]

if not export:
    total_params['at_date'] = at_date
    total_params['node_uid'] = list(total_params['node_uid'])
    report_section_list.append(
        ReportSection(path=context.getPhysicalPath(),
                      title=Base_translateString("Total"),
                      form_id='AccountModule_viewGeneralLedgerSummary',
                      selection_name='accounting_report_selection',
                      selection_params=total_params))

return report_section_list
Beispiel #28
0
from Products.ERP5Form.Report import ReportSection

result = []

params = {}

portal = context.portal_url.getPortalObject()

for project_line in [x.getObject() for x in context.searchFolder(sort_id='int_index')]:

  result.append(
                 ReportSection(path=project_line.getPhysicalPath(),    
                               form_id='ProjectLine_viewReport',
                               selection_name='project_line_selection',
                               selection_params=params,
                               #listbox_display_mode='ReportTreeMode',
                               
                               )             
               )


return result
Beispiel #29
0
    module_selection_name, selection_params)

report_section_list = []
try:
    all_uid_list = portal.portal_selections.getSelectionCheckedUidsFor(
        module_selection_name)
    if not all_uid_list:
        all_uid_list = [
            x.uid for x in portal.portal_selections.callSelectionFor(
                module_selection_name, context=context)
        ]

    # split in chunks
    batch_size = 1000
    for uid_list in [
            all_uid_list[x:x + batch_size]
            for x in xrange(0, len(all_uid_list), batch_size)
    ]:
        report_section_list.append(
            ReportSection(form_id='DeliveryModule_viewDeliveryLineList',
                          path=context.getPhysicalPath(),
                          selection_params=dict(
                              portal_type=request['portal_type'],
                              use_list=request['use'],
                              uid_list=uid_list,
                              module_selection_name=module_selection_name)))
    return report_section_list
finally:
    context.getPortalObject().portal_selections.setSelectionParamsFor(
        module_selection_name, saved_selection_params)
                         mapping={'day_count': period_list[-1]}))))
editable_columns.append(('period_%s' % (idx + 1), ''))

selection_params = dict(section_category=section_category,
                        section_category_strict=section_category_strict,
                        account_type=account_type,
                        editable_columns=editable_columns,
                        simulation_state=simulation_state,
                        period_list=period_list,
                        at_date=at_date)

ledger = request.get('ledger', None)
if ledger:
    selection_params['ledger'] = ledger

return [
    ReportSection(
        form_id=(
            detailed and
            'AccountingTransactionModule_viewDetailedAgedBalanceReportSection'
            or
            'AccountingTransactionModule_viewSummaryAgedBalanceReportSection'),
        path=context.getPhysicalPath(),
        selection_columns=selection_columns,
        selection_name=(
            detailed
            and 'accounting_transaction_module_detailed_aged_balance_selection'
            or 'accounting_transaction_module_summary_aged_balance_selection'),
        selection_params=selection_params)
]