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

trade: fix pylint messages and enable coding style test

parent 7fa83bf4
......@@ -454,7 +454,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return filter(lambda x:self.isTradeStateCompleted(explanation, x), self.getTradeStateList())
return [x for x in self.getTradeStateList() if self.isTradeStateCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradeStateList')
def getPartiallyCompletedTradeStateList(self, explanation):
......@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return filter(lambda x:self.isTradeStatePartiallyCompleted(explanation, x), self.getTradeStateList())
return [x for x in self.getTradeStateList() if self.isTradeStatePartiallyCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getLatestCompletedTradeStateList')
def getLatestCompletedTradeStateList(self, explanation):
......@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return filter(lambda x:self.isTradePhaseCompleted(explanation, x), self.getTradePhaseList())
return [x for x in self.getTradePhaseList() if self.isTradePhaseCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradePhaseList')
def getPartiallyCompletedTradePhaseList(self, explanation):
......@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return filter(lambda x:self.isTradePhasePartiallyCompleted(explanation, x), self.getTradePhaseList())
return [x for x in self.getTradePhaseList() if self.isTradePhasePartiallyCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'isTradePhaseCompleted')
def isTradePhaseCompleted(self, explanation, trade_phase):
......@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject):
kw = self._getPropertyAndCategoryDict(explanation, amount, trade_model_path, delay_mode=delay_mode)
trade_phase = filter_trade_phase(trade_model_path.getTradePhaseList())
try:
kw['trade_phase'], = trade_phase
kw['trade_phase'], = trade_phase # pylint: disable=unpacking-non-sequence
except ValueError:
pass
kw.update(update_property_dict)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>BusinessProcess</string> </value>
......@@ -43,13 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:457, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:467, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:551, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:561, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:697, 8: Attempting to unpack a non-sequence defined at line 655 (unpacking-non-sequence)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -59,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -78,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -87,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -26,7 +26,6 @@
##############################################################################
from Products.ERP5Type.mixin.constraint import ConstraintMixin
from zLOG import LOG
class DuplicateInventoryConstraint(ConstraintMixin):
"""
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>DuplicateInventoryConstraint</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.DuplicateInventoryConstraint</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,53 +98,30 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1377844470.45</float>
<string>GMT+9</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -178,9 +178,17 @@ class TradeModelPath(Path):
result[base_category] = category_url_list
return result
def _filterCategoryList(self, category_list, category, spec=(),
filter=None, portal_type=(), base=0,
keep_default=1, checked_permission=None):
def _filterCategoryList(
self,
category_list,
category,
spec=(),
filter=None, # pylint: disable=redefined-builtin
portal_type=(),
base=0,
keep_default=1,
checked_permission=None,
):
"""
XXX - implementation missing
TBD - look at CategoryTool._buildFilter for inspiration
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TradeModelPath</string> </value>
......@@ -43,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:182, 26: Redefining built-in \'filter\' (redefined-builtin)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -19,18 +19,18 @@ for brain in getattr(context.portal_simulation, inventory_list_method_dict[simul
**kw):
if positive_stock and negative_stock and not zero_stock and brain.inventory == 0:
result_list.append(brain)
result_list.append(brain)
if positive_stock and not negative_stock and zero_stock and brain.inventory <0:
result_list.append(brain)
result_list.append(brain)
if negative_stock and zero_stock and not positive_stock and brain.inventory >0:
result_list.append(brain)
result_list.append(brain)
if positive_stock and not negative_stock and not zero_stock and brain.inventory <=0:
result_list.append(brain)
result_list.append(brain)
if negative_stock and not positive_stock and not zero_stock and brain.inventory >=0:
result_list.append(brain)
result_list.append(brain)
if zero_stock and not positive_stock and not negative_stock and brain.inventory!=0:
result_list.append(brain)
result_list.append(brain)
if not positive_stock and not negative_stock and not zero_stock:
result_list.append(brain)
result_list.append(brain)
return sorted(result_list, key=lambda brain: (brain.getResourceReference(), brain.getResourceTitle(), brain.variation_text))
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories
portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
......@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
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
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:
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
......@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
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
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:
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
# Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\
item_list)
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
sub_field_dict = {}
split_depth = 1
resource = context.getResourceValue()
......@@ -12,6 +11,9 @@ else :
del default_sub_field_property_dict['item_list']
for item in item_list:
# Remove empty items
if item in (('',''), ['','']):
continue
# Get value of the item
item_value = item[int(not is_right_display)]
# Hash key from item_value
......
......@@ -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.PythonScripts.standard import Object
line_list = []
request = context.REQUEST
portal = context.getPortalObject()
# XXX use a larger limit
......
......@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList()
from Products.ERP5Type.Document import newTempBase
from string import zfill
global portal_object, new_id, l
portal_object = context.getPortalObject()
new_id = 0
l = []
# function to create a new fast input line
def createInputLine(d_message):
global portal_object, new_id, l
new_id += 1
def createInputLine(d_message, new_id):
int_len = 3
o = newTempBase( portal_object
......@@ -28,8 +24,8 @@ def createInputLine(d_message):
l.append(o)
# generate all lines for the fast input form
for d_message in divergence_messages_list:
createInputLine(d_message)
for i, d_message in enumerate(divergence_messages_list):
createInputLine(d_message, i)
# return the list of fast input lines
......
......@@ -3,7 +3,6 @@
read_document_lines to False. Otherwise, it displays on
the fast input all documents lines already added
"""
from Products.ERP5Type.Document import newTempBase
request = context.REQUEST
portal = context.getPortalObject()
trade_document = context
......@@ -123,35 +122,35 @@ empty_line_cpt = 1 # this counter is used so that we always add a fix
i = len_line_list + 1
if read_document_lines is False:
while empty_line_cpt <= lines_num:
while i in used_id:
# do not used an id from previously generated lines
i+=1
# Retrieve values set by the update script
resource_relative_url = getattr(request,"field_listbox_resource_relative_url_new_%s"%i,None)
resource_title = getattr(request,"field_listbox_title_new_%s"%i,None)
reference = getattr(request,"field_listbox_reference_new_%s"%i,None)
while i in used_id:
# do not used an id from previously generated lines
i+=1
# Retrieve values set by the update script
resource_relative_url = getattr(request,"field_listbox_resource_relative_url_new_%s"%i,None)
resource_title = getattr(request,"field_listbox_title_new_%s"%i,None)
reference = getattr(request,"field_listbox_reference_new_%s"%i,None)
obj=trade_document.newContent(portal_type=line_portal_type,
obj=trade_document.newContent(portal_type=line_portal_type,
id = i,
uid="new_%s" % i,
temp_object=1,
reference=None, # otherwise it is acquired on parent
is_indexable=0,)
used_id_append(i)
# Set values inputted by user
if resource_title not in ('',None):
empty_line_cpt -= 1
obj.edit(resource_title=resource_title)
if reference not in ('',None):
empty_line_cpt -= 1
obj.edit(reference=reference)
used_id_append(i)
# Set values inputted by user
if resource_title not in ('',None):
empty_line_cpt -= 1
obj.edit(resource_title=resource_title)
if reference not in ('',None):
empty_line_cpt -= 1
obj.edit(reference=reference)
# if a resource is selected, use it
if resource_relative_url not in ('',None):
empty_line_cpt -= 1
resource = portal.restrictedTraverse(resource_relative_url)
obj.setResourceValue(resource)
empty_line_cpt += 1
result_append(obj)
if resource_relative_url not in ('',None):
empty_line_cpt -= 1
resource = portal.restrictedTraverse(resource_relative_url)
obj.setResourceValue(resource)
empty_line_cpt += 1
result_append(obj)
return result
from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject()
if context.getPortalType() in portal.getPortalSaleTypeList():
......
......@@ -4,7 +4,6 @@
which were already created so that they are not duplicated.
"""
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log
portal = context.getPortalObject()
# Retrieve line and cell portal type
......@@ -21,7 +20,6 @@ for line in listbox:
# Only create line if user has selected a resource
if 'listbox_key' in line and (line.get('resource_relative_url', None) not in ("", None) \
or line.get('source', None) not in ("", None)):
line_id = line['listbox_key']
if line.get('resource_relative_url', None) not in ("", None):
product = portal.restrictedTraverse(line["resource_relative_url"])
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], **kw</string> </value>
<value> <string>listbox=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -6,10 +6,10 @@ if resource is not None:
for base_category in base_category_list:
if matrixbox == 1:
# 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:
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
from DateTime import DateTime
def sorted(seq):
seq = seq[:]
seq.sort()
return seq
portal = context.getPortalObject()
request = portal.REQUEST
if not at_date:
at_date=DateTime()
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], form_id=\'view\',**kw</string> </value>
<value> <string>listbox=(), form_id=\'view\',**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value>
<value> <string>listbox=(),**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories
portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
......@@ -8,13 +8,13 @@ if resource is not None:
if matrixbox == 1:
# XXX matrixbox is right_display (not as listfield) =>
# invert display and value in item
cell_range.append(map(lambda x: (x[1],x[0]),\
cell_range.append([(x[1], x[0]) for x in
context.getVariationCategoryItemList(
base_category_list = (base_category,))))
base_category_list = (base_category,))])
else:
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
request = container.REQUEST
RESPONSE = request.RESPONSE
stat_line = request.get('stat_line', None)
return stat_line
......@@ -4,9 +4,8 @@ and milestones.
"""
translateString = context.Base_translateString
request = context.REQUEST
current_type = context.getPortalType()
if not reference: reference='SO'
if not reference:
reference='SO'
def generateReference(prefix, order, portal_type):
for order_line in order.contentValues(portal_type=portal_type):
......
......@@ -7,7 +7,7 @@ def getSourceReference(line):
for predicate in predicate_list:
source_reference = predicate.getSourceReference()
if source_reference:
return source_reference
return source_reference
return ''
def getDestinationReference(line):
......@@ -19,7 +19,7 @@ def getDestinationReference(line):
for predicate in predicate_list:
destination_reference = predicate.getDestinationReference()
if destination_reference:
return destination_reference
return destination_reference
return ''
#if context.getPortalType() in context.getPortalSaleTypeList():
......
# this API uses format= as argument
# pylint: disable=redefined-builtin
# We wants to get data in order to do a nice summary of items inside the order
# This report will mainly usefull when the same resource is ordered on many
# different lines
......@@ -14,15 +17,12 @@ error_kw = {}
default_quantity_unit = None
default_quantity_unit_title = ''
resource_dict = {}
summary_quantity_dict = {}
object_list = []
untranslatable_column_list = [] # We should not translate some columns
full_total_price = 0
worker_column_list = []
source_trade_dict = {}
context_relative_url = context.getRelativeUrl()
def sortMovement(a, b):
return cmp(a.getRelativeUrl(), b.getRelativeUrl())
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
......@@ -9,7 +9,7 @@ def getSourceReference(line):
for predicate in predicate_list:
source_reference = predicate.getSourceReference()
if source_reference:
return source_reference
return source_reference
return ''
def getSubLineList(obj):
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
......@@ -5,15 +5,6 @@ entered on the fast input
request = context.REQUEST
portal = context.getPortalObject()
base_category = portal.portal_categories.quantity_unit
list_method_id = portal.portal_preferences.\
getPreferredCategoryChildItemListMethodId(
'getCategoryChildCompactLogicalPathItemList')
method = getattr(base_category, list_method_id)
item_list = method(base=0, local_sort_id=('int_index', 'translated_title'),
checked_permission='View')
result_item_list = [('', '')]
resource_value = context.getResourceValue()
......@@ -55,9 +46,9 @@ if resource_value is None:
resource_value = resource_list[0]
if resource_value is not None:
quantity_unit_list = [(x.getTranslatedLogicalPath(), x.getCategoryRelativeUrl(base=0))
quantity_unit_list = [(x.getTranslatedLogicalPath(), x.getCategoryRelativeUrl(base=0))
for x in resource_value.getQuantityUnitValueList()]
# return the first quantity_unit item of resource
result_item_list.extend(quantity_unit_list)
# return the first quantity_unit item of resource
result_item_list.extend(quantity_unit_list)
return result_item_list
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], form_id=\'view\',**kw</string> </value>
<value> <string>listbox=(), form_id=\'view\',**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value>
<value> <string>listbox=(),**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -31,7 +31,7 @@ for listitem in listbox :
with ImmediateReindexContextManager() as immediate_reindex_context_manager:
# we build 'container_count' containers
for container_number in range(container_count):
for _ in range(container_count):
new_container_id = 'c'+str(next_container_number)
# we use container_type to know which are the resource (and variation)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=[],cancel_url=\'\',next_container_int_index=1,**kw</string> </value>
<value> <string>form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=(),cancel_url=\'\',next_container_int_index=1,**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], form_id=\'view\',**kw</string> </value>
<value> <string>listbox=(), form_id=\'view\',**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value>
<value> <string>listbox=(),**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Message import Message
from Products.DCWorkflow.DCWorkflow import ValidationFailed
inventory = state_change['object']
# use of the constraint
inventory.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
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