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