Commit 2f143d52 authored by Jérome Perrin's avatar Jérome Perrin

invoicing: fix pylint messages and enable coding style test

parent 680fdcf9
...@@ -4,12 +4,12 @@ if resource is not None: ...@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1) base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # 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(base_category_list = (base_category,) ) ) ) cell_range.append([(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list=(base_category,))])
else: else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) ) cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range ) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
"""This script is called on the Invoice after the delivery builder has created """This script is called on the Invoice after the delivery builder has created
the new Invoice. the new Invoice.
""" """
from Products.ERP5Type.Message import translateString
if related_simulation_movement_path_list is None: if related_simulation_movement_path_list is None:
raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.' raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.'
......
...@@ -24,4 +24,4 @@ for movement in movement_list: ...@@ -24,4 +24,4 @@ for movement in movement_list:
if line is not None: if line is not None:
deliveries_keys[line.getExplanationValue()] = 1 deliveries_keys[line.getExplanationValue()] = 1
return filter(lambda x : x is not None, deliveries_keys.keys()) return [x for x in deliveries_keys.keys() if x is not None]
...@@ -17,14 +17,8 @@ def recursiveCopyLine(to_document, from_document): ...@@ -17,14 +17,8 @@ def recursiveCopyLine(to_document, from_document):
recursiveCopyLine(reverse_line, line) recursiveCopyLine(reverse_line, line)
newCell = reverse_line.newContent newCell = reverse_line.newContent
for cell in line.objectValues(portal_type='Invoice Cell'): for cell in line.objectValues(portal_type='Invoice Cell'):
raise NotImplementedError raise NotImplementedError("NotImplemented: Should do something with %s and %s" % (cell, newCell))
newCell(
# TODO: what properties ?
portal_type=cell.getPortalType(),
category_list=cell.getCategoryList(),
)
portal = context.getPortalObject()
reverse_invoice = context.getParentValue().newContent( reverse_invoice = context.getParentValue().newContent(
portal_type=context.getPortalType(), portal_type=context.getPortalType(),
created_by_builder=1, # tell init script to not create lines created_by_builder=1, # tell init script to not create lines
......
...@@ -7,7 +7,7 @@ def getSourceReference(line): ...@@ -7,7 +7,7 @@ def getSourceReference(line):
for predicate in predicate_list: for predicate in predicate_list:
source_reference = predicate.getSourceReference() source_reference = predicate.getSourceReference()
if source_reference: if source_reference:
return source_reference return source_reference
return '' return ''
def getDestinationReference(line): def getDestinationReference(line):
...@@ -19,7 +19,7 @@ def getDestinationReference(line): ...@@ -19,7 +19,7 @@ def getDestinationReference(line):
for predicate in predicate_list: for predicate in predicate_list:
destination_reference = predicate.getDestinationReference() destination_reference = predicate.getDestinationReference()
if destination_reference: if destination_reference:
return destination_reference return destination_reference
return '' return ''
#if context.getPortalType() in context.getPortalSaleTypeList(): #if context.getPortalType() in context.getPortalSaleTypeList():
......
...@@ -2,5 +2,7 @@ ...@@ -2,5 +2,7 @@
If the business template 'erp5_advanced_invoicing' is installed, returns True. If the business template 'erp5_advanced_invoicing' is installed, returns True.
If it is not, returns False. If it is not, returns False.
""" """
business_template_list = context.portal_templates.getInstalledBusinessTemplateList() for bt in context.portal_templates.getInstalledBusinessTemplateList():
return filter(lambda x: x.getTitle() == "erp5_advanced_invoicing", business_template_list, False) if bt.getTitle() == "erp5_advanced_invoicing":
return True
return False
# This script uses format= argument
# pylint: disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
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