Commit eb0aea63 authored by Jérome Perrin's avatar Jérome Perrin
Browse files

Remove spaces at end of line in all python files

These are useless, git complain about them and they cause unnecessary diffs when having editor configured to automatically remove spaces at end of lines, so let's do a big commit to remove them all at once

See merge request nexedi/erp5!1672
parents 28048ede 97f4cb91
No related merge requests found
......@@ -7,13 +7,13 @@ To use, write your own method (probably External Method, since it is most likely
to use re) that would analyze text content of the doc
and return a dictionary of properties.
"""
#Proxify to allow discover of metadata when publishing document
#Proxify to allow discover of metadata when publishing document
information = context.getContentInformation()
result = {}
property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
if v:
if isinstance(v, unicode): v = v.encode('utf-8')
......
......@@ -4,7 +4,7 @@ def hasError(email):
email_parts = email.split('@')
if len(email_parts) != 2:
return True
suffix_parts = email_parts[1].split('.')
if len(suffix_parts) < 2:
return True
......
......@@ -51,7 +51,7 @@ document.releaseAlive()
#Get param and key to connect the user
param, key = person.Person_getEncryptedLogin()
#Store real path in session for Document_getJSONInformation
#Store real path in session for Document_getJSONInformation
portal_sessions = context.portal_sessions
session = portal_sessions[reference]
session['document_url'] = document.getRelativeUrl()
......
"""
This scripts add the balance of every gap account in the list 'account_id_list'
it use portal_simulation.getInventory.
it use portal_simulation.getInventory.
The following REQUEST keys are mandatory :
The following REQUEST keys are mandatory :
at_date
those are optional :
those are optional :
gap_base
simulation_state
resource
section_category
those are ignored from the request and should explicitely passed as keywords args to this script :
those are ignored from the request and should explicitely passed as keywords args to this script :
from_date
parameters keywords to this script overrides REQUEST keys
"""
......
......@@ -15,15 +15,15 @@ return (
('credit_price', 'Credit'),
('total_price', 'Balance'),
('Movement_getSectionPriceCurrency', 'Accounting Currency'),
('debit', 'Transaction Currency Debit'),
('credit', 'Transaction Currency Credit'),
('total_quantity', 'Transaction Currency Balance'),
('resource_reference', 'Transaction Currency'),
('Movement_getPaymentTitle', 'Section Bank Account',),
('payment_mode_translated_title', 'Payment Mode',),
('grouping_reference', 'Grouping Reference'),
('grouping_date', 'Grouping Date'),
('getTranslatedSimulationStateTitle', 'State'),
......
......@@ -258,7 +258,7 @@ for inventory in portal.portal_simulation.getInventoryList(
if not inventory.total_price:
continue
existing_section_dict[key] = True
selection_params = default_selection_params.copy()
selection_params['from_date'] = from_date
selection_params['at_date'] = at_date
......
......@@ -77,7 +77,7 @@ for analytic in group_analytic:
uid_key = 'strict_%s' % analytic_column[0].replace('_translated_title', '_uid')
group_analytic_uid += (uid_key, )
extra_columns += ((uid_key, analytic_column[1]),)
if show_detailed_balance_columns:
selection_columns = (
......
......@@ -14,7 +14,7 @@ if number_method == 'account_reference' and not gap_root:
## elif number_method == 'gap_id':
# GAP id is the default rendering
current_gap = gap_root or preference_tool.getPreferredAccountingTransactionGap() or ''
for gap in context.getGapValueList():
if current_gap in gap.getPath():
for gap in context.getGapValueList():
if current_gap in gap.getPath():
return gap.getReference() or gap.getId()
return ''
......@@ -56,7 +56,7 @@ for item_value in value_list:
# Hash key from item_value
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
if item_key not in sub_field_dict:
# This can only happens if an accounting plan have been uninstalled
sub_field_property_dict = default_sub_field_property_dict.copy()
......
......@@ -108,12 +108,12 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
for section in section_list:
section_uid = section.getUid()
balance_transaction = None
group_by_node_node_category_list = []
group_by_mirror_section_node_category_list = []
group_by_payment_node_category_list = []
profit_and_loss_node_category_list = []
node_category_list = portal.portal_categories\
.account_type.getCategoryChildValueList()
for node_category in node_category_list:
......@@ -130,14 +130,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
profit_and_loss_node_category_list.append(node_category_url)
else:
group_by_node_node_category_list.append(node_category_url)
inventory_param_dict = dict(section_uid=section_uid,
simulation_state=('delivered',),
precision=section_currency_precision,
portal_type=portal.getPortalAccountingMovementTypeList(),
at_date=at_date.latestTime(),
ledger_uid=ledger_uid)
# Calculate the sum of profit and loss accounts balances for that period.
# This must match the difference between assets, liability and equity accounts.
profit_and_loss_accounts_balance = portal.portal_simulation.getInventoryAssetPrice(
......@@ -148,29 +148,29 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
node=profit_and_loss_account,
resource=section_currency,
**inventory_param_dict)
section_currency_uid = context.getParentValue().getPriceCurrencyUid()
profit_and_loss_quantity = 0
line_count = 0
for inventory in getInventoryList(
node_category_strict_membership=group_by_node_node_category_list,
group_by_node=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
line_count += 1
if inventory.resource_uid != section_currency_uid:
profit_and_loss_quantity += total_price
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
......@@ -186,7 +186,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
# consistency
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if inventory.node_relative_url != profit_and_loss_account:
profit_and_loss_quantity += total_price
if balance_transaction is None:
......@@ -196,24 +196,24 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
quantity=total_price)
for inventory in getInventoryList(
node_category_strict_membership=group_by_mirror_section_node_category_list,
group_by_node=1,
group_by_mirror_section=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
profit_and_loss_quantity += total_price
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
......@@ -237,25 +237,25 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid,
quantity=total_price)
for inventory in getInventoryList(
node_category_strict_membership=group_by_payment_node_category_list,
group_by_node=1,
group_by_payment=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
profit_and_loss_quantity += total_price
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
......@@ -279,14 +279,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
destination=inventory.node_relative_url,
destination_payment_uid=inventory.payment_uid,
quantity=total_price)
if balance_transaction is None:
# we did not have any transaction for this section
# One possible corner case is that we have only transactions that brings
# the balance of all balance sheets accounts to 0. In this case we want to
# create a balance transaction that notes that the current balance of profit
# and loss account is 0, so that the delta gets indexed.
# and loss account is 0, so that the delta gets indexed.
if profit_and_loss_accounts_balance:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
......@@ -296,7 +296,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
balance_transaction.stop()
balance_transaction.deliver()
continue
assert roundCurrency(profit_and_loss_accounts_balance, section_currency) == roundCurrency(
- roundCurrency(selected_profit_and_loss_account_balance, section_currency)
- roundCurrency(profit_and_loss_quantity, section_currency), section_currency)
......@@ -310,7 +310,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
portal_type='Balance Transaction Line',
destination=profit_and_loss_account,
quantity=-profit_and_loss_quantity)
# and go to delivered state directly (the user is not supposed to edit this document)
balance_transaction.stop()
balance_transaction.deliver()
......
......@@ -30,6 +30,6 @@ while date < context.getStopDate():
period.start()
date = end_date
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=translateString('Accounting periods created.')))
......@@ -30,14 +30,14 @@ def check(node_uid, section_uid, mirror_section_uid):
detail='%s has wrong grouping (%s)' % (context.getRelativeUrl(), total),
result='',
severity=100))
# XXX we could check this as well
"""
max_date = max([l.date for l in line_list])
for line in line_list:
assert line.getGroupingDate() in (max_date, None)
"""
node_uid = context.getSourceUid(portal_type='Account')
section_uid = None
section = context.getSourceSectionValue(portal_type='Organisation')
......@@ -46,7 +46,7 @@ if section is not None:
section_uid = section.getUid()
precision_by_section_uid[section_uid] = context.getQuantityPrecisionFromResource(
section.getPriceCurrency())
mirror_section_uid = context.getDestinationSectionUid()
if node_uid and section_uid:
......
......@@ -9,6 +9,6 @@ if function_base_category:
'getCategoryChildCompactLogicalPathItemList'))(
local_sort_id=('int_index', 'translated_title'),
checked_permission='View',
base=True)
base=True)
return ()
......@@ -9,6 +9,6 @@ if funding_base_category:
'getCategoryChildCompactLogicalPathItemList'))(
local_sort_id=('int_index', 'translated_title'),
checked_permission='View',
base=True)
base=True)
return ()
......@@ -66,7 +66,7 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,
if simulation_state not in ('delivered', 'stopped',
'cancelled', 'no_simulation_state'):
filter_dict['validation_state'] = ('draft', 'validated')
item_list = cat.getCategoryMemberItemList(
portal_type='Account',
base=0,
......@@ -94,8 +94,8 @@ item_list = getItemList( category=category,
user_name=getSecurityManager().getUser().getIdOrUserName(),
simulation_state=simulation_state)
# make sure that the current value is included in this list, this is
# mostly for compatibility with old versions. XXX This is slow.
# make sure that the current value is included in this list, this is
# mostly for compatibility with old versions. XXX This is slow.
if omit_filter:
return item_list
......
......@@ -22,7 +22,7 @@ if context.getPortalType() == 'Accounting Transaction Module':
if not project_list:
return [] # returning an empty list, not to add project column on reports
return [('', ''), (str(translateString('No Project')), 'None')] + project_list
# case 2: script is used on custom listfields.
# for now the script has to be customized in such case.
# [(x.getTitle(), x.getRelativeUrl()) for x in context.project_module.searchFolder()]
......
......@@ -10,7 +10,7 @@ if section_category:
currency = portal.Base_getCurrencyForSectionCategory(section_category, section_category_strict)
precision = portal.account_module.getQuantityPrecisionFromResource(currency)
portal.REQUEST.set('precision', precision)
# rewrite payment_mode_relative_url to uid
payment_mode_relative_url = params.pop('payment_mode_relative_url', None)
if payment_mode_relative_url:
......@@ -51,7 +51,7 @@ if not params.get('operation_date'):
params['operation_date'] = dict(
query=(to_date, ),
range='ngt')
amount = params.pop('amount', '')
if amount not in (None, ''):
params['accounting_transaction_line_total_price'] = amount
......
......@@ -64,21 +64,21 @@ for brain in portal.portal_simulation.getMovementHistoryList(
debit = max(brain.total_price, 0) or 0
credit = max(-(brain.total_price or 0), 0) or 0
mvt = brain.getObject()
if payment_mode and not \
mvt.getPaymentMode('').startswith(payment_mode):
continue
total_debit += debit
total_credit += credit
transaction = mvt.getParentValue()
is_source = 0
if transaction.getSourceSection():
is_source = brain.section_relative_url.startswith(
transaction.getSourceSection())
if is_source:
mirror_section_title = mvt.getDestinationSectionTitle()
else:
......
......@@ -2,7 +2,7 @@ portal_type_list = context.getPortalAccountingTransactionTypeList()
Base_translateString = context.Base_translateString
item_list = []
for portal_type in portal_type_list :
for portal_type in portal_type_list :
item_list.append((Base_translateString(portal_type), portal_type))
return item_list
......@@ -8,7 +8,7 @@ organisation = portal.restrictedTraverse(
if organisation is not None :
selection_uid_list = [ bank_account.getUid() for bank_account \
in organisation.searchFolder(portal_type=portal.getPortalPaymentNodeTypeList()) ]
if len(selection_uid_list) != 0 :
if len(selection_uid_list) != 0 :
kw = {'uid': selection_uid_list}
portal.portal_selections.setSelectionParamsFor('Base_jumpToRelatedObjectList', kw)
request.set('object_uid', context.getUid())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment