Example #1
0
def makeResultLine(brain):
  """Rewap a brain to propagate inventory kw in getCurrentInventory and getAvailableInventory
  """
  inventory_kw = {
      'node_uid': brain.node_uid,
      'resource_uid': brain.resource_uid,
      'variation_text': brain.variation_text,
  }
  if section_category:
    inventory_kw['section_category'] = section_category
  if quantity_unit:
    inventory_kw['quantity_unit'] = quantity_unit
  if metric_type:
    inventory_kw['metric_type'] = metric_type

  def getCurrentInventory():
    return portal.portal_simulation.getCurrentInventory(**inventory_kw)

  def getAvailableInventory():
    return portal.portal_simulation.getAvailableInventory(**inventory_kw)

  return Object(
      uid='new_',
      node_title=brain.node_title,
      inventory=getattr(brain, 'converted_quantity', brain.inventory),
      getCurrentInventory=getCurrentInventory,
      getAvailableInventory=getAvailableInventory,
      getVariationCategoryItemList=brain.getVariationCategoryItemList,
      variation_category_item_list=[x[0] for x in brain.getObject().getVariationCategoryItemList()],
      getListItemUrl=brain.getListItemUrl,
      getListItemParamDict=brain.getListItemParamDict,
      getListItemUrlDict=brain.getListItemUrlDict,
  )
Example #2
0
def add(script):
    # we use a function for lambda's closure
    object_list.append(
        Object(uid='new_',
               getUid=lambda: 'new_',
               id=script.id,
               title_or_id=script.title_or_id,
               absolute_url=lambda: "%s/manage_main" % script.absolute_url(),
               getListItemUrl=lambda *args: "%s/manage_main" % script.
               absolute_url()))
def makeVCSLink(repository_url, revision):
    # https://user:[email protected]/user/repo.git -> https://user:[email protected]/user/repo/commit/hash
    if 'lab.nexedi.cn' in repository_url and repository_url.endswith('.git'):
        repository_url = repository_url[:-len('.git')]
    if '@' in repository_url:  # remove credentials
        scheme = repository_url.split(':')[0]
        url = '%s://%s/commit/%s' % (scheme, repository_url.split('@')[1],
                                     revision)
    else:
        url = '%s/commit/%s' % (repository_url, revision)
    # gitweb for git.erp5.org
    if '/repos/' in url:
        url = url.replace('/repos/', '/gitweb/')
        url = url.replace('/commit/', '/commitdiff/')

    def getListItemUrl(*args, **kw):
        return url

    return Object(uid='new_',
                  getUid=lambda: 'new_',
                  getListItemUrl=getListItemUrl,
                  repository=repository_url,
                  revision=revision)
Example #4
0
        at_date=at_date,
        group_by_resource=0,
        group_by_node=1,
        ledger=ledger,
):
    price = inventory.total_price or 0
    total_price += price
    movement = inventory.getObject()
    employee = movement.getDestinationValue()
    employee_bank_account = movement.getExplanationValue()\
                                        .getDefaultPaymentConditionSourcePaymentTitle()

    object_list.append(
        Object(uid=-1,
               employee_career_reference=employee.getCareerReference(),
               employee_title=employee.getTitle(),
               employee_bank_account=employee_bank_account,
               total_price=price))

request.set('total_price', total_price)


def sort_method(a, b):
    employee_career_reference_diff = cmp(a.employee_career_reference,
                                         b.employee_career_reference)
    if employee_career_reference_diff:
        return employee_career_reference_diff
    return cmp(a.employee_title, b.employee_title)


object_list.sort(sort_method)
Example #5
0
               simulation_state, period_list, account_type, detail=False, **kw)

period_id_list = ['period_future']
for idx, _ in enumerate(period_list):
  period_id_list.append('period_%s' % idx)
period_id_list.append('period_%s' % (idx + 1))

# Initialize to something that will not be equals to 
# detail_line.mirror_section_uid below.
# In case we have used an account with mirror section,
# then mirror_section_uid will be None
previous_mirror_section_uid = -1

for detail_line in detail_line_list:
  if previous_mirror_section_uid != detail_line.mirror_section_uid:
    line = Object(uid='new_',
                  mirror_section_title=detail_line.mirror_section_title,
                  total_price=0)
    line_list.append(line)
    previous_mirror_section_uid = detail_line.mirror_section_uid
  line['total_price'] = detail_line.total_price + line['total_price']

  for period_id in period_id_list:
    previous_value = line.get(period_id, 0)
    added_value = detail_line.get(period_id, 0)
    new_value = previous_value + added_value
    if previous_value or new_value:
      line[period_id] = new_value

return line_list
               simulation_state, period_list, account_type, detail=False, **kw)

period_id_list = ['period_future']
for idx, period in enumerate(period_list):
  period_id_list.append('period_%s' % idx)
period_id_list.append('period_%s' % (idx + 1))

# Initialize to something that will not be equals to 
# detail_line.mirror_section_uid below.
# In case we have used an account with mirror section,
# then mirror_section_uid will be None
previous_mirror_section_uid = -1

for detail_line in detail_line_list:
  if previous_mirror_section_uid != detail_line.mirror_section_uid:
    line = Object(uid='new_',
                  mirror_section_title=detail_line.mirror_section_title,
                  total_price=0)
    line_list.append(line)
    previous_mirror_section_uid = detail_line.mirror_section_uid
  line['total_price'] = detail_line.total_price + line['total_price']

  for period_id in period_id_list:
    previous_value = line.get(period_id, 0)
    added_value = detail_line.get(period_id, 0)
    new_value = previous_value + added_value
    if previous_value or new_value:
      line[period_id] = new_value

return line_list
 Object(
     int_index=movement.getIntIndex(),
     title=movement.getTitle(),
     description=movement.getDescription(),
     reference=movement.getReference(),
     parent_title=delivery.getTitle(),
     parent_description=delivery.getDescription(),
     parent_reference=delivery.getReference(),
     parent_source_reference=delivery.getSourceReference(),
     parent_destination_reference=delivery.getDestinationReference(
     ),
     source_title=movement.getSourceTitle(),
     destination_title=movement.getDestinationTitle(),
     source_section_title=movement.getSourceSectionTitle(),
     destination_section_title=movement.getDestinationSectionTitle(
     ),
     source_administration_title=movement.
     getSourceAdministrationTitle(),
     destination_administration_title=movement.
     getDestinationAdministrationTitle(),
     source_trade_title=movement.getSourceTradeTitle(),
     destination_trade_title=movement.getDestinationTradeTitle(),
     source_function_title=movement.getSourceFunctionTitle(),
     destination_function_title=movement.
     getDestinationFunctionTitle(),
     source_decision_title=movement.getSourceDecisionTitle(),
     destination_decision_title=movement.
     getDestinationDecisionTitle(),
     source_account=getAccountTitle(movement.getSourceAccount()),
     destination_account=getAccountTitle(
         movement.getDestinationAccount()),
     start_date=movement.getStartDate(),
     stop_date=movement.getStopDate(),
     quantity=movement.getQuantity(),
     quantity_unit=movement.getQuantityUnitTitle(),
     resource_title=movement.getResourceTitle(),
     resource_reference=movement.getResourceReference(),
     product_line=movement.getProductLineTitle(),
     price=movement.getPrice(),
     total_price=movement.getTotalPrice(),
     price_currency=movement.getPriceCurrencyReference(),
     translated_portal_type=movement.getTranslatedPortalType(),
     parent_translated_portal_type=delivery.getTranslatedPortalType(
     ),
     translated_simulation_state_title=movement.
     getTranslatedSimulationStateTitle()))
    else:
      period_name = last_period_id
  line_dict = lineCallback(
    brain=brain,
    period_name=period_name,
    line_dict={
      'mirror_section_uid': brain.mirror_section_uid,
      'total_price': total_price,
      'age': age,
      period_name: total_price,
    },
  )
  if line_dict is not None:
    by_mirror_section_list_dict[brain.mirror_section_uid].append(line_dict)
    line_list.append(line_dict)
if by_mirror_section_list_dict:
  for row in portal_catalog(
    select_list=['title'],
    uid=by_mirror_section_list_dict.keys(),
  ):
    title = row.title
    for line in by_mirror_section_list_dict[row.uid]:
      line['mirror_section_title'] = title
return [
  Object(
    uid='new_',
    **x
  )
  for x in reportCallback(line_list)
]
      specific_reference = transaction.getDestinationReference()
    displayed_transaction[transaction.getUid()] = 1
    transaction_reference = transaction.getReference()
    title = mvt.hasTitle() and mvt.getTitle() or transaction.getTitle()
    date = brain.date
  else:
    specific_reference = ''
    transaction_reference = ''
    title = mvt.hasTitle() and mvt.getTitle() or ''
    date = None

  line = Object(uid='new_',
                title=title,
                portal_type=transaction.getTranslatedPortalType(),
                specific_reference=specific_reference,
                parent_reference=transaction_reference,
                mirror_section_title=mirror_section_title,
                node_title=getAccountId(brain.node_relative_url),
                date=date,
                debit=debit,
                credit=credit,)
  analytic_info = {}
  for analytic_column, analytic_column_title in analytic_column_list: # pylint: disable=unused-variable
    if analytic_column == 'project':
      analytic_info['project'] = brain.Movement_getProjectTitle()
    elif analytic_column == 'funding':
      analytic_info['funding'] = brain.Movement_getFundingTitle()
    elif analytic_column == 'function':
      analytic_info['function'] = brain.Movement_getFunctionTitle()
    else:
      analytic_info[analytic_column] = mvt.getProperty(analytic_column)
# request is filled by PaymentTransactionGroup_getGroupablePaymentTransactionLineList
from Products.PythonScripts.standard import Object
return Object(total_quantity=container.REQUEST['PaymentTransactionGroup_statGroupablePaymentTransactionLineList.total_quantity']),
Example #11
0
        total_source_credit += round(line.getSourceCredit(),
                                     currency_precision)
        total_source_asset_credit += round(
            line.getSourceInventoriatedTotalAssetCredit(),
            source_section_precision)
    if line.getDestination()\
        and line.getDestinationSection() == destination_section:
        total_destination_debit += round(line.getDestinationDebit(),
                                         currency_precision)
        total_destination_asset_debit += round(
            line.getDestinationInventoriatedTotalAssetDebit(),
            destination_section_precision)
        total_destination_credit += round(line.getDestinationCredit(),
                                          currency_precision)
        total_destination_asset_credit += round(
            line.getDestinationInventoriatedTotalAssetCredit(),
            destination_section_precision)

return [
    Object(
        source_debit=total_source_debit,
        source_credit=total_source_credit,
        destination_debit=total_destination_debit,
        destination_credit=total_destination_credit,
        source_asset_debit=total_source_asset_debit,
        source_asset_credit=total_source_asset_credit,
        destination_asset_debit=total_destination_asset_debit,
        destination_asset_credit=total_destination_asset_credit,
    )
]
Example #12
0
from Products.PythonScripts.standard import Object
from ZODB.POSException import ConflictError
from zExceptions import Unauthorized
Base_translateString = context.Base_translateString

try:
    context.HistoricalRevisions[serial]
except (ConflictError, Unauthorized):
    raise
except Exception:  # POSKeyError
    return [
        Object(property_name=Base_translateString(
            'Historical revisions are'
            ' not available, maybe the database has been packed'))
    ]

if next_serial == '0.0.0.0':
    new_getProperty = context.getProperty
else:
    new = context.HistoricalRevisions[next_serial]
    new_getProperty = new.getProperty
old = context.HistoricalRevisions[serial]
result = []

binary_data_explanation = Base_translateString(
    "Binary data can't be displayed")
base_error_message = Base_translateString('(value retrieval failed)')

for prop_dict in context.getPropertyMap():
    prop = prop_dict['id']
    error = False
from Products.PythonScripts.standard import Object
request = container.REQUEST

return [Object( uid='new_0',
                total=request['total_time'],
                **request['total_time_per_resource']) ]
Example #14
0
from Products.PythonScripts.standard import Object

request = context.REQUEST

return [Object(employee= request['employee_total'],
               employer=request['employer_total'],
               base=request['base_total'],
               total= request['total']
              )
       ]
Example #15
0
value_list = context.getPortalObject().portal_selections \
               .getSelectionCheckedValueList(context.REQUEST.selection_name)
if not value_list:
    raise ValueError('No Test Result selected')

if len(value_list) != 2:
    raise ValueError('Two Test Results should be selected')

a, b = value_list

if a.getSimulationState() != "stopped" or b.getSimulationState() != "stopped":
    # it's useless to compare two results that are not yet completed
    return []

compared_prop_list = ('all_tests', 'errors', 'failures', 'skips')

d = {}
for prop in compared_prop_list:
    d[prop] = b.getProperty(prop) - a.getProperty(prop)

from Products.PythonScripts.standard import Object

return [Object(uid="new_", **d)]
Example #16
0
        displayed_transaction[transaction.getUid()] = 1
        transaction_reference = transaction.getReference()
        title = mvt.hasTitle() and mvt.getTitle() or transaction.getTitle()
        date = brain.date
    else:
        specific_reference = ''
        transaction_reference = ''
        title = mvt.hasTitle() and mvt.getTitle() or ''
        date = None

    line = Object(
        uid='new_',
        title=title,
        portal_type=transaction.getTranslatedPortalType(),
        specific_reference=specific_reference,
        parent_reference=transaction_reference,
        mirror_section_title=mirror_section_title,
        node_title=getAccountId(brain.node_relative_url),
        date=date,
        debit=debit,
        credit=credit,
    )
    analytic_info = {}
    for analytic_column, analytic_column_title in analytic_column_list:
        if analytic_column == 'project':
            analytic_info['project'] = brain.Movement_getProjectTitle()
        elif analytic_column == 'funding':
            analytic_info['funding'] = brain.Movement_getFundingTitle()
        elif analytic_column == 'function':
            analytic_info['function'] = brain.Movement_getFunctionTitle()
        else:
            analytic_info[analytic_column] = mvt.getProperty(analytic_column)
from Products.PythonScripts.standard import Object
_, total_quantity = context.PaymentTransactionGroup_getAccountingTransactionLineCountAndStat(
    kw.get('selection_name'))
return Object(total_quantity=total_quantity),
Example #18
0
                                portal_type=portal.getPortalAccountingMovementTypeList(),
                                section_uid=section_uid,
                                grouping_query=grouping_query,
                                sort_on=(('stock.mirror_section_uid', 'ASC'),
                                         ('stock.date', 'ASC'),
                                         ('stock.uid', 'ASC')),
                                **extra_kw):
  movement = brain.getObject()
  transaction = movement.getParentValue()

  total_price = brain.total_price or 0
  if account_type == 'account_type/liability/payable':
    total_price = - total_price
  
  line = Object(uid='new_',
                mirror_section_title=getSectionTitle(brain.mirror_section_uid),
                mirror_section_uid=brain.mirror_section_uid,
                total_price=total_price,)

  if detail:
    # Detailed version of the aged balance report needs to get properties from
    # the movement or transactions, but summary does not. This conditional is
    # here so that we do not load objects when running in summary mode.
    line['explanation_title'] = movement.hasTitle() and movement.getTitle() or transaction.getTitle()
    line['reference'] = transaction.getReference()
    line['portal_type'] = transaction.getTranslatedPortalType()
    line['date'] = brain.date
    if brain.mirror_section_uid == movement.getSourceSectionUid() and brain.mirror_node_uid == movement.getSourceUid():
      line['specific_reference'] = transaction.getDestinationReference()
      line['gap_id'] = getAccountNumber(movement.getDestination())
    else:
      line['specific_reference'] = transaction.getSourceReference()
Example #19
0
from Products.PythonScripts.standard import Object

return [
    Object(duration=int(context.getProperty('duration', 0)),
           all_tests=context.getProperty('all_tests'),
           errors=context.getProperty('errors'),
           failures=context.getProperty('failures'),
           skips=context.getProperty('skips'))
]
Example #20
0
    source_section_uid=section_uid,
    **query_dict)
# Get every result object
for r_ticket in ticket_list:
    ticket = r_ticket.getObject()
    #show follow-up events
    event_list = portal.portal_catalog.searchResults(
        portal_type=portal.getPortalEventTypeList(),
        follow_up_uid=ticket.getUid())
    for event in event_list:
        line_list.append(
            Object(uid='new_',
                   ticket=ticket.getTitle(),
                   type=event.getTranslatedPortalType(),
                   destination_title=', '.join(
                       event.getDestinationTitleList()),
                   title=event.getTitle(),
                   stop_date=event.getStopDate(),
                   start_date=event.getStartDate(),
                   source=event.getSourceTitle(),
                   simulation_state=event.getTranslatedSimulationStateTitle()))
        #show causality events of every event
        event_causality_list = portal.portal_catalog.searchResults(
            portal_type=portal.getPortalEventTypeList(),
            causality_uid=event.getUid())
        for r_event_causality in event_causality_list:
            event_causality = r_event_causality.getObject()
            #check that one event it isn't related by causality and follow-up with the same ticket
            if ticket.getUid() <> event_causality.getFollowUpUid():
                line_list.append(
                    Object(uid='new_',
                           ticket='',
    line_dict = dict(
        uid='new_',
        resource_title=resource.getTranslatedTitle(),
    )

    for idx, base_contribution in enumerate(base_contribution_list):
        idx = str(idx)
        inventory_kw[
            'strict_base_contribution_uid'] = base_contribution_uid_dict[
                base_contribution]
        amount = multiplier * method(**inventory_kw) or 0

        line_dict[idx] = amount
        line_dict['getListItemUrl'] = URLGetter(
            section_title=section_title,
            resource_relative_url=resource.getRelativeUrl(),
            base_contribution=base_contribution,
            multiplier=multiplier,
            total_price=total_price,
        )

        total[idx] = total.get(idx, 0) + amount

    line_list.append(Object(**line_dict))

line_list.sort(key=lambda line: line.resource_title)

container.REQUEST.set('TaxReturn_getSummaryReportSectionStat', total)
return line_list
Example #22
0
i = 0
for inventory in employee_inventory_list:
    price = -(inventory.total_price or 0)
    movement = inventory.getObject()
    employee = movement.getDestinationValue()
    salary_range = movement.getSalaryRange()
    salary_range_title = movement.getSalaryRange() and\
                            movement.getSalaryRangeValue().getTranslatedTitle()

    i = i + 1
    inventory_list[(employee.getUid(), salary_range)] = Object(
        id=i,
        employee_career_reference=employee.getCareerReference(),
        employee_title=employee.getTitle(),
        employee_career_function=employee.getCareerFunctionTitle(),
        salary_range=salary_range,
        salary_range_title=salary_range_title,
        employee=price,
        base=inventory.quantity,
    )
    employee_total += price
    base_total += inventory.quantity

for inventory in employer_inventory_list:
    price = -(inventory.total_price or 0)
    movement = inventory.getObject()
    employee = movement.getDestinationValue()
    salary_range = movement.getSalaryRange()
    salary_range_title = movement.getSalaryRange() and\
                            movement.getSalaryRangeValue().getTranslatedTitle()
from Products.PythonScripts.standard import Object
request = container.REQUEST
portal = context.getPortalObject()

return [
    Object(
        debit=request.get(
            'AccountingTransactionModule_getJournalSectionLineList.total_debit'
        ),
        credit=request.get(
            'AccountingTransactionModule_getJournalSectionLineList.total_credit'
        ))
]
from Products.PythonScripts.standard import Object

cell_list = []
for name, result in zip(context.getProperty('result_header_list'),
                        context.getProperty('result_list')):
    cell_list.append(Object(name=name, result=result))

return cell_list
from Products.PythonScripts.standard import Object

return [
    Object(uid='new_',
           resource_title='Total',
           **container.REQUEST[script.getId()])
]
Example #26
0
        if mode == 'delivery_line':
            delivery_line_data_list.append(
                Object(
                    delivery_title=delivery_title,
                    delivery_reference=delivery_reference,
                    delivery_mode=delivery_mode,
                    source_section_title=movement.getSourceSectionTitle(),
                    source_title=movement.getSourceTitle(),
                    destination_section_title=movement.
                    getDestinationSectionTitle(),
                    destination_title=destination_value.getTitle(),
                    destination_default_address_text=destination_value.
                    getDefaultAddressText(),
                    destination_region_title=destination_value.
                    getRegionTranslatedTitle(),
                    destination_default_telephone_coordinate_text=
                    destination_value.getDefaultTelephoneCoordinateText(),
                    destination_default_email_coordinate_text=destination_value
                    .getDefaultEmailCoordinateText(),
                    quantity=movement.getQuantity(),
                    quantity_unit=movement.getQuantityUnitTranslatedTitle(),
                    resource_reference=resource_reference,
                    resource_title=movement.getResourceTitle(),
                    variation=variation,
                    start_date=movement.getStartDate(),
                    stop_date=movement.getStopDate(),
                    description=movement.getDescription()
                    or delivery_description,
                ))

    if mode == 'delivery':
Example #27
0
            result = portal.portal_catalog(portal_type=('Project',
                                                        'Project Line'),
                                           title=line_source_project_title)
            project_search_dict[line_source_project_title] = result
        if len(result) == 0:
            error_message = "No such project"
        elif len(result) > 1:
            error_message = "Too many matching projects"
        else:
            line_dict['source_project_relative_url'] = result[
                0].getRelativeUrl()
        if error_message:
            validation_errors[
                'listbox_source_project_title_new_%s' % key] = Object(
                    field_id='listbox_source_project_title_new_%s' % key,
                    getMessage=lambda translateString, message=error_message:
                    translateString(message),
                )
    listbox.append(line_dict)
    i += 1

context.Base_updateDialogForm(listbox=listbox, update=1, kw=kw)

if len(validation_errors):
    request.set('field_errors', validation_errors)
    kw['REQUEST'] = request

# if called from the validate action we create tasks
if create and len(validation_errors) == 0:
    for line in listbox:
        delivery_line = portal.restrictedTraverse(line['relative_url'])
Example #28
0
from Products.PythonScripts.standard import Object

return [
    Object(
        uid="new_",
        total_quantity=context.getMovementHistoryStat(**kw)['total_quantity'],
    )
]
# build result dict per portal_type then period
portal_type_count_dict = {}
for result in result_list:
    if portal_type_count_dict.has_key(result[2]):
        portal_type_count_dict[result[2]][result[1]] = result[0]
    else:
        portal_type_count_dict[result[2]] = {result[1]: result[0]}

# now filled the listbox with count results
line_list = []
append = line_list.append
period_count_dict = {}
for portal_type in portal_type_list:
    if portal_type_count_dict.has_key(portal_type):
        period_count = portal_type_count_dict[portal_type]
        obj = Object(uid="new_")
        obj["document_type"] = context.Base_translateString(portal_type)
    else:
        continue
    line_counter = 0
    for period in period_list:
        if period_count.has_key(period):
            obj[period] = period_count[period]
            line_counter += period_count[period]
            if period_count_dict.has_key(period):
                period_count_dict[
                    period] = period_count_dict[period] + period_count[period]
            else:
                period_count_dict[period] = period_count[period]
        else:
            obj[period] = 0
from Products.PythonScripts.standard import Object
request = container.REQUEST

return [
    Object(
        debit_price=request.get(
            'Account_statNotGroupedAccountingTransactionList.total_debit_price'
        ),
        credit_price=request.get(
            'Account_statNotGroupedAccountingTransactionList.total_credit_price'
        ),
        debit=request.get(
            'Account_statNotGroupedAccountingTransactionList.total_debit'),
        credit=request.get(
            'Account_statNotGroupedAccountingTransactionList.total_credit'),
    )
]
Example #31
0
                              " used in presence and leave."

        person_time = (person_planned_time - person.getAvailableTime(
            from_date=from_date,
            to_date=to_date,
            resource=presence_resource_uid_list +
            [inventory.resource_uid])) / 60. / 60.

        result_dict[resource] = person_time

        total_time_per_resource[resource] = \
            person_time + total_time_per_resource.get(resource, 0)

        person_total += person_time
        total_time += person_time

    result_list.append(
        Object(uid='new_0',
               person_title=person.getTitle(),
               person_career_reference=person.getCareerReference(),
               total=person_total,
               **result_dict))

result_list.sort(lambda a, b: cmp(a.person_career_reference or a.person_title,
                                  b.person_career_reference or b.person_title))

request.set('total_time', total_time)
request.set('total_time_per_resource', total_time_per_resource)

return result_list
  total_initial_credit_balance += round(initial_credit_balance, precision)
  final_debit_balance = round(initial_debit_balance + data['debit'], precision)
  final_credit_balance = round(initial_credit_balance + data['credit'], precision)
  closing_balance = final_debit_balance - final_credit_balance
  total_final_balance_if_debit += round(max(closing_balance, 0), precision)
  total_final_balance_if_credit += round(max(-closing_balance, 0) or 0, precision)

  line = Object(
    uid='new_',
    node_id=node_id,
    node_title=node_title,
    mirror_section_title=mirror_section_title,
    node_relative_url=node_relative_url,
    initial_balance=initial_debit_balance - initial_credit_balance,
    initial_debit_balance=initial_debit_balance,
    initial_credit_balance=initial_credit_balance,
    debit=data['debit'],
    credit=data['credit'],
    final_balance=final_debit_balance - final_credit_balance,
    final_debit_balance=final_debit_balance,
    final_credit_balance=final_credit_balance,
    final_balance_if_debit=max(closing_balance, 0),
    final_balance_if_credit=max(-closing_balance, 0) or 0,
  )

  sort_key = (node_string_index, node_title, mirror_section_title)
  analytic_dict = {}
  for analytic, uid in zip(group_analytic, analytic_key_list):
    title = getAnalyticTitleFromUid(uid)
    analytic_dict[analytic] = title
    if analytic == 'section_uid':
Example #33
0
    debit = max(brain.total_quantity, 0)
    total_debit += debit
    credit = max(-brain.total_quantity, 0)
    total_credit += credit

    debit_price = max((brain.total_price or 0), 0)
    total_debit_price += debit_price
    credit_price = max(-(brain.total_price or 0), 0)
    total_credit_price += credit_price

    line = Object(uid='new_000',
                  total_price=brain.total_price,
                  date=brain.date,
                  Movement_getSpecificReference=specific_reference,
                  mirror_section_title=mirror_section_title,
                  section_title=section_title,
                  debit=debit,
                  credit=credit,
                  debit_price=debit_price,
                  credit_price=credit_price,
                  Movement_getExplanationTitleAndAnalytics=brain.
                  Movement_getExplanationTitleAndAnalytics(brain))

    line_list.append(line)

context.REQUEST.set(
    'Account_statNotGroupedAccountingTransactionList.total_debit', total_debit)
context.REQUEST.set(
    'Account_statNotGroupedAccountingTransactionList.total_credit',
    total_credit)
context.REQUEST.set(
    'Account_statNotGroupedAccountingTransactionList.total_debit_price',
  base_total += inventory.quantity

for inventory in employer_inventory_list:
  price = - (inventory.total_price or 0)
  movement = inventory.getObject()
  employee = movement.getDestinationValue()
  salary_range = movement.getSalaryRange()
  salary_range_title = movement.getSalaryRange() and\
                          movement.getSalaryRangeValue().getTranslatedTitle()

  key = (employee.getUid(), salary_range)
  if key not in inventory_list:
    inventory_list[key] = Object(id=i,
               employee_career_reference=employee.getCareerReference(),
               employee_title=employee.getTitle(),
               employee_career_function=employee.getCareerFunctionTitle(),
               employee=0,
               salary_range=salary_range,
               salary_range_title=salary_range_title,
               base=inventory.quantity, )
    base_total += inventory.quantity
    i = i + 1

  employee = inventory.getDestinationValue()
  inventory_list[key].employer = price
  inventory_list[key].total = inventory_list[key].employee + price
  employer_total += price

total = employee_total + employer_total

request.set('employee_total', employee_total)
request.set('employer_total', employer_total)