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

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 !1672
parents 28048ede 97f4cb91
...@@ -7,13 +7,13 @@ To use, write your own method (probably External Method, since it is most likely ...@@ -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 to use re) that would analyze text content of the doc
and return a dictionary of properties. 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() information = context.getContentInformation()
result = {} result = {}
property_id_list = context.propertyIds() property_id_list = context.propertyIds()
for k, v in information.items(): for k, v in information.items():
key = k.lower() key = k.lower()
if v: if v:
if isinstance(v, unicode): v = v.encode('utf-8') if isinstance(v, unicode): v = v.encode('utf-8')
......
...@@ -4,7 +4,7 @@ def hasError(email): ...@@ -4,7 +4,7 @@ def hasError(email):
email_parts = email.split('@') email_parts = email.split('@')
if len(email_parts) != 2: if len(email_parts) != 2:
return True return True
suffix_parts = email_parts[1].split('.') suffix_parts = email_parts[1].split('.')
if len(suffix_parts) < 2: if len(suffix_parts) < 2:
return True return True
......
...@@ -51,7 +51,7 @@ document.releaseAlive() ...@@ -51,7 +51,7 @@ document.releaseAlive()
#Get param and key to connect the user #Get param and key to connect the user
param, key = person.Person_getEncryptedLogin() 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 portal_sessions = context.portal_sessions
session = portal_sessions[reference] session = portal_sessions[reference]
session['document_url'] = document.getRelativeUrl() session['document_url'] = document.getRelativeUrl()
......
""" """
This scripts add the balance of every gap account in the list 'account_id_list' 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 at_date
those are optional : those are optional :
gap_base gap_base
simulation_state simulation_state
resource resource
section_category 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 from_date
parameters keywords to this script overrides REQUEST keys parameters keywords to this script overrides REQUEST keys
""" """
......
...@@ -15,15 +15,15 @@ return ( ...@@ -15,15 +15,15 @@ return (
('credit_price', 'Credit'), ('credit_price', 'Credit'),
('total_price', 'Balance'), ('total_price', 'Balance'),
('Movement_getSectionPriceCurrency', 'Accounting Currency'), ('Movement_getSectionPriceCurrency', 'Accounting Currency'),
('debit', 'Transaction Currency Debit'), ('debit', 'Transaction Currency Debit'),
('credit', 'Transaction Currency Credit'), ('credit', 'Transaction Currency Credit'),
('total_quantity', 'Transaction Currency Balance'), ('total_quantity', 'Transaction Currency Balance'),
('resource_reference', 'Transaction Currency'), ('resource_reference', 'Transaction Currency'),
('Movement_getPaymentTitle', 'Section Bank Account',), ('Movement_getPaymentTitle', 'Section Bank Account',),
('payment_mode_translated_title', 'Payment Mode',), ('payment_mode_translated_title', 'Payment Mode',),
('grouping_reference', 'Grouping Reference'), ('grouping_reference', 'Grouping Reference'),
('grouping_date', 'Grouping Date'), ('grouping_date', 'Grouping Date'),
('getTranslatedSimulationStateTitle', 'State'), ('getTranslatedSimulationStateTitle', 'State'),
......
...@@ -258,7 +258,7 @@ for inventory in portal.portal_simulation.getInventoryList( ...@@ -258,7 +258,7 @@ for inventory in portal.portal_simulation.getInventoryList(
if not inventory.total_price: if not inventory.total_price:
continue continue
existing_section_dict[key] = True existing_section_dict[key] = True
selection_params = default_selection_params.copy() selection_params = default_selection_params.copy()
selection_params['from_date'] = from_date selection_params['from_date'] = from_date
selection_params['at_date'] = at_date selection_params['at_date'] = at_date
......
...@@ -77,7 +77,7 @@ for analytic in group_analytic: ...@@ -77,7 +77,7 @@ for analytic in group_analytic:
uid_key = 'strict_%s' % analytic_column[0].replace('_translated_title', '_uid') uid_key = 'strict_%s' % analytic_column[0].replace('_translated_title', '_uid')
group_analytic_uid += (uid_key, ) group_analytic_uid += (uid_key, )
extra_columns += ((uid_key, analytic_column[1]),) extra_columns += ((uid_key, analytic_column[1]),)
if show_detailed_balance_columns: if show_detailed_balance_columns:
selection_columns = ( selection_columns = (
......
...@@ -14,7 +14,7 @@ if number_method == 'account_reference' and not gap_root: ...@@ -14,7 +14,7 @@ if number_method == 'account_reference' and not gap_root:
## elif number_method == 'gap_id': ## elif number_method == 'gap_id':
# GAP id is the default rendering # GAP id is the default rendering
current_gap = gap_root or preference_tool.getPreferredAccountingTransactionGap() or '' current_gap = gap_root or preference_tool.getPreferredAccountingTransactionGap() or ''
for gap in context.getGapValueList(): for gap in context.getGapValueList():
if current_gap in gap.getPath(): if current_gap in gap.getPath():
return gap.getReference() or gap.getId() return gap.getReference() or gap.getId()
return '' return ''
...@@ -56,7 +56,7 @@ for item_value in value_list: ...@@ -56,7 +56,7 @@ for item_value in value_list:
# Hash key from item_value # Hash key from item_value
item_split = item_value.split('/') item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth]) item_key = '/'.join(item_split[:split_depth])
if item_key not in sub_field_dict: if item_key not in sub_field_dict:
# This can only happens if an accounting plan have been uninstalled # This can only happens if an accounting plan have been uninstalled
sub_field_property_dict = default_sub_field_property_dict.copy() sub_field_property_dict = default_sub_field_property_dict.copy()
......
...@@ -108,12 +108,12 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -108,12 +108,12 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
for section in section_list: for section in section_list:
section_uid = section.getUid() section_uid = section.getUid()
balance_transaction = None balance_transaction = None
group_by_node_node_category_list = [] group_by_node_node_category_list = []
group_by_mirror_section_node_category_list = [] group_by_mirror_section_node_category_list = []
group_by_payment_node_category_list = [] group_by_payment_node_category_list = []
profit_and_loss_node_category_list = [] profit_and_loss_node_category_list = []
node_category_list = portal.portal_categories\ node_category_list = portal.portal_categories\
.account_type.getCategoryChildValueList() .account_type.getCategoryChildValueList()
for node_category in node_category_list: for node_category in node_category_list:
...@@ -130,14 +130,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -130,14 +130,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
profit_and_loss_node_category_list.append(node_category_url) profit_and_loss_node_category_list.append(node_category_url)
else: else:
group_by_node_node_category_list.append(node_category_url) group_by_node_node_category_list.append(node_category_url)
inventory_param_dict = dict(section_uid=section_uid, inventory_param_dict = dict(section_uid=section_uid,
simulation_state=('delivered',), simulation_state=('delivered',),
precision=section_currency_precision, precision=section_currency_precision,
portal_type=portal.getPortalAccountingMovementTypeList(), portal_type=portal.getPortalAccountingMovementTypeList(),
at_date=at_date.latestTime(), at_date=at_date.latestTime(),
ledger_uid=ledger_uid) ledger_uid=ledger_uid)
# Calculate the sum of profit and loss accounts balances for that period. # Calculate the sum of profit and loss accounts balances for that period.
# This must match the difference between assets, liability and equity accounts. # This must match the difference between assets, liability and equity accounts.
profit_and_loss_accounts_balance = portal.portal_simulation.getInventoryAssetPrice( profit_and_loss_accounts_balance = portal.portal_simulation.getInventoryAssetPrice(
...@@ -148,29 +148,29 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -148,29 +148,29 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
node=profit_and_loss_account, node=profit_and_loss_account,
resource=section_currency, resource=section_currency,
**inventory_param_dict) **inventory_param_dict)
section_currency_uid = context.getParentValue().getPriceCurrencyUid() section_currency_uid = context.getParentValue().getPriceCurrencyUid()
profit_and_loss_quantity = 0 profit_and_loss_quantity = 0
line_count = 0 line_count = 0
for inventory in getInventoryList( for inventory in getInventoryList(
node_category_strict_membership=group_by_node_node_category_list, node_category_strict_membership=group_by_node_node_category_list,
group_by_node=1, group_by_node=1,
group_by_resource=1, group_by_resource=1,
**inventory_param_dict): **inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency) total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0, quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url) inventory.resource_relative_url)
if not total_price and not quantity: if not total_price and not quantity:
continue continue
line_count += 1 line_count += 1
if inventory.resource_uid != section_currency_uid: if inventory.resource_uid != section_currency_uid:
profit_and_loss_quantity += total_price profit_and_loss_quantity += total_price
if balance_transaction is None: if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url) balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent( balance_transaction.newContent(
...@@ -186,7 +186,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -186,7 +186,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
# consistency # consistency
raise ValueError('Different price: %s != %s ' % ( raise ValueError('Different price: %s != %s ' % (
total_price, quantity)) total_price, quantity))
if inventory.node_relative_url != profit_and_loss_account: if inventory.node_relative_url != profit_and_loss_account:
profit_and_loss_quantity += total_price profit_and_loss_quantity += total_price
if balance_transaction is None: if balance_transaction is None:
...@@ -196,24 +196,24 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -196,24 +196,24 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
destination=inventory.node_relative_url, destination=inventory.node_relative_url,
quantity=total_price) quantity=total_price)
for inventory in getInventoryList( for inventory in getInventoryList(
node_category_strict_membership=group_by_mirror_section_node_category_list, node_category_strict_membership=group_by_mirror_section_node_category_list,
group_by_node=1, group_by_node=1,
group_by_mirror_section=1, group_by_mirror_section=1,
group_by_resource=1, group_by_resource=1,
**inventory_param_dict): **inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency) total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0, quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url) inventory.resource_relative_url)
if not total_price and not quantity: if not total_price and not quantity:
continue continue
profit_and_loss_quantity += total_price profit_and_loss_quantity += total_price
line_count += 1 line_count += 1
if inventory.resource_uid != section_currency_uid: if inventory.resource_uid != section_currency_uid:
if balance_transaction is None: if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url) balance_transaction = createBalanceTransaction(section, ledger_url)
...@@ -237,25 +237,25 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -237,25 +237,25 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
destination=inventory.node_relative_url, destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid, source_section_uid=inventory.mirror_section_uid,
quantity=total_price) quantity=total_price)
for inventory in getInventoryList( for inventory in getInventoryList(
node_category_strict_membership=group_by_payment_node_category_list, node_category_strict_membership=group_by_payment_node_category_list,
group_by_node=1, group_by_node=1,
group_by_payment=1, group_by_payment=1,
group_by_resource=1, group_by_resource=1,
**inventory_param_dict): **inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency) total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0, quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url) inventory.resource_relative_url)
if not total_price and not quantity: if not total_price and not quantity:
continue continue
profit_and_loss_quantity += total_price profit_and_loss_quantity += total_price
line_count += 1 line_count += 1
if inventory.resource_uid != section_currency_uid: if inventory.resource_uid != section_currency_uid:
if balance_transaction is None: if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url) balance_transaction = createBalanceTransaction(section, ledger_url)
...@@ -279,14 +279,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -279,14 +279,14 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
destination=inventory.node_relative_url, destination=inventory.node_relative_url,
destination_payment_uid=inventory.payment_uid, destination_payment_uid=inventory.payment_uid,
quantity=total_price) quantity=total_price)
if balance_transaction is None: if balance_transaction is None:
# we did not have any transaction for this section # we did not have any transaction for this section
# One possible corner case is that we have only transactions that brings # 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 # 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 # 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: if profit_and_loss_accounts_balance:
balance_transaction = createBalanceTransaction(section, ledger_url) balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent( balance_transaction.newContent(
...@@ -296,7 +296,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -296,7 +296,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
balance_transaction.stop() balance_transaction.stop()
balance_transaction.deliver() balance_transaction.deliver()
continue continue
assert roundCurrency(profit_and_loss_accounts_balance, section_currency) == roundCurrency( assert roundCurrency(profit_and_loss_accounts_balance, section_currency) == roundCurrency(
- roundCurrency(selected_profit_and_loss_account_balance, section_currency) - roundCurrency(selected_profit_and_loss_account_balance, section_currency)
- roundCurrency(profit_and_loss_quantity, section_currency), section_currency) - roundCurrency(profit_and_loss_quantity, section_currency), section_currency)
...@@ -310,7 +310,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True) ...@@ -310,7 +310,7 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
destination=profit_and_loss_account, destination=profit_and_loss_account,
quantity=-profit_and_loss_quantity) quantity=-profit_and_loss_quantity)
# and go to delivered state directly (the user is not supposed to edit this document) # and go to delivered state directly (the user is not supposed to edit this document)
balance_transaction.stop() balance_transaction.stop()
balance_transaction.deliver() balance_transaction.deliver()
......
...@@ -30,6 +30,6 @@ while date < context.getStopDate(): ...@@ -30,6 +30,6 @@ while date < context.getStopDate():
period.start() period.start()
date = end_date date = end_date
return context.Base_redirect(form_id, return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=translateString('Accounting periods created.'))) keep_items=dict(portal_status_message=translateString('Accounting periods created.')))
...@@ -30,14 +30,14 @@ def check(node_uid, section_uid, mirror_section_uid): ...@@ -30,14 +30,14 @@ def check(node_uid, section_uid, mirror_section_uid):
detail='%s has wrong grouping (%s)' % (context.getRelativeUrl(), total), detail='%s has wrong grouping (%s)' % (context.getRelativeUrl(), total),
result='', result='',
severity=100)) severity=100))
# XXX we could check this as well # XXX we could check this as well
""" """
max_date = max([l.date for l in line_list]) max_date = max([l.date for l in line_list])
for line in line_list: for line in line_list:
assert line.getGroupingDate() in (max_date, None) assert line.getGroupingDate() in (max_date, None)
""" """
node_uid = context.getSourceUid(portal_type='Account') node_uid = context.getSourceUid(portal_type='Account')
section_uid = None section_uid = None
section = context.getSourceSectionValue(portal_type='Organisation') section = context.getSourceSectionValue(portal_type='Organisation')
...@@ -46,7 +46,7 @@ if section is not None: ...@@ -46,7 +46,7 @@ if section is not None:
section_uid = section.getUid() section_uid = section.getUid()
precision_by_section_uid[section_uid] = context.getQuantityPrecisionFromResource( precision_by_section_uid[section_uid] = context.getQuantityPrecisionFromResource(
section.getPriceCurrency()) section.getPriceCurrency())
mirror_section_uid = context.getDestinationSectionUid() mirror_section_uid = context.getDestinationSectionUid()
if node_uid and section_uid: if node_uid and section_uid:
......
...@@ -9,6 +9,6 @@ if function_base_category: ...@@ -9,6 +9,6 @@ if function_base_category:
'getCategoryChildCompactLogicalPathItemList'))( 'getCategoryChildCompactLogicalPathItemList'))(
local_sort_id=('int_index', 'translated_title'), local_sort_id=('int_index', 'translated_title'),
checked_permission='View', checked_permission='View',
base=True) base=True)
return () return ()
...@@ -9,6 +9,6 @@ if funding_base_category: ...@@ -9,6 +9,6 @@ if funding_base_category:
'getCategoryChildCompactLogicalPathItemList'))( 'getCategoryChildCompactLogicalPathItemList'))(
local_sort_id=('int_index', 'translated_title'), local_sort_id=('int_index', 'translated_title'),
checked_permission='View', checked_permission='View',
base=True) base=True)
return () return ()
...@@ -66,7 +66,7 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0, ...@@ -66,7 +66,7 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,
if simulation_state not in ('delivered', 'stopped', if simulation_state not in ('delivered', 'stopped',
'cancelled', 'no_simulation_state'): 'cancelled', 'no_simulation_state'):
filter_dict['validation_state'] = ('draft', 'validated') filter_dict['validation_state'] = ('draft', 'validated')
item_list = cat.getCategoryMemberItemList( item_list = cat.getCategoryMemberItemList(
portal_type='Account', portal_type='Account',
base=0, base=0,
...@@ -94,8 +94,8 @@ item_list = getItemList( category=category, ...@@ -94,8 +94,8 @@ item_list = getItemList( category=category,
user_name=getSecurityManager().getUser().getIdOrUserName(), user_name=getSecurityManager().getUser().getIdOrUserName(),
simulation_state=simulation_state) simulation_state=simulation_state)
# make sure that the current value is included in this list, this is # make sure that the current value is included in this list, this is
# mostly for compatibility with old versions. XXX This is slow. # mostly for compatibility with old versions. XXX This is slow.
if omit_filter: if omit_filter:
return item_list return item_list
......
...@@ -22,7 +22,7 @@ if context.getPortalType() == 'Accounting Transaction Module': ...@@ -22,7 +22,7 @@ if context.getPortalType() == 'Accounting Transaction Module':
if not project_list: if not project_list:
return [] # returning an empty list, not to add project column on reports return [] # returning an empty list, not to add project column on reports
return [('', ''), (str(translateString('No Project')), 'None')] + project_list return [('', ''), (str(translateString('No Project')), 'None')] + project_list
# case 2: script is used on custom listfields. # case 2: script is used on custom listfields.
# for now the script has to be customized in such case. # for now the script has to be customized in such case.
# [(x.getTitle(), x.getRelativeUrl()) for x in context.project_module.searchFolder()] # [(x.getTitle(), x.getRelativeUrl()) for x in context.project_module.searchFolder()]
......
...@@ -10,7 +10,7 @@ if section_category: ...@@ -10,7 +10,7 @@ if section_category:
currency = portal.Base_getCurrencyForSectionCategory(section_category, section_category_strict) currency = portal.Base_getCurrencyForSectionCategory(section_category, section_category_strict)
precision = portal.account_module.getQuantityPrecisionFromResource(currency) precision = portal.account_module.getQuantityPrecisionFromResource(currency)
portal.REQUEST.set('precision', precision) portal.REQUEST.set('precision', precision)
# rewrite payment_mode_relative_url to uid # rewrite payment_mode_relative_url to uid
payment_mode_relative_url = params.pop('payment_mode_relative_url', None) payment_mode_relative_url = params.pop('payment_mode_relative_url', None)
if payment_mode_relative_url: if payment_mode_relative_url:
...@@ -51,7 +51,7 @@ if not params.get('operation_date'): ...@@ -51,7 +51,7 @@ if not params.get('operation_date'):
params['operation_date'] = dict( params['operation_date'] = dict(
query=(to_date, ), query=(to_date, ),
range='ngt') range='ngt')
amount = params.pop('amount', '') amount = params.pop('amount', '')
if amount not in (None, ''): if amount not in (None, ''):
params['accounting_transaction_line_total_price'] = amount params['accounting_transaction_line_total_price'] = amount
......
...@@ -64,21 +64,21 @@ for brain in portal.portal_simulation.getMovementHistoryList( ...@@ -64,21 +64,21 @@ for brain in portal.portal_simulation.getMovementHistoryList(
debit = max(brain.total_price, 0) or 0 debit = max(brain.total_price, 0) or 0
credit = max(-(brain.total_price or 0), 0) or 0 credit = max(-(brain.total_price or 0), 0) or 0
mvt = brain.getObject() mvt = brain.getObject()
if payment_mode and not \ if payment_mode and not \
mvt.getPaymentMode('').startswith(payment_mode): mvt.getPaymentMode('').startswith(payment_mode):
continue continue
total_debit += debit total_debit += debit
total_credit += credit total_credit += credit
transaction = mvt.getParentValue() transaction = mvt.getParentValue()
is_source = 0 is_source = 0
if transaction.getSourceSection(): if transaction.getSourceSection():
is_source = brain.section_relative_url.startswith( is_source = brain.section_relative_url.startswith(
transaction.getSourceSection()) transaction.getSourceSection())
if is_source: if is_source:
mirror_section_title = mvt.getDestinationSectionTitle() mirror_section_title = mvt.getDestinationSectionTitle()
else: else:
......
...@@ -2,7 +2,7 @@ portal_type_list = context.getPortalAccountingTransactionTypeList() ...@@ -2,7 +2,7 @@ portal_type_list = context.getPortalAccountingTransactionTypeList()
Base_translateString = context.Base_translateString Base_translateString = context.Base_translateString
item_list = [] 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)) item_list.append((Base_translateString(portal_type), portal_type))
return item_list return item_list
...@@ -8,7 +8,7 @@ organisation = portal.restrictedTraverse( ...@@ -8,7 +8,7 @@ organisation = portal.restrictedTraverse(
if organisation is not None : if organisation is not None :
selection_uid_list = [ bank_account.getUid() for bank_account \ selection_uid_list = [ bank_account.getUid() for bank_account \
in organisation.searchFolder(portal_type=portal.getPortalPaymentNodeTypeList()) ] in organisation.searchFolder(portal_type=portal.getPortalPaymentNodeTypeList()) ]
if len(selection_uid_list) != 0 : if len(selection_uid_list) != 0 :
kw = {'uid': selection_uid_list} kw = {'uid': selection_uid_list}
portal.portal_selections.setSelectionParamsFor('Base_jumpToRelatedObjectList', kw) portal.portal_selections.setSelectionParamsFor('Base_jumpToRelatedObjectList', kw)
request.set('object_uid', context.getUid()) request.set('object_uid', context.getUid())
......
...@@ -7,7 +7,7 @@ Base_translateString = portal.Base_translateString ...@@ -7,7 +7,7 @@ Base_translateString = portal.Base_translateString
psm = Base_translateString('Nothing matches.') psm = Base_translateString('Nothing matches.')
request = container.REQUEST request = container.REQUEST
# update selected uids # update selected uids
portal.portal_selections.updateSelectionCheckedUidList( portal.portal_selections.updateSelectionCheckedUidList(
list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request) list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)
uids = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name) uids = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name)
...@@ -30,7 +30,7 @@ portal.portal_selections.setSelectionParamsFor( ...@@ -30,7 +30,7 @@ portal.portal_selections.setSelectionParamsFor(
grouping=grouping, grouping=grouping,
mirror_section=mirror_section)) mirror_section=mirror_section))
# calculate total selected amount # calculate total selected amount
total_selected_amount = 0 total_selected_amount = 0
if uids: if uids:
for line in portal.portal_catalog(uid=uids): for line in portal.portal_catalog(uid=uids):
......
""" """
Script to convert the prices used in the transaction to the Script to convert the prices used in the transaction to the
currency of the source section currency of the source section
""" """
portal = context.getPortalObject() portal = context.getPortalObject()
......
...@@ -53,14 +53,14 @@ if context.AccountingTransactionLine_getFunctionItemList(source=source): ...@@ -53,14 +53,14 @@ if context.AccountingTransactionLine_getFunctionItemList(source=source):
a(('source_function', context.AccountingTransactionLine_getFunctionBaseCategoryTitle())) a(('source_function', context.AccountingTransactionLine_getFunctionBaseCategoryTitle()))
else: else:
a(('destination_function', context.AccountingTransactionLine_getFunctionBaseCategoryTitle())) a(('destination_function', context.AccountingTransactionLine_getFunctionBaseCategoryTitle()))
if context.AccountingTransactionLine_getFundingItemList(source=source): if context.AccountingTransactionLine_getFundingItemList(source=source):
if source: if source:
a(('source_funding', context.AccountingTransactionLine_getFundingBaseCategoryTitle())) a(('source_funding', context.AccountingTransactionLine_getFundingBaseCategoryTitle()))
else: else:
a(('destination_funding', context.AccountingTransactionLine_getFundingBaseCategoryTitle())) a(('destination_funding', context.AccountingTransactionLine_getFundingBaseCategoryTitle()))
if multiple_sections: if multiple_sections:
if source: if source:
a(('getDestinationSectionTitle', 'Third Party')) a(('getDestinationSectionTitle', 'Third Party'))
......
if kw.get('created_by_builder', 0): if kw.get('created_by_builder', 0):
return return
preference_tool = context.getPortalObject().portal_preferences preference_tool = context.getPortalObject().portal_preferences
......
...@@ -24,7 +24,7 @@ if (has_source and has_destination) or\ ...@@ -24,7 +24,7 @@ if (has_source and has_destination) or\
else: else:
account = source_account account = source_account
base_category = 'destination' base_category = 'destination'
mirror_account = account.getDefaultDestination() mirror_account = account.getDefaultDestination()
if mirror_account: if mirror_account:
movement.setProperty(base_category, mirror_account) movement.setProperty(base_category, mirror_account)
...@@ -31,7 +31,7 @@ search_params = dict( ...@@ -31,7 +31,7 @@ search_params = dict(
group_by_node=True, group_by_node=True,
grouping_reference=None, grouping_reference=None,
) )
for brain in portal.portal_simulation.getInventoryList(**search_params): for brain in portal.portal_simulation.getInventoryList(**search_params):
if round(brain.total_price, precision) == 0: if round(brain.total_price, precision) == 0:
...@@ -54,10 +54,10 @@ for brain in portal.portal_simulation.getInventoryList(**search_params): ...@@ -54,10 +54,10 @@ for brain in portal.portal_simulation.getInventoryList(**search_params):
print 'FIXED', grouped_line_list print 'FIXED', grouped_line_list
else: else:
print 'NOT FIXED' print 'NOT FIXED'
active_result = ActiveResult( active_result = ActiveResult(
summary=context.getTitle(), summary=context.getTitle(),
severity=str(printed) and 100 or 0, severity=str(printed) and 100 or 0,
detail=printed,) detail=printed,)
active_process.postResult(active_result) active_process.postResult(active_result)
...@@ -27,7 +27,7 @@ def splitCsvLine(str_line): ...@@ -27,7 +27,7 @@ def splitCsvLine(str_line):
clean_item = clean_item[:-1] clean_item = clean_item[:-1]
clean_item = clean_item.replace('""', '"') clean_item = clean_item.replace('""', '"')
else: else:
if len(clean_item) > 0: if len(clean_item) > 0:
if clean_item.find('.') != -1: if clean_item.find('.') != -1:
clean_item = float(clean_item) clean_item = float(clean_item)
else: else:
......
...@@ -48,7 +48,7 @@ if section_category: ...@@ -48,7 +48,7 @@ if section_category:
params['section_uid'] = context.Base_getSectionUidListForSectionCategory(section_category, params['section_uid'] = context.Base_getSectionUidListForSectionCategory(section_category,
preference.isPreferredAccountingSectionCategoryStrict()) preference.isPreferredAccountingSectionCategoryStrict())
currency = context.Base_getCurrencyForSection(section_category) currency = context.Base_getCurrencyForSection(section_category)
# getQuantityPrecisionFromResource is defined on Base, but the portal is not # getQuantityPrecisionFromResource is defined on Base, but the portal is not
# an instance of Base, so we call it on portal_simulation because it is # an instance of Base, so we call it on portal_simulation because it is
# accessible to everyone. # accessible to everyone.
params['precision'] = context.portal_simulation\ params['precision'] = context.portal_simulation\
...@@ -64,7 +64,7 @@ if section_category: ...@@ -64,7 +64,7 @@ if section_category:
section_category=section_category, date=from_date or at_date) section_category=section_category, date=from_date or at_date)
if period_start_date: if period_start_date:
params['period_start_date'] = period_start_date params['period_start_date'] = period_start_date
# if we have a section uid, it haves priority # if we have a section uid, it haves priority
section_uid = selection_params.get('section_uid', None) section_uid = selection_params.get('section_uid', None)
if section_uid: if section_uid:
...@@ -77,7 +77,7 @@ if precision is not None: ...@@ -77,7 +77,7 @@ if precision is not None:
params['precision'] = precision params['precision'] = precision
# Some reports, such as general ledger, uses different forms with different report # Some reports, such as general ledger, uses different forms with different report
# parameters, we don't want to accidentally fill the cache with mirror_section_uid # parameters, we don't want to accidentally fill the cache with mirror_section_uid
# or payment_uid. # or payment_uid.
if not selection_params.get('no_mirror_section_uid_cache', 0): if not selection_params.get('no_mirror_section_uid_cache', 0):
mirror_section_uid = selection_params.get('mirror_section_uid', None) mirror_section_uid = selection_params.get('mirror_section_uid', None)
...@@ -88,7 +88,7 @@ if not selection_params.get('no_mirror_section_uid_cache', 0): ...@@ -88,7 +88,7 @@ if not selection_params.get('no_mirror_section_uid_cache', 0):
if payment_uid: if payment_uid:
params['payment_uid'] = payment_uid params['payment_uid'] = payment_uid
# Detailed Beginning Balance, from Account Statement # Detailed Beginning Balance, from Account Statement
detailed_from_date_summary = selection_params.get('detailed_from_date_summary', None) detailed_from_date_summary = selection_params.get('detailed_from_date_summary', None)
if detailed_from_date_summary is not None: if detailed_from_date_summary is not None:
params['detailed_from_date_summary'] = detailed_from_date_summary params['detailed_from_date_summary'] = detailed_from_date_summary
......
if kw.get('created_by_builder', 0): if kw.get('created_by_builder', 0):
return return
preference_tool = context.getPortalObject().portal_preferences preference_tool = context.getPortalObject().portal_preferences
......
...@@ -14,7 +14,7 @@ The `account_id` parameter can be use to filter receivable / payable lines to a ...@@ -14,7 +14,7 @@ The `account_id` parameter can be use to filter receivable / payable lines to a
specific account. specific account.
The `simulation_state` parameter is a list that can be used to take into account The `simulation_state` parameter is a list that can be used to take into account
only transactions in those states. By default it will use all but 'draft', only transactions in those states. By default it will use all but 'draft',
, 'rejected', 'cancelled' and 'deleted'. , 'rejected', 'cancelled' and 'deleted'.
The `mirror_section_relative_url` parameter must be passed explicitly if the The `mirror_section_relative_url` parameter must be passed explicitly if the
......
...@@ -12,5 +12,5 @@ def getAccountingCurrencyReference(section_relative_url): ...@@ -12,5 +12,5 @@ def getAccountingCurrencyReference(section_relative_url):
reference = section.getProperty('price_currency_reference') reference = section.getProperty('price_currency_reference')
accounting_currency_reference_cache[section_relative_url] = reference accounting_currency_reference_cache[section_relative_url] = reference
return reference return reference
return getAccountingCurrencyReference(brain.section_relative_url) return getAccountingCurrencyReference(brain.section_relative_url)
...@@ -37,7 +37,7 @@ for category_uid in category_uid_list: ...@@ -37,7 +37,7 @@ for category_uid in category_uid_list:
# on project, can select a project which means only transactions for # on project, can select a project which means only transactions for
# that specific project, or select a special value "None" which means # that specific project, or select a special value "None" which means
# transactions that are not related to a project. For that we need a # transactions that are not related to a project. For that we need a
# query that will be translated as stock.project_uid IS NULL. # query that will be translated as stock.project_uid IS NULL.
params[category_uid] = SimpleQuery(**{category_uid: None}) params[category_uid] = SimpleQuery(**{category_uid: None})
else: else:
params[category_uid] = category_uid_value params[category_uid] = category_uid_value
...@@ -148,10 +148,10 @@ if from_date or is_pl_account: ...@@ -148,10 +148,10 @@ if from_date or is_pl_account:
from_date=period_start_date, from_date=period_start_date,
to_date=initial_balance_from_date, to_date=initial_balance_from_date,
**get_inventory_kw) - max(-period_openning_balance, 0) **get_inventory_kw) - max(-period_openning_balance, 0)
if previous_total_credit != 0: if previous_total_credit != 0:
previous_total_credit = - previous_total_credit previous_total_credit = - previous_total_credit
# Show the previous balance if not empty # Show the previous balance if not empty
if previous_total_credit != 0 or previous_total_debit != 0: if previous_total_credit != 0 or previous_total_debit != 0:
net_balance = previous_total_debit - previous_total_credit net_balance = previous_total_debit - previous_total_credit
......
...@@ -10,7 +10,7 @@ def getOrganisationForSectionCategory(section): ...@@ -10,7 +10,7 @@ def getOrganisationForSectionCategory(section):
checked_permission='Access contents information') checked_permission='Access contents information')
if mapping is not None: if mapping is not None:
return mapping return mapping
organisation_list = section.getGroupRelatedValueList(portal_type='Organisation', organisation_list = section.getGroupRelatedValueList(portal_type='Organisation',
strict_membership=1, strict_membership=1,
checked_permission='Access contents information') checked_permission='Access contents information')
...@@ -33,7 +33,7 @@ for group in group_chain: ...@@ -33,7 +33,7 @@ for group in group_chain:
organisation = getOrganisationForSectionCategory(group) organisation = getOrganisationForSectionCategory(group)
if organisation is not None and ( if organisation is not None and (
len(organisation.contentValues( len(organisation.contentValues(
filter=dict(portal_type='Accounting Period'))) or filter=dict(portal_type='Accounting Period'))) or
organisation.getMapping()): organisation.getMapping()):
return organisation return organisation
......
...@@ -2,7 +2,7 @@ if brain is not None: ...@@ -2,7 +2,7 @@ if brain is not None:
transaction = brain.getObject() transaction = brain.getObject()
else: else:
transaction = context transaction = context
def getTotalPrice(transaction_path): def getTotalPrice(transaction_path):
is_source = transaction.AccountingTransaction_isSourceView() is_source = transaction.AccountingTransaction_isSourceView()
total_price = 0 total_price = 0
......
if kw.get('created_by_builder', 0): if kw.get('created_by_builder', 0):
return return
preference_tool = context.getPortalObject().portal_preferences preference_tool = context.getPortalObject().portal_preferences
......
...@@ -5,5 +5,5 @@ kw['left_join_list'] = ['delivery_uid'] ...@@ -5,5 +5,5 @@ kw['left_join_list'] = ['delivery_uid']
kw['select_dict'] = dict(delivery_uid=None) kw['select_dict'] = dict(delivery_uid=None)
kw['group_by'] = ('uid',) kw['group_by'] = ('uid',)
kw['src__'] = src__ kw['src__'] = src__
return context.portal_catalog(**kw) return context.portal_catalog(**kw)
if kw.get('created_by_builder', 0): if kw.get('created_by_builder', 0):
return return
preference_tool = context.getPortalObject().portal_preferences preference_tool = context.getPortalObject().portal_preferences
......
if kw.get('created_by_builder', 0): if kw.get('created_by_builder', 0):
return return
preference_tool = context.getPortalObject().portal_preferences preference_tool = context.getPortalObject().portal_preferences
context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection()) context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency()) context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())
if 'Invoice Line' in context.getVisibleAllowedContentTypeList(): if 'Invoice Line' in context.getVisibleAllowedContentTypeList():
return return
......
...@@ -95,7 +95,7 @@ if not skip_period_validation : ...@@ -95,7 +95,7 @@ if not skip_period_validation :
raise ValidationFailed(translateString("Date is not in a started Accounting Period " raise ValidationFailed(translateString("Date is not in a started Accounting Period "
"for source section.")) "for source section."))
# do the same for destination section # do the same for destination section
if destination_section is not None: if destination_section is not None:
# if we don't have any accounts on this side, we don't enforce date checks # if we don't have any accounts on this side, we don't enforce date checks
valid_date = False valid_date = False
......
...@@ -35,19 +35,19 @@ for line in transaction_lines: ...@@ -35,19 +35,19 @@ for line in transaction_lines:
raise ValidationFailed(translateString( raise ValidationFailed(translateString(
"Account ${account_title} is not validated.", "Account ${account_title} is not validated.",
mapping=dict(account_title=account.Account_getFormattedTitle()))) mapping=dict(account_title=account.Account_getFormattedTitle())))
if third_party is not None and\ if third_party is not None and\
third_party.getValidationState() in invalid_state_list: third_party.getValidationState() in invalid_state_list:
raise ValidationFailed(translateString( raise ValidationFailed(translateString(
"Third party ${third_party_name} is invalid.", "Third party ${third_party_name} is invalid.",
mapping=dict(third_party_name=third_party.getTitle()))) mapping=dict(third_party_name=third_party.getTitle())))
if bank_account is not None: if bank_account is not None:
if bank_account.getValidationState() in invalid_state_list: if bank_account.getValidationState() in invalid_state_list:
raise ValidationFailed(translateString( raise ValidationFailed(translateString(
"Bank Account ${bank_account_reference} is invalid.", "Bank Account ${bank_account_reference} is invalid.",
mapping=dict(bank_account_reference=bank_account.getReference()))) mapping=dict(bank_account_reference=bank_account.getReference())))
if account is not None and account.isMemberOf('account_type/asset/cash/bank'): if account is not None and account.isMemberOf('account_type/asset/cash/bank'):
# also check that currencies are consistent if we use this quantity for # also check that currencies are consistent if we use this quantity for
# accounting. # accounting.
......
""" display value in the cell according to (french) fiscality rules """ """ display value in the cell according to (french) fiscality rules """
context.log(cell_name, cell_value) context.log(cell_name, cell_value)
if same_type(cell_value, 0) or same_type(cell_value, 0.0) : if same_type(cell_value, 0) or same_type(cell_value, 0.0) :
number = cell_value number = cell_value
if number == 0 : if number == 0 :
return "" return ""
negative = number < 0 negative = number < 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
amount=float(amount or 0) amount=float(amount or 0)
fractionalPart, integerPart = math.modf(amount) fractionalPart, integerPart = math.modf(amount)
if math.fabs(fractionalPart) > 0.49999 : if math.fabs(fractionalPart) > 0.49999 :
if integerPart > 0 : if integerPart > 0 :
integerPart += 1 integerPart += 1
elif integerPart < 0: elif integerPart < 0:
integerPart -= 1 integerPart -= 1
......
""" """
This scripts add the balance of every gap account in the list 'accounts' This scripts add the balance of every gap account in the list 'accounts'
it use portal_simulation.getInventoryAssetPrice. it use portal_simulation.getInventoryAssetPrice.
The following REQUEST keys are mandatory : The following REQUEST keys are mandatory :
at_date at_date
those are optional : those are optional :
gap_base gap_base
simulation_state simulation_state
section_category 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 from_date
parameters keywords to this script overrides REQUEST keys parameters keywords to this script overrides REQUEST keys
""" """
def shortAccountNameToFullGapCategory(accountName) : def shortAccountNameToFullGapCategory(accountName) :
""" translates a short account name (eg asset/current_assets) to a full gap category url """ translates a short account name (eg asset/current_assets) to a full gap category url
(eg gap/in/sme1/asset/current_assets) """ (eg gap/in/sme1/asset/current_assets) """
accountName = accountName.strip() accountName = accountName.strip()
gap = request.get("gap_base", "gap/in/sme1") gap = request.get("gap_base", "gap/in/sme1")
...@@ -38,7 +38,7 @@ sum = 0 ...@@ -38,7 +38,7 @@ sum = 0
for account in accounts : for account in accounts :
kw["node_category"] = shortAccountNameToFullGapCategory(account) kw["node_category"] = shortAccountNameToFullGapCategory(account)
# checks the node category exists # checks the node category exists
if context.restrictedTraverse('portal_categories/%s' % kw["node_category"], None) is not None : if context.restrictedTraverse('portal_categories/%s' % kw["node_category"], None) is not None :
val = (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) val = (context.portal_simulation.getInventoryAssetPrice(**kw) or 0)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
amount=float(amount or 0) amount=float(amount or 0)
fractionalPart, integerPart = math.modf(amount) fractionalPart, integerPart = math.modf(amount)
if math.fabs(fractionalPart) > 0.49999 : if math.fabs(fractionalPart) > 0.49999 :
if integerPart > 0 : if integerPart > 0 :
integerPart += 1 integerPart += 1
elif integerPart < 0: elif integerPart < 0:
integerPart -= 1 integerPart -= 1
......
...@@ -59,5 +59,5 @@ class PolishAddressDetails: ...@@ -59,5 +59,5 @@ class PolishAddressDetails:
'type' : 'string', 'type' : 'string',
'mode' : 'w' }, 'mode' : 'w' },
) )
...@@ -4,14 +4,14 @@ Journal entries, for use with AccountingTransactionModule_viewJournal ...@@ -4,14 +4,14 @@ Journal entries, for use with AccountingTransactionModule_viewJournal
changed by BG to make a simple list of purchases / sales changed by BG to make a simple list of purchases / sales
("rejestr zakupów" i "rejestr sprzedaży") ("rejestr zakupów" i "rejestr sprzedaży")
return a list of dictionnaries like that : return a list of dictionnaries like that :
{ {
'date' : Date 'date' : Date
'description' : String 'description' : String
'reference':String 'reference':String
'lines' : { 'lines' : {
'debtor' : Bool, 'debtor' : Bool,
'account_gap_id' : String 'account_gap_id' : String
'account_name' : String # with extra-description (ie. bank name if a bank, organisation name if an other party) 'account_name' : String # with extra-description (ie. bank name if a bank, organisation name if an other party)
'amount' : Float 'amount' : Float
......
...@@ -6,7 +6,7 @@ getCredit=context.getCredit ...@@ -6,7 +6,7 @@ getCredit=context.getCredit
# pobiera stan kont po stronie debit # pobiera stan kont po stronie debit
getDebit=context.getDebit getDebit=context.getDebit
# pobiera różnicę dla kont po obu stronach # pobiera różnicę dla kont po obu stronach
getBalance=context.getBalance getBalance=context.getBalance
class Bil:pass class Bil:pass
......
""" """
This scripts add the balance of every gap account in the list 'accounts' This scripts add the balance of every gap account in the list 'accounts'
it use portal_simulation.getInventory. it use portal_simulation.getInventory.
The following REQUEST keys are mandatory : The following REQUEST keys are mandatory :
at_date at_date
those are optional : those are optional :
gap_base gap_base
simulation_state simulation_state
resource resource
section_category 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 from_date
parameters keywords to this script overrides REQUEST keys parameters keywords to this script overrides REQUEST keys
""" """
...@@ -33,7 +33,7 @@ sum = 0 ...@@ -33,7 +33,7 @@ sum = 0
for account in accounts : for account in accounts :
kw['node_category']= context.shortAccountNumberToFullGapCategory(account, **kw) kw['node_category']= context.shortAccountNumberToFullGapCategory(account, **kw)
#context.log('KW for getInventory',kw) #context.log('KW for getInventory',kw)
try : try :
#val = (context.portal_simulation.getInventory(**kw) or 0) #val = (context.portal_simulation.getInventory(**kw) or 0)
val = (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) val = (context.portal_simulation.getInventoryAssetPrice(**kw) or 0)
sum += val sum += val
......
result = [] result = []
if include_empty : if include_empty :
result = [['', ''],] result = [['', ''],]
om = getattr(context.getPortalObject(),'organisation_module') om = getattr(context.getPortalObject(),'organisation_module')
lst=[o for o in om.objectValues() if 'group/usk' in o.getCategoryList()] lst=[o for o in om.objectValues() if 'group/usk' in o.getCategoryList()]
for u in lst : for u in lst :
result.append((u.getTitle(), u.getRelativeUrl())) result.append((u.getTitle(), u.getRelativeUrl()))
return result return result
...@@ -6,7 +6,7 @@ getCredit=context.getCredit ...@@ -6,7 +6,7 @@ getCredit=context.getCredit
# pobiera stan kont po stronie debit # pobiera stan kont po stronie debit
getDebit=context.getDebit getDebit=context.getDebit
# pobiera różnicę dla kont po obu stronach # pobiera różnicę dla kont po obu stronach
getBalance=context.getBalance getBalance=context.getBalance
class PL:pass class PL:pass
......
...@@ -42,7 +42,7 @@ gap_text = \ ...@@ -42,7 +42,7 @@ gap_text = \
* [131] Rachunek bieżący * [131] Rachunek bieżący
* [132] Rachunek walutowy * [132] Rachunek walutowy
* [133] Kredyty bankowe * [133] Kredyty bankowe
* [134] Inne rachunki bankowe * [134] Inne rachunki bankowe
* [1341] Rachunek bankowy wyodrębnionych środków pieniężnych ZFŚS * [1341] Rachunek bankowy wyodrębnionych środków pieniężnych ZFŚS
* [1342] Rachunek bankowy lokat terminowych (według poszczególnych lokat) * [1342] Rachunek bankowy lokat terminowych (według poszczególnych lokat)
* [1343] Rachunek bankowy akredytywy (według poszczególnych kontrahentów} * [1343] Rachunek bankowy akredytywy (według poszczególnych kontrahentów}
...@@ -65,19 +65,19 @@ gap_text = \ ...@@ -65,19 +65,19 @@ gap_text = \
* [223] Rozrachunki z urzędem skarbowym z tytułu VAT naliczonego * [223] Rozrachunki z urzędem skarbowym z tytułu VAT naliczonego
* [2231] rozliczenie naliczonego VAT * [2231] rozliczenie naliczonego VAT
* [2232] korekty naliczonego VAT * [2232] korekty naliczonego VAT
* [224] Pozostałe rozrachunki publicznoprawne * [224] Pozostałe rozrachunki publicznoprawne
* [2241] Rozrachunki publicznoprawne z urzędem skarbowym * [2241] Rozrachunki publicznoprawne z urzędem skarbowym
* [22411] podatek dochodowy * [22411] podatek dochodowy
* [22412] podatek od czynności cywilnoprawnych * [22412] podatek od czynności cywilnoprawnych
* [2242] Rozrachunki publicznoprawne z urzędem miasta/gminy * [2242] Rozrachunki publicznoprawne z urzędem miasta/gminy
* [22421] Podatek od nieruchomości * [22421] Podatek od nieruchomości
* [22422] podatek od środków transportowych * [22422] podatek od środków transportowych
* [2243] Rozrachunki publicznoprawne z urzędem celnym * [2243] Rozrachunki publicznoprawne z urzędem celnym
* [2244] Rozrachunki publicznoprawne z ZUS * [2244] Rozrachunki publicznoprawne z ZUS
* [2245] Rozrachunki publicznoprawne z PFRON * [2245] Rozrachunki publicznoprawne z PFRON
* [23] Rozrachunki z tytułu wynagrodzeń i innych świadczeń na rzecz pracowników * [23] Rozrachunki z tytułu wynagrodzeń i innych świadczeń na rzecz pracowników
* [231] Rozrachunki z tytułu wynagrodzeń * [231] Rozrachunki z tytułu wynagrodzeń
* [2311] umowa o pracę * [2311] umowa o pracę
* [2312] umowy cywilnoprawne * [2312] umowy cywilnoprawne
* [232] Rozrachunki z pracownikami * [232] Rozrachunki z pracownikami
* [2321] zaliczki * [2321] zaliczki
...@@ -86,7 +86,7 @@ gap_text = \ ...@@ -86,7 +86,7 @@ gap_text = \
* [242] Rozrachunki z udziałowcami * [242] Rozrachunki z udziałowcami
* [25] Pozostałe rozrachunki * [25] Pozostałe rozrachunki
* [251] Inne rozrachunki z kontrahentami * [251] Inne rozrachunki z kontrahentami
* [26] Pożyczki * [26] Pożyczki
* [261] Pożyczki otrzymane * [261] Pożyczki otrzymane
* [262] Pożyczki udzielone * [262] Pożyczki udzielone
* [27] Rozliczenie niedoborów i nadwyżek * [27] Rozliczenie niedoborów i nadwyżek
...@@ -116,7 +116,7 @@ gap_text = \ ...@@ -116,7 +116,7 @@ gap_text = \
* [336] Nieruchomości i prawa majątkowe przeznaczone do obrotu * [336] Nieruchomości i prawa majątkowe przeznaczone do obrotu
* [34] Odchylenia od cen ewidencyjnych materiałów i towarów * [34] Odchylenia od cen ewidencyjnych materiałów i towarów
* [341] Odchylenia od cen ewidencyjnych materiałów * [341] Odchylenia od cen ewidencyjnych materiałów
* [342] Odchylenia od cen ewidencyjnych towarów * [342] Odchylenia od cen ewidencyjnych towarów
* [3421] Odchylenia od cen ewidencyjnych towarów w hurcie * [3421] Odchylenia od cen ewidencyjnych towarów w hurcie
* [3422] Odchylenia od cen ewidencyjnych towarów w detalu * [3422] Odchylenia od cen ewidencyjnych towarów w detalu
* [3423] Odchylenia od cen ewidencyjnych towarów w zakładach gastronomicznych * [3423] Odchylenia od cen ewidencyjnych towarów w zakładach gastronomicznych
...@@ -129,8 +129,8 @@ gap_text = \ ...@@ -129,8 +129,8 @@ gap_text = \
* [401] Amortyzacja * [401] Amortyzacja
* [4011] amortyzacja urządzeń technicznych * [4011] amortyzacja urządzeń technicznych
* [4012] amortyzacja środków transportu * [4012] amortyzacja środków transportu
* [402] Zużycie materiałów i energii * [402] Zużycie materiałów i energii
* [4021] Zużycie surowców do wytwarzania produktów * [4021] Zużycie surowców do wytwarzania produktów
* [4022] Zużycie energii * [4022] Zużycie energii
* [4023] Zużycie paliwa dla środków transportu * [4023] Zużycie paliwa dla środków transportu
* [40231] Zużycie Oleju napędowego * [40231] Zużycie Oleju napędowego
...@@ -142,7 +142,7 @@ gap_text = \ ...@@ -142,7 +142,7 @@ gap_text = \
* [4033] Pozostałe usługi obce * [4033] Pozostałe usługi obce
* [404] Podatki i opłaty * [404] Podatki i opłaty
* [4041] Podatek od nieruchomości * [4041] Podatek od nieruchomości
* [4042] Podatek od środków transportowych * [4042] Podatek od środków transportowych
* [4043] Podatek akcyzowy * [4043] Podatek akcyzowy
* [4045] VAT niepodlegający odliczeniu * [4045] VAT niepodlegający odliczeniu
* [4046] Pozostałe podatki i opłaty * [4046] Pozostałe podatki i opłaty
...@@ -151,7 +151,7 @@ gap_text = \ ...@@ -151,7 +151,7 @@ gap_text = \
* [4052] Wynagrodzenia osób doraźnie zatrudnionych * [4052] Wynagrodzenia osób doraźnie zatrudnionych
* [406] Ubezpieczenia społeczne i inne świadczenia * [406] Ubezpieczenia społeczne i inne świadczenia
* [4061] Składki na ubezpieczenia społeczne, FP, FGŚP * [4061] Składki na ubezpieczenia społeczne, FP, FGŚP
* [4062] Odpisy na zakładowy fundusz świadczeń socjalnych lub świadczenia urlopowe * [4062] Odpisy na zakładowy fundusz świadczeń socjalnych lub świadczenia urlopowe
* [4063] Pozostałe świadczenia * [4063] Pozostałe świadczenia
* [407] Pozostałe koszty rodzajowe * [407] Pozostałe koszty rodzajowe
* [49] Rozliczenie kosztów * [49] Rozliczenie kosztów
...@@ -163,10 +163,10 @@ gap_text = \ ...@@ -163,10 +163,10 @@ gap_text = \
* [504] Koszty usług podstawowych * [504] Koszty usług podstawowych
* [509] Koszty braków * [509] Koszty braków
* [52] Koszty działalności podstawowej - handlowej * [52] Koszty działalności podstawowej - handlowej
* [522] Koszty działalności podstawowej - handlowej * [522] Koszty działalności podstawowej - handlowej
* [5221] Koszty hurtu * [5221] Koszty hurtu
* [5222] Koszty detalu * [5222] Koszty detalu
* [5223] Koszty zakładów gastronomicznych * [5223] Koszty zakładów gastronomicznych
* [5224] Koszty skupu * [5224] Koszty skupu
* [523] Koszty wydziałowe * [523] Koszty wydziałowe
* [529] Koszty sprzedaży * [529] Koszty sprzedaży
...@@ -176,7 +176,7 @@ gap_text = \ ...@@ -176,7 +176,7 @@ gap_text = \
* [6] Produkty i rozliczenia międzyokresowe * [6] Produkty i rozliczenia międzyokresowe
* [60] Produkty gotowe i półprodukty * [60] Produkty gotowe i półprodukty
* [601] Produkty gotowe * [601] Produkty gotowe
* [6011] Produkty gotowe w magazynie * [6011] Produkty gotowe w magazynie
* [6012] Produkty gotowe poza jednostką * [6012] Produkty gotowe poza jednostką
* [602] Półprodukty * [602] Półprodukty
* [62] Odchylenia od cen ewidencyjnych produktów * [62] Odchylenia od cen ewidencyjnych produktów
...@@ -216,7 +216,7 @@ gap_text = \ ...@@ -216,7 +216,7 @@ gap_text = \
* [8] Kapitały (fundusze) własne, fundusze specjalne i wynik finansowy * [8] Kapitały (fundusze) własne, fundusze specjalne i wynik finansowy
* [80] Kapitały własne * [80] Kapitały własne
* [801] Kapitał (fundusz) podstawowy * [801] Kapitał (fundusz) podstawowy
* [802] Kapitał (fundusz) zapasowy * [802] Kapitał (fundusz) zapasowy
* [803] Kapitał (fundusz) rezerwowy * [803] Kapitał (fundusz) rezerwowy
* [804] Kapitał (fundusz) z aktualizacji wyceny * [804] Kapitał (fundusz) z aktualizacji wyceny
* [805] Kapitały (fundusze) wydzielone w jednostce statutowej i zakładach (oddziałach) samodzielnie sporządzających bilans * [805] Kapitały (fundusze) wydzielone w jednostce statutowej i zakładach (oddziałach) samodzielnie sporządzających bilans
...@@ -228,8 +228,8 @@ gap_text = \ ...@@ -228,8 +228,8 @@ gap_text = \
* [84] Fundusze specjalne * [84] Fundusze specjalne
* [841] Zakładowy fundusz świadczeń socjalnych * [841] Zakładowy fundusz świadczeń socjalnych
* [842] Inne fundusze specjalne * [842] Inne fundusze specjalne
* [8421] Zakładowy fundusz rehabilitacji osób niepełnosprawnych * [8421] Zakładowy fundusz rehabilitacji osób niepełnosprawnych
* [8422] Fundusz nagród * [8422] Fundusz nagród
* [8423] Fundusz na remonty zasobów mieszkaniowych * [8423] Fundusz na remonty zasobów mieszkaniowych
* [86] Wynik finansowy * [86] Wynik finansowy
* [87] Podatek dochodowy i inne obowiązkowe obciążenia wyniku finansowego * [87] Podatek dochodowy i inne obowiązkowe obciążenia wyniku finansowego
...@@ -253,8 +253,8 @@ for line in gap_text.splitlines(): ...@@ -253,8 +253,8 @@ for line in gap_text.splitlines():
parent = gap.restrictedTraverse('/'.join(path)) parent = gap.restrictedTraverse('/'.join(path))
print 'Added to ',parent print 'Added to ',parent
parent.newContent(id=num, title=descr) parent.newContent(id=num, title=descr)
return printed return printed
...@@ -21,7 +21,7 @@ if accounting_module.getProperty('current_content_script', ...@@ -21,7 +21,7 @@ if accounting_module.getProperty('current_content_script',
if 1: if 1:
accounting_module.manage_delObjects(list(accounting_module.objectIds())) accounting_module.manage_delObjects(list(accounting_module.objectIds()))
# XXX copy & paste # XXX copy & paste
def getAccountByTitle(title): def getAccountByTitle(title):
account_list = [x.getObject().getRelativeUrl() for x in account_list = [x.getObject().getRelativeUrl() for x in
portal.portal_catalog(portal_type='Account', portal.portal_catalog(portal_type='Account',
......
...@@ -25,7 +25,7 @@ if 1: ...@@ -25,7 +25,7 @@ if 1:
module = portal[module_id] module = portal[module_id]
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
# XXX copy & paste # XXX copy & paste
def getAccountByTitle(title): def getAccountByTitle(title):
account_list = [x.getObject().getRelativeUrl() for x in account_list = [x.getObject().getRelativeUrl() for x in
portal.portal_catalog(portal_type='Account', portal.portal_catalog(portal_type='Account',
......
"""Change the `current_content_script` property on accounting module, """Change the `current_content_script` property on accounting module,
so that the next test knows that we have modified the test data. so that the next test knows that we have modified the test data.
XXX Kato: This is seriously wrong because test must not suppose anything XXX Kato: This is seriously wrong because test must not suppose anything
......
...@@ -30,7 +30,7 @@ def get_object_by_title(portal_type, title): ...@@ -30,7 +30,7 @@ def get_object_by_title(portal_type, title):
bank1 = get_object_by_title(portal_type='Bank Account', title='Bank1') bank1 = get_object_by_title(portal_type='Bank Account', title='Bank1')
if bank1 is None: if bank1 is None:
bank1 = portal.AccountingTransactionModule_createAccountingTestDocument( bank1 = portal.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Bank Account', title='Bank1', simulation_state='validated', portal_type='Bank Account', title='Bank1', simulation_state='validated',
parent=organisation_module.my_organisation) parent=organisation_module.my_organisation)
purchase1 = portal.AccountingTransactionModule_createAccountingTestDocument( purchase1 = portal.AccountingTransactionModule_createAccountingTestDocument(
......
...@@ -3,7 +3,7 @@ https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccounting ...@@ -3,7 +3,7 @@ https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccounting
The test operates on 'today' transactions. The test operates on 'today' transactions.
:param with_ledger: if true then data are prepared for :param with_ledger: if true then data are prepared for
testOtherPartiesReportLedger unittest rather than testOtherPartiesReport testOtherPartiesReportLedger unittest rather than testOtherPartiesReport
""" """
......
...@@ -41,7 +41,7 @@ if pref.owner_info()['id'] != context.REQUEST.AUTHENTICATED_USER.getId(): ...@@ -41,7 +41,7 @@ if pref.owner_info()['id'] != context.REQUEST.AUTHENTICATED_USER.getId():
cb = ptool.manage_copyObjects(['accounting_zuite_preference']) cb = ptool.manage_copyObjects(['accounting_zuite_preference'])
pasted, = ptool.manage_pasteObjects(cb) pasted, = ptool.manage_pasteObjects(cb)
pref = ptool[pasted['new_id']] pref = ptool[pasted['new_id']]
pref.edit(preferred_accounting_transaction_at_date=None) pref.edit(preferred_accounting_transaction_at_date=None)
pref.edit(preferred_accounting_transaction_from_date=None) pref.edit(preferred_accounting_transaction_from_date=None)
pref.edit(preferred_account_number_method=None) pref.edit(preferred_account_number_method=None)
......
...@@ -49,8 +49,8 @@ def execute(skin): ...@@ -49,8 +49,8 @@ def execute(skin):
for skin in context.portal_skins.objectValues(): for skin in context.portal_skins.objectValues():
execute(skin) execute(skin)
if incorrect_file_absolute_url_list != []: if incorrect_file_absolute_url_list != []:
return ActiveResult(severity=100, detail="There is no cache set for:\n" + "\n".join(incorrect_file_absolute_url_list)) return ActiveResult(severity=100, detail="There is no cache set for:\n" + "\n".join(incorrect_file_absolute_url_list))
return ActiveResult(severity=0, detail="OK") return ActiveResult(severity=0, detail="OK")
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
on, at maximum, bundle_object_count objects. on, at maximum, bundle_object_count objects.
bundle_object_count bundle_object_count
Maximum number of objects to deal with in one transaction. Maximum number of objects to deal with in one transaction.
An activity is started after each successfull execution which An activity is started after each successfull execution which
found bundle_object_count to work on. found bundle_object_count to work on.
property_override_method_id property_override_method_id
...@@ -177,7 +177,7 @@ else: ...@@ -177,7 +177,7 @@ else:
severity=severity, severity=severity,
detail='\n'.join(result_list)) detail='\n'.join(result_list))
activate(active_process=active_process, activate(active_process=active_process,
activity='SQLQueue', activity='SQLQueue',
priority=2, priority=2,
tag=tag).ERP5Site_saveCheckCatalogTableResult(active_result) tag=tag).ERP5Site_saveCheckCatalogTableResult(active_result)
......
...@@ -46,7 +46,7 @@ if session_id in [None, '']: ...@@ -46,7 +46,7 @@ if session_id in [None, '']:
now = DateTime() now = DateTime()
session_id = context.Base_generateSessionID(max_long=20) session_id = context.Base_generateSessionID(max_long=20)
expire_timeout_days = 90 expire_timeout_days = 90
request.RESPONSE.setCookie('session_id', session_id, request.RESPONSE.setCookie('session_id', session_id,
expires=(now + expire_timeout_days).rfc822(), path='/') expires=(now + expire_timeout_days).rfc822(), path='/')
request.set('session_id', session_id) request.set('session_id', session_id)
...@@ -94,7 +94,7 @@ context.getPortalObject().portal_sessions[session_id].update(shopping_cart=shopp ...@@ -94,7 +94,7 @@ context.getPortalObject().portal_sessions[session_id].update(shopping_cart=shopp
if checkout: if checkout:
website = context.getWebSiteValue() website = context.getWebSiteValue()
if website is not None: if website is not None:
return website.cart.Base_redirect("", return website.cart.Base_redirect("",
keep_items={'portal_status_message':context.Base_translateString("Added to cart.")}) keep_items={'portal_status_message':context.Base_translateString("Added to cart.")})
keep_items = { keep_items = {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# Try to find out the current web site # Try to find out the current web site
web_site_value = context.REQUEST.get('current_web_site', None) web_site_value = context.REQUEST.get('current_web_site', None)
if web_site_value is None: if web_site_value is None:
web_site_value = context.getWebSiteValue() web_site_value = context.getWebSiteValue()
# If this resource is variated, initialize the default # If this resource is variated, initialize the default
# variation context # variation context
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
(is it really useful to create a new shopping cart here) (is it really useful to create a new shopping cart here)
""" """
request = context.REQUEST request = context.REQUEST
if session_id in [None, '']: if session_id in [None, '']:
session_id = request.get('session_id', None) session_id = request.get('session_id', None)
if session_id in [None, '']: if session_id in [None, '']:
......
""" """
Calculate total price of temporary RAM based Sale Order. Calculate total price of temporary RAM based Sale Order.
Price is based on three main components: Price is based on three main components:
- shopping cart items - shopping cart items
- shipping costs (same as applicable taxes including type of shopping cart item - shipping costs (same as applicable taxes including type of shopping cart item
for example online materials doesn't require shipping) for example online materials doesn't require shipping)
Script can optionally include currency. Script can optionally include currency.
""" """
web_site = context.getWebSiteValue() web_site = context.getWebSiteValue()
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
field reusability and property validation field reusability and property validation
""" """
portal = context.getPortalObject() portal = context.getPortalObject()
translateString = portal.Base_translateString translateString = portal.Base_translateString
if field_my_buy_quantity is None: if field_my_buy_quantity is None:
field_my_buy_quantity = context.REQUEST.get("field_my_buy_quantity", None) field_my_buy_quantity = context.REQUEST.get("field_my_buy_quantity", None)
if field_my_shipping_method is None: if field_my_shipping_method is None:
field_my_shipping_method=context.REQUEST.get("field_my_shipping_method", None) field_my_shipping_method=context.REQUEST.get("field_my_shipping_method", None)
if field_my_payment_mode is None: if field_my_payment_mode is None:
field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None) field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None)
quantity = field_my_buy_quantity quantity = field_my_buy_quantity
...@@ -48,9 +48,9 @@ if field_my_shipping_method not in ['', None]: ...@@ -48,9 +48,9 @@ if field_my_shipping_method not in ['', None]:
shipping = portal.restrictedTraverse(field_my_shipping_method) shipping = portal.restrictedTraverse(field_my_shipping_method)
# create new shipping method order line # create new shipping method order line
shopping_cart.newContent( shopping_cart.newContent(
id='shipping_method', id='shipping_method',
portal_type='Sale Order Line', portal_type='Sale Order Line',
resource_value=shipping, resource_value=shipping,
quantity=1) quantity=1)
# Handle payment mode and comment # Handle payment mode and comment
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
Return the default trade condition for thie ecommerce site Return the default trade condition for thie ecommerce site
""" """
return context.getWebSiteValue().getLayoutProperty( return context.getWebSiteValue().getLayoutProperty(
'ecommerce_default_trade_condition', 'ecommerce_default_trade_condition',
'sale_trade_condition_module/default_trade_condition') 'sale_trade_condition_module/default_trade_condition')
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
from DateTime import DateTime from DateTime import DateTime
request = context.REQUEST request = context.REQUEST
if session_id is None: if session_id is None:
session_id = request.get('session_id', None) session_id = request.get('session_id', None)
request.RESPONSE.expireCookie('session_id') request.RESPONSE.expireCookie('session_id')
......
...@@ -13,7 +13,7 @@ REQUEST.RESPONSE.expireCookie('login_come_from_url', path='/') ...@@ -13,7 +13,7 @@ REQUEST.RESPONSE.expireCookie('login_come_from_url', path='/')
if not website.SaleOrder_getShoppingCartItemList(): if not website.SaleOrder_getShoppingCartItemList():
REQUEST.RESPONSE.expireCookie('session_id', path='/') REQUEST.RESPONSE.expireCookie('session_id', path='/')
msg = context.Base_translateString('You have been logged out. Thank you for using this website.') msg = context.Base_translateString('You have been logged out. Thank you for using this website.')
return website.Base_redirect(form_id, keep_items = {'portal_status_message' : msg}, **kw) return website.Base_redirect(form_id, keep_items = {'portal_status_message' : msg}, **kw)
# #
# this script is called on the Invoice Transaction # this script is called on the Invoice Transaction
# after the advanced_invoice_transaction_builder created accounting lines in the invoice # after the advanced_invoice_transaction_builder created accounting lines in the invoice
# #
# copy title # copy title
invoice_transaction = context invoice_transaction = context
related_invoice = invoice_transaction.getDefaultCausalityValue() related_invoice = invoice_transaction.getDefaultCausalityValue()
if not invoice_transaction.hasTitle() and related_invoice is not None and related_invoice.hasTitle(): if not invoice_transaction.hasTitle() and related_invoice is not None and related_invoice.hasTitle():
invoice_transaction.setTitle(related_invoice.getTitle()) invoice_transaction.setTitle(related_invoice.getTitle())
......
...@@ -8,5 +8,5 @@ kw['left_join_list'] = ['delivery_uid'] ...@@ -8,5 +8,5 @@ kw['left_join_list'] = ['delivery_uid']
kw['select_dict'] = dict(delivery_uid=None) kw['select_dict'] = dict(delivery_uid=None)
kw['group_by'] = ('uid',) kw['group_by'] = ('uid',)
kw['src__'] = src__ kw['src__'] = src__
return context.portal_catalog(**kw) return context.portal_catalog(**kw)
...@@ -36,7 +36,7 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -36,7 +36,7 @@ from Products.ERP5Type import Permissions, PropertySheet
class ApparelColourRange(Resource): class ApparelColourRange(Resource):
""" """
A apparel colour range A apparel colour range
It is considered here as a resource because planification can It is considered here as a resource because planification can
eventually consider the sales of a certain quantity of items of a given ApparelColourRange eventually consider the sales of a certain quantity of items of a given ApparelColourRange
""" """
......
...@@ -6,7 +6,7 @@ selected_base_category_list = context.getVariationBaseCategoryList() ...@@ -6,7 +6,7 @@ selected_base_category_list = context.getVariationBaseCategoryList()
# Generate cell range # Generate cell range
for base_category in selected_base_category_list: for base_category in selected_base_category_list:
if matrixbox==1: if matrixbox==1:
# XXX matrixbox is right_display (not as listfield) # XXX matrixbox is right_display (not as listfield)
# => invert display and value in item # => invert display and value in item
cell_range.append(map(lambda x: (x[1], x[0]), cell_range.append(map(lambda x: (x[1], x[0]),
context.getVariationCategoryItemList( context.getVariationCategoryItemList(
......
...@@ -26,7 +26,7 @@ predicate_list = context.contentValues( ...@@ -26,7 +26,7 @@ predicate_list = context.contentValues(
pred_ids = [] pred_ids = []
if predicate_list != []: if predicate_list != []:
if matrixbox == 1: if matrixbox == 1:
pred_ids = list(map(lambda x: (x.getRelativeUrl(), x.getTitle()), pred_ids = list(map(lambda x: (x.getRelativeUrl(), x.getTitle()),
predicate_list)) predicate_list))
else: else:
pred_ids = list(map(lambda x: x.getRelativeUrl(), predicate_list)) pred_ids = list(map(lambda x: x.getRelativeUrl(), predicate_list))
......
...@@ -27,7 +27,7 @@ activate_kw = {"tag": tag} ...@@ -27,7 +27,7 @@ activate_kw = {"tag": tag}
for inventory in node_inventory_list: for inventory in node_inventory_list:
# Do only one inventory per node # Do only one inventory per node
if inventory.node_relative_url not in node_inventory_dict: if inventory.node_relative_url not in node_inventory_dict:
inv = inventory_module.newContent(portal_type="Archive Inventory", inv = inventory_module.newContent(portal_type="Archive Inventory",
destination=inventory.node_relative_url, destination=inventory.node_relative_url,
start_date = date, start_date = date,
...@@ -87,7 +87,7 @@ for inventory in node_inventory_list: ...@@ -87,7 +87,7 @@ for inventory in node_inventory_list:
# deliver all inventory # deliver all inventory
for inv in node_inventory_dict.values(): for inv in node_inventory_dict.values():
inv.setDefaultActivateParameterDict(activate_kw) inv.setDefaultActivateParameterDict(activate_kw)
inv.setDefaultReindexParameterDict(dict(sql_catalog_id=destination_sql_catalog_id)) inv.setDefaultReindexParameterDict(dict(sql_catalog_id=destination_sql_catalog_id))
inv.deliver() inv.deliver()
...@@ -100,7 +100,7 @@ payment_inventory_dict = {} ...@@ -100,7 +100,7 @@ payment_inventory_dict = {}
for inventory in payment_inventory_list: for inventory in payment_inventory_list:
# Do only one inventory per payment # Do only one inventory per payment
if inventory.payment_uid not in payment_inventory_dict: if inventory.payment_uid not in payment_inventory_dict:
inv = inventory_module.newContent(portal_type="Archive Inventory", inv = inventory_module.newContent(portal_type="Archive Inventory",
destination=inventory.node_relative_url, destination=inventory.node_relative_url,
destination_payment_uid=inventory.payment_uid, destination_payment_uid=inventory.payment_uid,
...@@ -127,7 +127,7 @@ for inventory in payment_inventory_list: ...@@ -127,7 +127,7 @@ for inventory in payment_inventory_list:
# deliver all inventory # deliver all inventory
for inv in payment_inventory_dict.values(): for inv in payment_inventory_dict.values():
inv.setDefaultActivateParameterDict(activate_kw) inv.setDefaultActivateParameterDict(activate_kw)
inv.setDefaultReindexParameterDict(dict(sql_catalog_id=destination_sql_catalog_id)) inv.setDefaultReindexParameterDict(dict(sql_catalog_id=destination_sql_catalog_id))
inv.deliver() inv.deliver()
...@@ -44,7 +44,7 @@ if listbox_kw.get('date'): ...@@ -44,7 +44,7 @@ if listbox_kw.get('date'):
if portal.REQUEST.get('reconciled_uid_list'): if portal.REQUEST.get('reconciled_uid_list'):
# This is to prevent showing again the lines that we just reconciled # This is to prevent showing again the lines that we just reconciled
kw['workaround_catalog_lag_query'] = NegatedQuery(SimpleQuery(uid=portal.REQUEST['reconciled_uid_list'])) kw['workaround_catalog_lag_query'] = NegatedQuery(SimpleQuery(uid=portal.REQUEST['reconciled_uid_list']))
if context.getSourcePayment(): if context.getSourcePayment():
# As we are showing quantities and not asset prices, we use the precision # As we are showing quantities and not asset prices, we use the precision
# from this bank account currency. # from this bank account currency.
......
...@@ -13,7 +13,7 @@ kw = { ...@@ -13,7 +13,7 @@ kw = {
if not at_date and context.getStopDate(): if not at_date and context.getStopDate():
at_date = context.getStopDate().latestTime() at_date = context.getStopDate().latestTime()
if at_date: if at_date:
kw['at_date'] = at_date kw['at_date'] = at_date
kw['reconciliation_query'] = SimpleQuery( kw['reconciliation_query'] = SimpleQuery(
...@@ -22,13 +22,13 @@ if at_date: ...@@ -22,13 +22,13 @@ if at_date:
if portal.REQUEST.get('reconciled_uid_list'): if portal.REQUEST.get('reconciled_uid_list'):
# This is to take into account lines we just reconciled. # This is to take into account lines we just reconciled.
# We sum all reconciled lines execpt those we just reconciled + those we just # We sum all reconciled lines execpt those we just reconciled + those we just
# reconciled without applying the criterion on reconcilation # reconciled without applying the criterion on reconcilation
kw['workaround_catalog_lag_query'] = NegatedQuery(SimpleQuery(uid=portal.REQUEST['reconciled_uid_list'])) kw['workaround_catalog_lag_query'] = NegatedQuery(SimpleQuery(uid=portal.REQUEST['reconciled_uid_list']))
previously_reconciled = portal.portal_simulation.getInventory(**kw) previously_reconciled = portal.portal_simulation.getInventory(**kw)
kw.pop('workaround_catalog_lag_query') kw.pop('workaround_catalog_lag_query')
kw.pop('reconciliation_query') kw.pop('reconciliation_query')
kw['uid'] = portal.REQUEST['reconciled_uid_list'] kw['uid'] = portal.REQUEST['reconciled_uid_list']
return previously_reconciled + portal.portal_simulation.getInventory(**kw) return previously_reconciled + portal.portal_simulation.getInventory(**kw)
return context.portal_simulation.getInventory(**kw) return context.portal_simulation.getInventory(**kw)
...@@ -530,7 +530,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase): ...@@ -530,7 +530,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
portal_type='Bank Account', portal_type='Bank Account',
price_currency_value=self.portal.currency_module.euro) price_currency_value=self.portal.currency_module.euro)
main_section_bank_account.validate() main_section_bank_account.validate()
payment1 = self._makeOne( payment1 = self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -565,7 +565,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase): ...@@ -565,7 +565,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual( self.assertEqual(
[payment1.bank, payment2.bank], [payment1.bank, payment2.bank],
[x.getObject() for x in bank_reconciliation.BankReconciliation_getAccountingTransactionLineList()]) [x.getObject() for x in bank_reconciliation.BankReconciliation_getAccountingTransactionLineList()])
list_selection_name = bank_reconciliation\ list_selection_name = bank_reconciliation\
.BankReconciliation_viewBankReconciliationFastInputDialog.listbox.get_value( .BankReconciliation_viewBankReconciliationFastInputDialog.listbox.get_value(
'selection_name') 'selection_name')
...@@ -589,7 +589,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase): ...@@ -589,7 +589,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
portal_type='Bank Account', portal_type='Bank Account',
price_currency_value=self.portal.currency_module.euro) price_currency_value=self.portal.currency_module.euro)
main_section_bank_account.validate() main_section_bank_account.validate()
internal_transaction = self.portal.accounting_module.newContent( internal_transaction = self.portal.accounting_module.newContent(
portal_type='Internal Invoice Transaction', portal_type='Internal Invoice Transaction',
source_section_value=self.section, source_section_value=self.section,
...@@ -643,7 +643,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase): ...@@ -643,7 +643,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
[internal_transaction.bank, ], [internal_transaction.bank, ],
[x.getObject() for x in [x.getObject() for x in
bank_reconciliation_for_section.BankReconciliation_getAccountingTransactionLineList()]) bank_reconciliation_for_section.BankReconciliation_getAccountingTransactionLineList()])
# if `section` reconciles, the line is not reconciled for `main_section` # if `section` reconciles, the line is not reconciled for `main_section`
list_selection_name = bank_reconciliation_for_section\ list_selection_name = bank_reconciliation_for_section\
.BankReconciliation_viewBankReconciliationFastInputDialog.listbox.get_value( .BankReconciliation_viewBankReconciliationFastInputDialog.listbox.get_value(
......
...@@ -12,11 +12,11 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None): ...@@ -12,11 +12,11 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None):
close_fds=True) close_fds=True)
output, _ = process.communicate(input=data) output, _ = process.communicate(input=data)
elif barcode_type == 'ean13': elif barcode_type == 'ean13':
from hubarcode.ean13 import EAN13Encoder from hubarcode.ean13 import EAN13Encoder
encoder = EAN13Encoder(data) encoder = EAN13Encoder(data)
output = encoder.get_imagedata() output = encoder.get_imagedata()
elif barcode_type == 'code128': elif barcode_type == 'code128':
from hubarcode.code128 import Code128Encoder from hubarcode.code128 import Code128Encoder
encoder = Code128Encoder(data) encoder = Code128Encoder(data)
encoder.text = '' # get barcode image only encoder.text = '' # get barcode image only
output = encoder.get_imagedata() output = encoder.get_imagedata()
......
...@@ -88,7 +88,7 @@ class LoginAccountProviderMixin: ...@@ -88,7 +88,7 @@ class LoginAccountProviderMixin:
Is password valid? Is password valid?
""" """
return not len(self.analyzePassword(password, **kw)) return not len(self.analyzePassword(password, **kw))
security.declareProtected(Permissions.SetOwnPassword, 'analyzePassword') security.declareProtected(Permissions.SetOwnPassword, 'analyzePassword')
def analyzePassword(self, password, **kw): def analyzePassword(self, password, **kw):
""" """
......
...@@ -4,7 +4,7 @@ try: ...@@ -4,7 +4,7 @@ try:
now = DateTime() now = DateTime()
date = DateTime(date) date = DateTime(date)
except Exception: except Exception:
return '' return ''
Base_translateString = context.Base_translateString Base_translateString = context.Base_translateString
diff = now - date diff = now - date
if diff < 1: if diff < 1:
...@@ -15,7 +15,7 @@ if diff < 1: ...@@ -15,7 +15,7 @@ if diff < 1:
seconds = minutes*60.0 seconds = minutes*60.0
if seconds < 1: if seconds < 1:
return Base_translateString('Now') return Base_translateString('Now')
if 2 > seconds > 1: if 2 > seconds > 1:
return Base_translateString('${timedif} second ago', mapping={'timedif':int(seconds)}) return Base_translateString('${timedif} second ago', mapping={'timedif':int(seconds)})
return Base_translateString('${timedif} seconds ago', mapping={'timedif':int(seconds)}) return Base_translateString('${timedif} seconds ago', mapping={'timedif':int(seconds)})
if 2 > minutes > 1: if 2 > minutes > 1:
......
...@@ -10,12 +10,12 @@ def getOrganisationForSectionCategory(section_category): ...@@ -10,12 +10,12 @@ def getOrganisationForSectionCategory(section_category):
checked_permission='Access contents information') checked_permission='Access contents information')
if mapping is not None: if mapping is not None:
return mapping.getRelativeUrl() return mapping.getRelativeUrl()
organisation_list = section.getGroupRelatedValueList(portal_type='Organisation', organisation_list = section.getGroupRelatedValueList(portal_type='Organisation',
strict_membership=1, strict_membership=1,
checked_permission='Access contents information') + \ checked_permission='Access contents information') + \
section.getGroupRelatedValueList(portal_type='Organisation', section.getGroupRelatedValueList(portal_type='Organisation',
checked_permission='Access contents information') checked_permission='Access contents information')
for organisation in organisation_list: for organisation in organisation_list:
if organisation.getProperty('validation_state', 'unset') not in ('deleted', 'cancelled'): if organisation.getProperty('validation_state', 'unset') not in ('deleted', 'cancelled'):
......
""" """
Generate a HTML Summary of an object. Generate a HTML Summary of an object.
Use "No ZODB" approach if possible. Use "No ZODB" approach if possible.
""" """
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
A script which actually creates and returns the query object. A script which actually creates and returns the query object.
""" """
query_module = context.getPortalObject().query_module query_module = context.getPortalObject().query_module
query = query_module.newContent(description=description, query = query_module.newContent(description=description,
title=context.getPortalType(), title=context.getPortalType(),
agent_value=context) agent_value=context)
query.updateLocalRolesOnSecurityGroups() query.updateLocalRolesOnSecurityGroups()
......
currency_exchange_type_list = context.portal_categories.currency_exchange_type.getCategoryChildRelativeUrlList() currency_exchange_type_list = context.portal_categories.currency_exchange_type.getCategoryChildRelativeUrlList()
resource_list = ['resource/%s' % context.getParentValue().getRelativeUrl()] resource_list = ['resource/%s' % context.getParentValue().getRelativeUrl()]
price_currency_list = [context.getPriceCurrency(base=True)] price_currency_list = [context.getPriceCurrency(base=True)]
......
...@@ -39,14 +39,14 @@ if to_currency is not None: ...@@ -39,14 +39,14 @@ if to_currency is not None:
temp_object.edit(**temp_kw) temp_object.edit(**temp_kw)
object_ = temp_object object_ = temp_object
mapped_value = context.portal_domains.generateMappedValue(object_, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=0, has_cell_content=0,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
discount = getattr(mapped_value, 'discount', None) discount = getattr(mapped_value, 'discount', None)
if base_price is None and discount is None: if base_price is None and discount is None:
mapped_value = context.portal_domains.generateMappedValue(object_, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=1, has_cell_content=1,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
...@@ -54,7 +54,7 @@ if to_currency is not None: ...@@ -54,7 +54,7 @@ if to_currency is not None:
result = [base_price, discount] result = [base_price, discount]
return result return result
# The cache duration must not be too long, 300 is the maximum # The cache duration must not be too long, 300 is the maximum
calculateExchangeFromParameters = CachingMethod(calculateExchangeFromParameters, calculateExchangeFromParameters = CachingMethod(calculateExchangeFromParameters,
id = 'calculateExchangeFromParameters', cache_factory = 'erp5_ui_short') id = 'calculateExchangeFromParameters', cache_factory = 'erp5_ui_short')
result = calculateExchangeFromParameters(start_date=start_date, result = calculateExchangeFromParameters(start_date=start_date,
currency_exchange_type=currency_exchange_type, currency_exchange_type=currency_exchange_type,
...@@ -64,16 +64,16 @@ else: ...@@ -64,16 +64,16 @@ else:
if getattr(context,'isDelivery',None): if getattr(context,'isDelivery',None):
start_date = context.getStartDate() start_date = context.getStartDate()
mapped_value = context.portal_domains.generateMappedValue(object_, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=0, has_cell_content=0,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
discount = getattr(mapped_value, 'discount', None) discount = getattr(mapped_value, 'discount', None)
if base_price is None and discount is None: if base_price is None and discount is None:
mapped_value = context.portal_domains.generateMappedValue(object_, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=1, has_cell_content=1,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
discount = getattr(mapped_value, 'discount', None) discount = getattr(mapped_value, 'discount', None)
result = [base_price, discount] result = [base_price, discount]
......
...@@ -18,7 +18,7 @@ def getCurrencyItemList(include_empty=1, validation_state=validation_state): ...@@ -18,7 +18,7 @@ def getCurrencyItemList(include_empty=1, validation_state=validation_state):
# for currency, we intentionaly use reference (EUR) not title (Euros). # for currency, we intentionaly use reference (EUR) not title (Euros).
result.append((currency.getReference() or currency.getTitleOrId(), result.append((currency.getReference() or currency.getTitleOrId(),
currency.getRelativeUrl())) currency.getRelativeUrl()))
result.sort(key=lambda x: x[0]) result.sort(key=lambda x: x[0])
return result return result
...@@ -27,6 +27,6 @@ getCurrencyItemList = CachingMethod( ...@@ -27,6 +27,6 @@ getCurrencyItemList = CachingMethod(
getCurrencyItemList, getCurrencyItemList,
id='CurrencyModule_getCurrencyItemList', id='CurrencyModule_getCurrencyItemList',
cache_factory = 'erp5_ui_short') cache_factory = 'erp5_ui_short')
return getCurrencyItemList(include_empty=include_empty, return getCurrencyItemList(include_empty=include_empty,
validation_state=validation_state) validation_state=validation_state)
...@@ -86,7 +86,7 @@ def getPaymentConditionText(order): ...@@ -86,7 +86,7 @@ def getPaymentConditionText(order):
return translateString("${days} Days End of Month", mapping=dict(days=days)) return translateString("${days} Days End of Month", mapping=dict(days=days))
return translateString("${days} Days", mapping=dict(days=days)) return translateString("${days} Days", mapping=dict(days=days))
elif end_of_month: elif end_of_month:
return translateString("End of Month") return translateString("End of Month")
return getOrderedDate(order.getStartDate()) return getOrderedDate(order.getStartDate())
def getTaxLineList(order): def getTaxLineList(order):
...@@ -290,7 +290,7 @@ if context.getPortalType() in portal.getPortalOrderTypeList(): ...@@ -290,7 +290,7 @@ if context.getPortalType() in portal.getPortalOrderTypeList():
report_title = context.getSimulationState() == "draft" and "Draft Order" or "Order" report_title = context.getSimulationState() == "draft" and "Draft Order" or "Order"
else: else:
report_title = context.getSimulationState() == "draft" and "Draft Packing List" or "Packing List" report_title = context.getSimulationState() == "draft" and "Draft Packing List" or "Packing List"
data_dict = { data_dict = {
'report_title' : report_title, 'report_title' : report_title,
'source_section_title': source_section.getProperty('corporate_name') or\ 'source_section_title': source_section.getProperty('corporate_name') or\
...@@ -317,7 +317,7 @@ data_dict = { ...@@ -317,7 +317,7 @@ data_dict = {
'source_section_registeredcapital': getSocialCapital(getattr(source_section, 'getSocialCapital', None)\ 'source_section_registeredcapital': getSocialCapital(getattr(source_section, 'getSocialCapital', None)\
is not None and\ is not None and\
source_section.getSocialCapital() or ''), source_section.getSocialCapital() or ''),
'source_administration_title': \ 'source_administration_title': \
source_administration.getProperty('corporate_name') \ source_administration.getProperty('corporate_name') \
or source_administration.getTitle(), or source_administration.getTitle(),
...@@ -357,7 +357,7 @@ data_dict = { ...@@ -357,7 +357,7 @@ data_dict = {
and context.getSourceDecisionValue(portal_type='Organisation').getDefaultImageHeight() \ and context.getSourceDecisionValue(portal_type='Organisation').getDefaultImageHeight() \
* inch_cm_ratio or '', * inch_cm_ratio or '',
'source_decision_address':getOneLineAddress( 'source_decision_address':getOneLineAddress(
source_decision is not None and source_decision is not None and
source_decision.getDefaultAddressText() or '', source_decision.getDefaultAddressText() or '',
source_decision is not None and \ source_decision is not None and \
source_decision.getDefaultAddressRegionTitle() or ''), source_decision.getDefaultAddressRegionTitle() or ''),
......
...@@ -16,7 +16,7 @@ return 1 ...@@ -16,7 +16,7 @@ return 1
## from AccessControl import getSecurityManager ## from AccessControl import getSecurityManager
## user = getSecurityManager().getUser() ## user = getSecurityManager().getUser()
## role_list = user.getRolesInContext(context) ## role_list = user.getRolesInContext(context)
## ##
## # Users involved in the document may view it in editable mode ## # Users involved in the document may view it in editable mode
## if "Associate" in role_list or "Assignee" in role_list or\ ## if "Associate" in role_list or "Assignee" in role_list or\
## "Assignor" in role_list or "Manager" in role_list or "Owner" in role_list: ## "Assignor" in role_list or "Manager" in role_list or "Owner" in role_list:
...@@ -26,7 +26,7 @@ return 1 ...@@ -26,7 +26,7 @@ return 1
## if format is None: ## if format is None:
## return 0 ## return 0
## ##
## # All users with view permission may view the document ## # All users with view permission may view the document
## # in read only mode ## # in read only mode
## if format in ('html', 'stripped-html', 'text', 'txt', 'pdf', 'png', 'jpg', 'gif'): ## if format in ('html', 'stripped-html', 'text', 'txt', 'pdf', 'png', 'jpg', 'gif'):
## return 1 ## return 1
......
""" """
This script when triggered will migrate all embedded "File" and "Image" This script when triggered will migrate all embedded "File" and "Image"
objects to an unified "Embedded File". objects to an unified "Embedded File".
""" """
active_process = context.getPortalObject().portal_activities.newActiveProcess() active_process = context.getPortalObject().portal_activities.newActiveProcess()
......
...@@ -23,5 +23,5 @@ for base_category in base_category_list: ...@@ -23,5 +23,5 @@ for base_category in base_category_list:
# By returning a dict, we force force ERP5Type # By returning a dict, we force force ERP5Type
# to interprete the result as a mapping from # to interprete the result as a mapping from
# roles to existing security groups # roles to existing security groups
return category_dict return category_dict
...@@ -9,7 +9,7 @@ for career_step in all_career_step_list : ...@@ -9,7 +9,7 @@ for career_step in all_career_step_list :
career_step.getStartDate() and \ career_step.getStartDate() and \
career_step.getValidationState() not in ('cancelled', 'deleted'): career_step.getValidationState() not in ('cancelled', 'deleted'):
career_step_list.append(career_step) career_step_list.append(career_step)
# sort them by start date # sort them by start date
career_step_list.sort(key=lambda x: x.getStartDate()) career_step_list.sort(key=lambda x: x.getStartDate())
for career_step in career_step_list : for career_step in career_step_list :
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This way when a delivery movement is deleted, corresponding simulation movement This way when a delivery movement is deleted, corresponding simulation movement
will again be candidates for building in another delivery. will again be candidates for building in another delivery.
XXX: security (future) bug: this requires that the system is configured in a way where XXX: security (future) bug: this requires that the system is configured in a way where
simulation movement can be accessed in restrictred mode. For now this script has a proxy simulation movement can be accessed in restrictred mode. For now this script has a proxy
role, but someday we'll have to move this to unrestricted environment. role, but someday we'll have to move this to unrestricted environment.
""" """
......
...@@ -4,7 +4,7 @@ document = state_change['object'] ...@@ -4,7 +4,7 @@ document = state_change['object']
document.processFile() document.processFile()
if document.getMetaType() == 'ERP5 OOo Document': if document.getMetaType() == 'ERP5 OOo Document':
# XXX How to filter documents which are implementing base_convertable # XXX How to filter documents which are implementing base_convertable
# and not text_document # and not text_document
# Clear base_data # Clear base_data
document.setBaseData(None) document.setBaseData(None)
......
""" """
This script is called before a Role Definition object is about to be deleted. This script is called before a Role Definition object is about to be deleted.
It is responsible to trigger an activity (later not within this transaction) It is responsible to trigger an activity (later not within this transaction)
that will update security groups. that will update security groups.
""" """
role_definition_parent = state_change['object'].getParentValue() role_definition_parent = state_change['object'].getParentValue()
role_definition_parent.activate().updateLocalRolesOnSecurityGroups() role_definition_parent.activate().updateLocalRolesOnSecurityGroups()
...@@ -41,8 +41,8 @@ ${question} ...@@ -41,8 +41,8 @@ ${question}
Answer: Answer:
${answer} ${answer}
""" """
msg = translateString(msg, msg = translateString(msg,
mapping=dict(id=document.getId(), mapping=dict(id=document.getId(),
subject=subject, subject=subject,
user=user_value.getTitle(), user=user_value.getTitle(),
......
...@@ -56,7 +56,7 @@ class BudgetModel(Predicate): ...@@ -56,7 +56,7 @@ class BudgetModel(Predicate):
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCellRangeForBudgetLine') 'getCellRangeForBudgetLine')
def getCellRangeForBudgetLine(self, budget_line, matrixbox=0): def getCellRangeForBudgetLine(self, budget_line, matrixbox=0):
...@@ -162,7 +162,7 @@ class BudgetModel(Predicate): ...@@ -162,7 +162,7 @@ class BudgetModel(Predicate):
if key: if key:
cell_key += (key,) cell_key += (key,)
return cell_key return cell_key
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'asBudgetPredicate') 'asBudgetPredicate')
def asBudgetPredicate(self): def asBudgetPredicate(self):
......
...@@ -8,7 +8,7 @@ def makeContext(doc, **kw): ...@@ -8,7 +8,7 @@ def makeContext(doc, **kw):
if v: if v:
categories.append('%s/%s' % (k,v)) categories.append('%s/%s' % (k,v))
return doc.asContext(categories=categories) return doc.asContext(categories=categories)
financial_section = '' financial_section = ''
budget_section = '' budget_section = ''
group = '' group = ''
......
...@@ -2,7 +2,7 @@ budget = context.getParentValue() ...@@ -2,7 +2,7 @@ budget = context.getParentValue()
budget_model = budget.getSpecialiseValue(portal_type='Budget Model') budget_model = budget.getSpecialiseValue(portal_type='Budget Model')
if budget_model is None: if budget_model is None:
return [] return []
if base_id == 'cell': if base_id == 'cell':
return budget_model.getCellRangeForBudgetLine(context, matrixbox=matrixbox) return budget_model.getCellRangeForBudgetLine(context, matrixbox=matrixbox)
if base_id in ('engaged', 'available'): if base_id in ('engaged', 'available'):
......
...@@ -33,7 +33,7 @@ else: ...@@ -33,7 +33,7 @@ else:
budget = budget.getObject() budget = budget.getObject()
if budget.isMemberOf(defined_group, strict_membership=strict_section_membership): if budget.isMemberOf(defined_group, strict_membership=strict_section_membership):
group_filtered_budget_list.append(budget) group_filtered_budget_list.append(budget)
if from_date or at_date: if from_date or at_date:
for budget in group_filtered_budget_list: for budget in group_filtered_budget_list:
if from_date and budget.getStartDateRangeMax() < from_date: if from_date and budget.getStartDateRangeMax() < from_date:
...@@ -87,7 +87,7 @@ for budget in budget_list: ...@@ -87,7 +87,7 @@ for budget in budget_list:
budget.getStartDateRangeMin())) budget.getStartDateRangeMin()))
if not conversion_ratio: if not conversion_ratio:
conversion_ratio = 1 conversion_ratio = 1
line_list.append(dict(is_budget=True, line_list.append(dict(is_budget=True,
title=budget.getTitle().decode('utf8'), title=budget.getTitle().decode('utf8'),
target_currency_title=target_currency_title, target_currency_title=target_currency_title,
...@@ -105,7 +105,7 @@ for budget in budget_list: ...@@ -105,7 +105,7 @@ for budget in budget_list:
total_level_1_engaged_budget = 0 total_level_1_engaged_budget = 0
total_level_1_consumed_budget = 0 total_level_1_consumed_budget = 0
total_level_1_available_budget = 0 total_level_1_available_budget = 0
level_1_line_list = [] level_1_line_list = []
if at_date and from_date: if at_date and from_date:
...@@ -127,7 +127,7 @@ for budget in budget_list: ...@@ -127,7 +127,7 @@ for budget in budget_list:
budget_line_cell_range = budget_line.BudgetLine_asCellRange('engaged') budget_line_cell_range = budget_line.BudgetLine_asCellRange('engaged')
budget_line_as_cell_range_matrixbox =\ budget_line_as_cell_range_matrixbox =\
budget_line.BudgetLine_asCellRange('engaged', matrixbox=1) budget_line.BudgetLine_asCellRange('engaged', matrixbox=1)
dependant_dimension_dict = budget_line.BudgetLine_getSummaryDimensionKeyDict() dependant_dimension_dict = budget_line.BudgetLine_getSummaryDimensionKeyDict()
if len(budget_line_cell_range) == 0: if len(budget_line_cell_range) == 0:
...@@ -214,7 +214,7 @@ for budget in budget_list: ...@@ -214,7 +214,7 @@ for budget in budget_list:
cell_key = (level_3_category, level_2_category) cell_key = (level_3_category, level_2_category)
else: else:
cell_key = (level_4_category, level_3_category, level_2_category) cell_key = (level_4_category, level_3_category, level_2_category)
if not isVisibleCell(cell_key): if not isVisibleCell(cell_key):
continue continue
...@@ -240,7 +240,7 @@ for budget in budget_list: ...@@ -240,7 +240,7 @@ for budget in budget_list:
current_budget = initial_budget #cell.getCurrentBalance() * sign current_budget = initial_budget #cell.getCurrentBalance() * sign
# XXX stupid optimisation that may not always be true: # XXX stupid optimisation that may not always be true:
# if there's no engaged budget, there's no consumed budget # if there's no engaged budget, there's no consumed budget
if engaged_budget: if engaged_budget:
# XXX calculate manually getAvailableBudget, because it calls # XXX calculate manually getAvailableBudget, because it calls
...@@ -249,7 +249,7 @@ for budget in budget_list: ...@@ -249,7 +249,7 @@ for budget in budget_list:
available_budget = (current_budget or 0) - engaged_budget available_budget = (current_budget or 0) - engaged_budget
else: else:
available_budget = current_budget available_budget = current_budget
if initial_budget: if initial_budget:
total_level_3_initial_budget += initial_budget total_level_3_initial_budget += initial_budget
if current_budget: if current_budget:
...@@ -331,7 +331,7 @@ for budget in budget_list: ...@@ -331,7 +331,7 @@ for budget in budget_list:
available_budget=total_level_1_available_budget, available_budget=total_level_1_available_budget,
consumed_ratio=consumed_ratio)) consumed_ratio=consumed_ratio))
line_list.extend(level_1_line_list) line_list.extend(level_1_line_list)
line_count = 0 line_count = 0
for line in line_list: for line in line_list:
if same_type(line, []): if same_type(line, []):
......
...@@ -184,7 +184,7 @@ class PresencePeriod(Movement, PeriodicityMixin): ...@@ -184,7 +184,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
# We use 366*28 below, because gregorian calendar repeat itself every 28 years, so we # We use 366*28 below, because gregorian calendar repeat itself every 28 years, so we
# don't need to loop more than this if we don't find a date, because it might be an # don't need to loop more than this if we don't find a date, because it might be an
# impossible combination of week and month (eg. week number 30 can not be in January) # impossible combination of week and month (eg. week number 30 can not be in January)
for _ in range(366 * 28): for _ in range(366 * 28):
if (self._validateDay(next_start_date)) and \ if (self._validateDay(next_start_date)) and \
(self._validateWeek(next_start_date)) and \ (self._validateWeek(next_start_date)) and \
......
...@@ -18,11 +18,11 @@ for person in sorted( ...@@ -18,11 +18,11 @@ for person in sorted(
key=display_method): key=display_method):
domain = parent.generateTempDomain(id=person.getId()) domain = parent.generateTempDomain(id=person.getId())
domain.edit(title = display_method(person), domain.edit(title = display_method(person),
membership_criterion_base_category = ('source', 'destination'), membership_criterion_base_category = ('source', 'destination'),
membership_criterion_category = (person.getRelativeUrl(),), membership_criterion_category = (person.getRelativeUrl(),),
domain_generator_method_id = script.id, domain_generator_method_id = script.id,
uid = person.getUid()) uid = person.getUid())
domain_list.append(domain) domain_list.append(domain)
return domain_list return domain_list
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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