Commit 65d39fde authored by Jérome Perrin's avatar Jérome Perrin

accounting: fix python code warnings

parent 74d8b5f7
......@@ -609,7 +609,7 @@ for key, data in line_per_account.iteritems():
if expand_accounts and mirror_section_uid is not MARKER:
mirror_section_title = getObject(mirror_section_uid).getTitle()
else:
mirror_section_title = None
mirror_section_title = None
node_uid, node_title, node_id, node_string_index, node = getNodeTitleAndId(node_relative_url)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None, ledger=None, group_analytic=[], mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw</string> </value>
<value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None, ledger=None, group_analytic=(), mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -7,7 +7,6 @@ item_list = [('', '')]
countries = context.portal_categories.gap.objectValues()
for country in countries :
for gap in country.objectValues() :
title = country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()
path = gap.getRelativeUrl()
item_list.append(
((country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()),
......
......@@ -11,7 +11,7 @@ transaction_simulation_state = request['transaction_simulation_state']
from_date = request.get('from_date', None)
result = []
params = {
params = {
'to_date' : to_date,
'section_category' : transaction_section_category,
'simulation_state' : transaction_simulation_state,
......@@ -19,36 +19,36 @@ params = {
'report_depth' : 5
}
if from_date:
params['from_date'] = from_date
if from_date:
params['from_date'] = from_date
groupCategory = context.portal_categories.restrictedTraverse(transaction_section_category)
entities = groupCategory.getGroupRelatedValueList(portal_type = ('Organisation', 'Person'))
entity_columns = ( ('title', 'Title'),
entity_columns = ( ('title', 'Title'),
('getStopDate', 'Date'),
('reference', 'Invoice No'),
('getDestinationSectionTitle', 'Third Party'),
('source_reference', 'Reference'),
('reference', 'Invoice No'),
('getDestinationSectionTitle', 'Third Party'),
('source_reference', 'Reference'),
('simulation_state', 'State'),
('source_debit', 'Debit'),
('source_credit', 'Credit'),
('source_balance', 'Balance'),
)
)
for entity in entities :
result.append( ReportSection(path=context.getPhysicalPath(),
result.append( ReportSection(path=context.getPhysicalPath(),
title='Bank accounts for %s'%entity.getTitle(),
level=1,
form_id=None) )
for bank in entity.searchFolder(portal_type='Bank Account'):
o = bank.getObject()
o = bank.getObject()
result.append(
ReportSection(title='%s (%s)'%(o.getTitle(), entity.getTitle()),
level=2,
path=o.getPhysicalPath(),
path=o.getPhysicalPath(),
form_id='BankAccount_viewAccountingTransactionList',
## XXX Here we must use accounting_selection, because stat scripts read this selection
## XXX Here we must use accounting_selection, because stat scripts read this selection
selection_name = 'accounting_selection',
selection_params = params,
selection_columns = entity_columns
......
......@@ -17,10 +17,10 @@ if request.get('account_id_list_conversion_script_id'):
else:
kw['node_category'] = account_id_list
sum = 0.0
sum_ = 0.0
for inventory in portal.portal_simulation.getInventoryList(
group_by_node=1,
**kw):
if inventory.total_price < 0:
sum += (inventory.total_price or 0)
return sum
sum_ += (inventory.total_price or 0)
return sum_
......@@ -17,11 +17,11 @@ if request.get('account_id_list_conversion_script_id'):
else:
kw['node_category'] = account_id_list
sum = 0.0
sum_ = 0.0
for inventory in portal.portal_simulation.getInventoryList(
group_by_payment=1,
group_by_node=1,
**kw):
if inventory.total_price < 0:
sum += (inventory.total_price or 0)
return sum
sum_ += (inventory.total_price or 0)
return sum_
......@@ -17,10 +17,10 @@ if request.get('account_id_list_conversion_script_id'):
else:
kw['node_category'] = account_id_list
sum = 0.0
sum_ = 0.0
for inventory in portal.portal_simulation.getInventoryList(
group_by_node=1,
**kw):
if inventory.total_price > 0:
sum += inventory.total_price
return sum
sum_ += inventory.total_price
return sum_
......@@ -17,11 +17,11 @@ if request.get('account_id_list_conversion_script_id'):
else:
kw['node_category'] = account_id_list
sum = 0.0
sum_ = 0.0
for inventory in portal.portal_simulation.getInventoryList(
group_by_payment=1,
group_by_node=1,
**kw):
if inventory.total_price > 0:
sum += inventory.total_price
return sum
sum_ += inventory.total_price
return sum_
index = context.portal_selections.getSelectionIndexFor(selection_name)
object = brain.getObject()
object = object.getDestinationValue()
if object is None:
url = None
else:
url = object.absolute_url() + '/view?selection_index=%s&amp;selection_name=%s&amp;reset=1' % (index, selection_name)
return url
account = brain.getObject()
account = account.getDestinationValue()
if account is not None:
return '%s/view?selection_index=%s&amp;selection_name=%s&amp;reset=1' % (
account.absolute_url(), index, selection_name)
......@@ -2,16 +2,16 @@ from ZTUtils import make_query
from Products.PythonScripts.standard import html_quote
index = context.portal_selections.getSelectionIndexFor(selection_name)
object = brain.getObject()
account = brain.getObject()
# this is for domain_tree mode
if object.getPortalType() == "Category" :
return "#"
if account.getPortalType() == "Category":
return "#"
method = 'Account_viewAccountingTransactionList'
kw = { 'selection_index': str(index),
'selection_name' : selection_name,
'reset' : '1',
'selection_name' : selection_name,
'reset' : '1',
}
return html_quote('%s/%s?%s' % (object.absolute_url(), method, make_query(kw)))
return html_quote('%s/Account_viewAccountingTransactionList?%s' % (
account.absolute_url(), make_query(kw)))
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None, sort_on=[], node_category=None, node_category_strict_membership=None, from_date=None, selection_name=None, function=None, project_uid=None, analytic_column_list=(), **kw</string> </value>
<value> <string>selection=None, sort_on=(), node_category=None, node_category_strict_membership=None, from_date=None, selection_name=None, function=None, project_uid=None, analytic_column_list=(), **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
portal = context.getPortalObject()
Base_translateString = portal.Base_translateString
split_depth = 2
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
def getSubFieldDict():
def getSubFieldDictCache():
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</string> </value>
<value> <string>item_list, value_list, default_sub_field_property_dict=None, is_right_display=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
try:
from zExceptions import Redirect
except:
Redirect = 'Redirect'
from zExceptions import Redirect
portal = context.getPortalObject()
stool = portal.portal_selections
getObject = portal.portal_catalog.getObject
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>node, payment_mode, payment, selection_index=None, uids=[], listbox_uid=[],selection_name=\'\', **kw</string> </value>
<value> <string>node, payment_mode, payment, selection_index=None, uids=(), listbox_uid=(),selection_name=\'\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
try:
from zExceptions import Redirect
except:
Redirect = 'Redirect'
from zExceptions import Redirect
portal = context.getPortalObject()
stool = portal.portal_selections
getObject = portal.portal_catalog.getObject
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>cancellation_amount=False, date=None, plan=False, uids=[], listbox_uid=[], selection_name=\'\', form_id=\'view\', **kw</string> </value>
<value> <string>cancellation_amount=False, date=None, plan=False, uids=(), listbox_uid=(), selection_name=\'\', form_id=\'view\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Form.Report import ReportSection
portal = context.getPortalObject()
request = container.REQUEST
selection_columns = (
('title', 'Title',),
......@@ -20,7 +18,7 @@ selection_columns = (
('mirror_payment_title', 'Third Party Bank Account',),
('mirror_section_region_title', 'Third Party Region',),
('function_reference',
'%s Reference' % context.AccountingTransactionLine_getFunctionBaseCategoryTitle()),
'%s Reference' % context.AccountingTransactionLine_getFunctionBaseCategoryTitle()),
('function_title',
context.AccountingTransactionLine_getFunctionBaseCategoryTitle()),
('funding_reference', 'Funding Reference',),
......
from Products.ERP5Type.Message import translateString
from Products.ERP5Form.Report import ReportSection
portal = context.getPortalObject()
request = container.REQUEST
section_category = request['section_category']
section_category_strict = request['section_category_strict']
......@@ -55,7 +54,7 @@ ledger = request.get('ledger', None)
if ledger:
selection_params['ledger'] = ledger
return [ReportSection(form_id=(detailed and
return [ReportSection(form_id=(detailed and
'AccountingTransactionModule_viewDetailedAgedBalanceReportSection' or
'AccountingTransactionModule_viewSummaryAgedBalanceReportSection'),
path=context.getPhysicalPath(),
......
......@@ -111,7 +111,7 @@ for brain in portal.portal_simulation.getMovementHistoryList(
debit=debit,
credit=credit,)
analytic_info = {}
for analytic_column, analytic_column_title in analytic_column_list:
for analytic_column, analytic_column_title in analytic_column_list: # pylint: disable=unused-variable
if analytic_column == 'project':
analytic_info['project'] = brain.Movement_getProjectTitle()
elif analytic_column == 'funding':
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection, at_date, from_date, portal_type, simulation_state, section_uid, payment_mode=None, payment=None, gap_root=None, group_by=None, analytic_column_list=[], project_uid=None, ledger_uid=None, **kw</string> </value>
<value> <string>selection, at_date, from_date, portal_type, simulation_state, section_uid, payment_mode=None, payment=None, gap_root=None, group_by=None, analytic_column_list=(), project_uid=None, ledger_uid=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.PythonScripts.standard import Object
request = container.REQUEST
portal = context.getPortalObject()
return [ Object(
debit=request.get(
......
......@@ -8,7 +8,7 @@ detail_line_list = portal\
simulation_state, period_list, account_type, detail=False, **kw)
period_id_list = ['period_future']
for idx, period in enumerate(period_list):
for idx, _ in enumerate(period_list):
period_id_list.append('period_%s' % idx)
period_id_list.append('period_%s' % (idx + 1))
......
......@@ -2,8 +2,6 @@ from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery, ComplexQuery
request = container.REQUEST
portal = context.getPortalObject()
ctool = portal.portal_catalog
stool = portal.portal_simulation
# we use a different selection for dialog params, because we never want this
# selection to be reseteted
......@@ -77,7 +75,7 @@ if debit_price:
if credit_price:
try:
search_kw['stock.total_price'] = - float(credit_price['query'])
except ValueError, e:
except ValueError:
# happens when user entered a complex query (like "> 100 AND < 200")
# in that case, there is not much we can do.
search_kw['stock.total_price'] = credit_price['query']
......@@ -85,7 +83,7 @@ if date:
search_kw['stock.date'] = date
return stool.getMovementHistoryList(
return portal.portal_simulation.getMovementHistoryList(
section_uid=section_uid,
simulation_state=['stopped', 'delivered'],
sort_on=sort_on,
......
"""Set grouping reference for selected lines.
Used as a fast input dialog action.
"""
from ZTUtils import make_query
from ZODB.POSException import ConflictError
from Products.CMFCore.WorkflowCore import WorkflowException
portal = context.getPortalObject()
getobject = portal.portal_catalog.getobject
stool = portal.portal_selections
Base_translateString = portal.Base_translateString
psm = Base_translateString('Nothing matches.')
request = container.REQUEST
precision = request.get('precision', 2)
# update selected uids
stool.updateSelectionCheckedUidList(
portal.portal_selections.updateSelectionCheckedUidList(
list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)
uids = stool.getSelectionCheckedUidsFor(list_selection_name)
uids = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name)
# XXX when should it be validated ?
if node == '':
......@@ -59,7 +56,7 @@ if grouping == 'grouping':
mapping=dict(grouped_line_count=len(grouped_line_list)))
# make sure nothing will be checked next time
stool.setSelectionCheckedUidsFor(list_selection_name, [])
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
# we check if we can mark some transaction as payed.
transaction_list = {}
......@@ -103,9 +100,7 @@ if grouping == 'grouping':
try:
portal.portal_workflow.doActionFor(transaction, 'clear_action',
payment_date=date)
except ConflictError:
raise
except:
except WorkflowException:
# Workflow action not supported
pass
......@@ -119,12 +114,12 @@ else:
for line in line_list:
if line.getGroupingReference():
ungrouped_line_list.extend(line.AccountingTransactionLine_resetGroupingReference())
psm = Base_translateString('${ungrouped_line_count} lines ungrouped.',
mapping=dict(ungrouped_line_count=len(ungrouped_line_list)))
# make sure nothing will be checked next time
stool.setSelectionCheckedUidsFor(list_selection_name, [])
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
request.set('portal_status_message', psm)
return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>uids=[], listbox=None, listbox_uid=[], list_selection_name=\'\', grouping=\'\', node=\'\', mirror_section=\'\', update=0, **kw</string> </value>
<value> <string>uids=(), listbox=None, listbox_uid=(), list_selection_name=\'\', grouping=\'\', node=\'\', mirror_section=\'\', update=0, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>uids=[], listbox=None, listbox_uid=[], list_selection_name=\'\', node=\'\', mirror_section=\'\', cancel_url=\'\', **kw</string> </value>
<value> <string>uids=(), listbox=None, listbox_uid=(), list_selection_name=\'\', node=\'\', mirror_section=\'\', cancel_url=\'\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -5,7 +5,7 @@ use.
from Products.ERP5Type.Message import translateString
request = container.REQUEST
for i in range(line_count):
for _ in range(line_count):
context.newContent(portal_type=line_portal_type)
request.set('portal_status_message',
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>portal_type=[], **kw</string> </value>
<value> <string>portal_type=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -3,12 +3,12 @@ section_value = context.getDestinationSectionValue()
if section_value is None or \
section_value.getProperty('price_currency', None) is None:
# If no section defined, no way to convert currencies
return 0
return False
transaction_currency = context.getResource()
if transaction_currency is not None and\
transaction_currency != section_value.getProperty('price_currency', None):
return 1
return True
for line in context.getMovementList(
portal_type=context.getPortalAccountingMovementTypeList()):
......@@ -16,6 +16,6 @@ for line in context.getMovementList(
line.getDestinationInventoriatedTotalAssetCredit()) or (
line.getDestinationDebit() !=
line.getDestinationInventoriatedTotalAssetDebit())):
return 1
return True
return 0
return False
......@@ -3,12 +3,12 @@ section_value = context.getSourceSectionValue()
if section_value is None or \
section_value.getProperty('price_currency', None) is None:
# If no section defined, no way to convert currencies
return 0
return False
transaction_currency = context.getResource()
if transaction_currency is not None and\
transaction_currency != section_value.getProperty('price_currency', None):
return 1
return True
for line in context.getMovementList(
portal_type=context.getPortalAccountingMovementTypeList()):
......@@ -16,6 +16,6 @@ for line in context.getMovementList(
line.getSourceInventoriatedTotalAssetCredit()) or (
line.getSourceDebit() !=
line.getSourceInventoriatedTotalAssetDebit())):
return 1
return True
return 0
return False
......@@ -38,13 +38,12 @@ def splitCsvLine(str_line):
return clean_list
def getSubCategory(parent, id):
def getSubCategory(parent, category_id):
try:
return parent[id]
return parent[category_id]
except KeyError:
return parent.newContent(id=id)
return parent.newContent(id=category_id)
request = context.REQUEST
csv_file_line_list = import_file.readlines()
csv_line_list = []
......@@ -54,18 +53,16 @@ for csv_line in csv_file_line_list:
object_list = []
csv_property_list = splitCsvLine(csv_line_list[0])
csv_title_list = splitCsvLine(csv_line_list[1])
for csv_line in csv_line_list[2:]:
object = {}
property_dict = {}
csv_data_list = splitCsvLine(csv_line)
data_n = 0
for property in csv_property_list:
object[property] = csv_data_list[data_n]
for property_ in csv_property_list:
property_dict[property_] = csv_data_list[data_n]
data_n += 1
object_list.append(object)
object_list.append(property_dict)
root = context.getPortalObject().portal_categories
for path in gap_root_path.split('/'):
......@@ -74,10 +71,10 @@ for path in gap_root_path.split('/'):
existing_path_list = recursiveDocumentList(root)
existing_path_list.remove(root.getPath())
for object in object_list:
description = object.get('Description', None) or ''
gap = object.get('Gap', None) or ''
title = object.get('Title', None) or ''
for property_dict in object_list:
description = property_dict.get('Description', None) or ''
gap = property_dict.get('Gap', None) or ''
title = property_dict.get('Title', None) or ''
gap = str(gap)
if gap:
gap = gap.replace('CLASSE ', '')
......@@ -95,11 +92,11 @@ for object in object_list:
existing_path_list.sort(key=len, reverse=True)
for path in existing_path_list:
object = context.restrictedTraverse(path)
description = object.getDescription() or ''
gap = object.getId() or ''
title = object.getTitle() or ''
document = context.restrictedTraverse(path)
description = document.getDescription() or ''
gap = document.getId() or ''
title = document.getTitle() or ''
print '- %s - %s - %s' % (gap or '', title or '', description or '')
object.getParentValue().deleteContent(object.getId())
document.getParentValue().deleteContent(document.getId())
return printed
......@@ -11,8 +11,6 @@ if person is None:
from DateTime import DateTime
now = DateTime()
destination_group = section_group = None
assigned_group_set = set() # groups on which the user is assigned
for assignment in person.contentValues(portal_type='Assignment'):
if assignment.getGroup() \
......
......@@ -10,7 +10,6 @@ Base_translateString = context.Base_translateString
if date is None:
date = DateTime()
portal = context.getPortalObject()
payment_dict = {}
is_source = context.AccountingTransaction_isSourceView()
line_portal_type = 'Accounting Transaction Line'
......@@ -58,12 +57,10 @@ related_payment = portal.accounting_module.newContent(
if is_source:
related_payment.edit(destination_payment=context.getDestinationPayment(),
source_payment=payment)
section = context.getSourceSection()
mirror_section = context.getDestinationSection()
else:
related_payment.edit(destination_payment=payment,
source_payment=context.getSourcePayment())
section = context.getDestinationSection()
mirror_section = context.getSourceSection()
bank = related_payment.newContent(
......@@ -77,30 +74,29 @@ for (line_node, line_mirror_section), quantity in\
if line_mirror_section == mirror_section:
bank_quantity += quantity
if is_source:
line = related_payment.newContent(
related_payment.newContent(
portal_type=line_portal_type,
source=line_node,
quantity=quantity)
else:
line = related_payment.newContent(
related_payment.newContent(
portal_type=line_portal_type,
destination=line_node,
quantity=-quantity)
if is_source:
bank.edit( source=node,
quantity=-bank_quantity )
bank.setSource(node)
bank.setQuantity(-bank_quantity)
else:
bank.edit( destination=node,
quantity=bank_quantity )
bank.setDestination(node)
bank.setQuantity(bank_quantity)
if plan:
related_payment.plan()
if not batch_mode:
return context.REQUEST.RESPONSE.redirect(
"%s/view?portal_status_message=%s" % (
related_payment.absolute_url(),
Base_translateString('Related payment created.')))
else:
return related_payment
return related_payment.Base_redirect(
'view',
keep_items={'portal_status_message': Base_translateString('Related payment created.')})
return related_payment
......@@ -59,7 +59,7 @@ def getIsSourceMovementItemList(invoice):
btt_is_source = btt.AccountingTransaction_isSourceView()
for btt_movement in btt.getMovementList(
portal_type=portal.getPortalAccountingMovementTypeList()):
movement_item_list.append((btt_is_source, btt_movement))
movement_item_list.append((btt_is_source, btt_movement))
return movement_item_list
......@@ -71,7 +71,6 @@ for is_source, line in getIsSourceMovementItemList(context):
if is_source:
node_value = line.getSourceValue(portal_type='Account')
line_section = line.getSourceSection()
mirror_section = line.getDestinationSection()
if quantity:
amount = -line.getQuantity()
......@@ -79,7 +78,6 @@ for is_source, line in getIsSourceMovementItemList(context):
amount = line.getSourceInventoriatedTotalAssetPrice() or 0
else:
node_value = line.getDestinationValue(portal_type='Account')
line_section = line.getDestinationSection()
mirror_section = line.getSourceSection()
if quantity:
amount = line.getQuantity()
......@@ -88,7 +86,7 @@ for is_source, line in getIsSourceMovementItemList(context):
if at_date is None and line.getGroupingReference():
continue
if node_value is not None:
if account_id is not None and node_value.getId() not in account_id:
continue
......@@ -110,7 +108,7 @@ for related_transaction in related_transaction_list:
continue
if related_transaction.getProperty('origin_id') == 'MAJO':
continue
# if we have a payment related to multiple invoices, we cannot say the
# remaining price on those invoices.
for other_invoice in [ tr for tr in related_transaction.getCausalityValueList(
......@@ -128,18 +126,18 @@ for related_transaction in related_transaction_list:
else:
other_invoice_line_account = other_line.getDestinationValue()
other_invoice_line_mirror_section = other_line.getSourceSection()
if other_invoice_line_account in accounts_in_context:
# unless this line is for another mirror_section, we cannot calculate
if mirror_section_relative_url is None or \
other_invoice_line_mirror_section == mirror_section_relative_url:
raise ValueError('Unable to calculate %s' % context.getPath())
related_transaction_is_source = related_transaction.\
AccountingTransaction_isSourceView()
for line in related_transaction.getMovementList(
portal_type=portal.getPortalAccountingMovementTypeList()):
if at_date is None and line.getGroupingReference():
continue
......@@ -148,10 +146,9 @@ for related_transaction in related_transaction_list:
raise ValueError("Unable to calculate"
", related transaction %s uses different currency" %
line.getRelativeUrl())
if related_transaction_is_source:
node_value = line.getSourceValue(portal_type='Account')
line_section = line.getSourceSection()
mirror_section = line.getDestinationSection()
if quantity:
amount = -line.getQuantity()
......@@ -160,14 +157,13 @@ for related_transaction in related_transaction_list:
date = line.getStartDate().earliestTime()
else:
node_value = line.getDestinationValue(portal_type='Account')
line_section = line.getDestinationSection()
mirror_section = line.getSourceSection()
if quantity:
amount = line.getQuantity()
else:
amount = line.getDestinationInventoriatedTotalAssetPrice() or 0
date = line.getStopDate().earliestTime()
if node_value is not None:
if account_id is not None and node_value.getId() not in account_id:
continue
......@@ -185,7 +181,7 @@ if detailed:
else:
if mirror_section_relative_url:
total_amount = 0
for (node, mirror_section), amount in total_payable_price_per_node_section.items():
for (node, mirror_section), amount in total_payable_price_per_node_section.items(): # pylint: disable=unused-variable
if mirror_section == mirror_section_relative_url:
total_amount += amount
return total_amount
......
......@@ -10,7 +10,7 @@ else:
analytic_property_list = [explanation.getReference()]
for property_name, property_title in request['analytic_column_list']:
for property_name, property_title in request['analytic_column_list']: #pylint: disable=unused-variable
# XXX it would be a little better to reuse editable field
if property_name == 'project':
analytic_property_list.append(brain.Movement_getProjectTitle())
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None, sort_on=[], node_category=None, node_category_strict_membership=None, mirror_section_category=None, from_date=None, selection_name=None, src__=0, **kw</string> </value>
<value> <string>selection=None, sort_on=(), node_category=None, node_category_strict_membership=None, mirror_section_category=None, from_date=None, selection_name=None, src__=0, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ZSQLCatalog.SQLCatalog import Query, SimpleQuery, ComplexQuery
from Products.ZSQLCatalog.SQLCatalog import Query
portal = context.getPortalObject()
params = portal.ERP5Site_getAccountingSelectionParameterDict(selection_name=selection_name)
......
......@@ -2,7 +2,6 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Message import translateString
closing_period = state_change['object']
portal = closing_period.getPortalObject()
valid_state_list = ['started', 'stopped', 'delivered']
closing_period.Base_checkConsistency()
......@@ -25,7 +24,7 @@ for period in period_list:
raise ValidationFailed, translateString(
"${date} is already in an open accounting period.",
mapping={'date': start_date})
if len(period_list) > 1:
last_period = period_list[-1].getObject()
if last_period.getId() == closing_period.getId():
......
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