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): ...@@ -454,7 +454,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree 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') security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradeStateList')
def getPartiallyCompletedTradeStateList(self, explanation): def getPartiallyCompletedTradeStateList(self, explanation):
...@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree 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') security.declareProtected(Permissions.AccessContentsInformation, 'getLatestCompletedTradeStateList')
def getLatestCompletedTradeStateList(self, explanation): def getLatestCompletedTradeStateList(self, explanation):
...@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree 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') security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradePhaseList')
def getPartiallyCompletedTradePhaseList(self, explanation): def getPartiallyCompletedTradePhaseList(self, explanation):
...@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree 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') security.declareProtected(Permissions.AccessContentsInformation, 'isTradePhaseCompleted')
def isTradePhaseCompleted(self, explanation, trade_phase): def isTradePhaseCompleted(self, explanation, trade_phase):
...@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject):
kw = self._getPropertyAndCategoryDict(explanation, amount, trade_model_path, delay_mode=delay_mode) kw = self._getPropertyAndCategoryDict(explanation, amount, trade_model_path, delay_mode=delay_mode)
trade_phase = filter_trade_phase(trade_model_path.getTradePhaseList()) trade_phase = filter_trade_phase(trade_model_path.getTradePhaseList())
try: try:
kw['trade_phase'], = trade_phase kw['trade_phase'], = trade_phase # pylint: disable=unpacking-non-sequence
except ValueError: except ValueError:
pass pass
kw.update(update_property_dict) kw.update(update_property_dict)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>BusinessProcess</string> </value> <value> <string>BusinessProcess</string> </value>
...@@ -43,13 +49,7 @@ ...@@ -43,13 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -59,13 +59,28 @@ ...@@ -59,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -78,7 +93,7 @@ ...@@ -78,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -87,7 +102,7 @@ ...@@ -87,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
############################################################################## ##############################################################################
from Products.ERP5Type.mixin.constraint import ConstraintMixin from Products.ERP5Type.mixin.constraint import ConstraintMixin
from zLOG import LOG
class DuplicateInventoryConstraint(ConstraintMixin): class DuplicateInventoryConstraint(ConstraintMixin):
""" """
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>DuplicateInventoryConstraint</string> </value> <value> <string>DuplicateInventoryConstraint</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.DuplicateInventoryConstraint</string> </value> <value> <string>document.erp5.DuplicateInventoryConstraint</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,53 +98,30 @@ ...@@ -59,53 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>validate</string> </value> <value> <string>validate</string> </value>
</item> </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> <item>
<key> <string>validation_state</string> </key> <key> <string>validation_state</string> </key>
<value> <string>validated</string> </value> <value> <string>validated</string> </value>
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -178,9 +178,17 @@ class TradeModelPath(Path): ...@@ -178,9 +178,17 @@ class TradeModelPath(Path):
result[base_category] = category_url_list result[base_category] = category_url_list
return result return result
def _filterCategoryList(self, category_list, category, spec=(), def _filterCategoryList(
filter=None, portal_type=(), base=0, self,
keep_default=1, checked_permission=None): category_list,
category,
spec=(),
filter=None, # pylint: disable=redefined-builtin
portal_type=(),
base=0,
keep_default=1,
checked_permission=None,
):
""" """
XXX - implementation missing XXX - implementation missing
TBD - look at CategoryTool._buildFilter for inspiration TBD - look at CategoryTool._buildFilter for inspiration
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>TradeModelPath</string> </value> <value> <string>TradeModelPath</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:182, 26: Redefining built-in \'filter\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories portal_categories = context.portal_categories
portal_preferences = context.portal_preferences portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList') method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
...@@ -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
...@@ -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
# Remove empty items if default_sub_field_property_dict is None:
item_list = filter(lambda x: x not in [('',''), ['','']],\ default_sub_field_property_dict = {}
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
resource = context.getResourceValue() resource = context.getResourceValue()
...@@ -12,6 +11,9 @@ else : ...@@ -12,6 +11,9 @@ else :
del default_sub_field_property_dict['item_list'] del default_sub_field_property_dict['item_list']
for item in item_list: for item in item_list:
# Remove empty items
if item in (('',''), ['','']):
continue
# Get value of the item # Get value of the item
item_value = item[int(not is_right_display)] item_value = item[int(not is_right_display)]
# Hash key from item_value # Hash key from item_value
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.PythonScripts.standard import Object from Products.PythonScripts.standard import Object
line_list = [] line_list = []
request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
# XXX use a larger limit # XXX use a larger limit
......
...@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList() ...@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList()
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill from string import zfill
global portal_object, new_id, l
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
new_id = 0
l = [] l = []
# function to create a new fast input line # function to create a new fast input line
def createInputLine(d_message): def createInputLine(d_message, new_id):
global portal_object, new_id, l
new_id += 1
int_len = 3 int_len = 3
o = newTempBase( portal_object o = newTempBase( portal_object
...@@ -28,8 +24,8 @@ def createInputLine(d_message): ...@@ -28,8 +24,8 @@ def createInputLine(d_message):
l.append(o) l.append(o)
# generate all lines for the fast input form # generate all lines for the fast input form
for d_message in divergence_messages_list: for i, d_message in enumerate(divergence_messages_list):
createInputLine(d_message) createInputLine(d_message, i)
# return the list of fast input lines # return the list of fast input lines
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
read_document_lines to False. Otherwise, it displays on read_document_lines to False. Otherwise, it displays on
the fast input all documents lines already added the fast input all documents lines already added
""" """
from Products.ERP5Type.Document import newTempBase
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
trade_document = context trade_document = context
......
from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject() portal = context.getPortalObject()
if context.getPortalType() in portal.getPortalSaleTypeList(): if context.getPortalType() in portal.getPortalSaleTypeList():
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
which were already created so that they are not duplicated. which were already created so that they are not duplicated.
""" """
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log
portal = context.getPortalObject() portal = context.getPortalObject()
# Retrieve line and cell portal type # Retrieve line and cell portal type
...@@ -21,7 +20,6 @@ for line in listbox: ...@@ -21,7 +20,6 @@ for line in listbox:
# Only create line if user has selected a resource # Only create line if user has selected a resource
if 'listbox_key' in line and (line.get('resource_relative_url', None) not in ("", None) \ if 'listbox_key' in line and (line.get('resource_relative_url', None) not in ("", None) \
or line.get('source', 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): if line.get('resource_relative_url', None) not in ("", None):
product = portal.restrictedTraverse(line["resource_relative_url"]) product = portal.restrictedTraverse(line["resource_relative_url"])
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[], **kw</string> </value> <value> <string>listbox=(), **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -6,10 +6,10 @@ if resource is not None: ...@@ -6,10 +6,10 @@ if resource is not None:
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox == 1:
# 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
from DateTime import DateTime from DateTime import DateTime
def sorted(seq):
seq = seq[:]
seq.sort()
return seq
portal = context.getPortalObject() portal = context.getPortalObject()
request = portal.REQUEST
if not at_date: if not at_date:
at_date=DateTime() at_date=DateTime()
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories portal_categories = context.portal_categories
portal_preferences = context.portal_preferences portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList') method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
...@@ -8,13 +8,13 @@ if resource is not None: ...@@ -8,13 +8,13 @@ if resource is not None:
if matrixbox == 1: if matrixbox == 1:
# XXX matrixbox is right_display (not as listfield) => # XXX matrixbox is right_display (not as listfield) =>
# invert display and value in item # invert display and value in item
cell_range.append(map(lambda x: (x[1],x[0]),\ cell_range.append([(x[1], x[0]) for x in
context.getVariationCategoryItemList( context.getVariationCategoryItemList(
base_category_list = (base_category,)))) base_category_list = (base_category,))])
else: else:
cell_range.append(context.getVariationCategoryList(\ cell_range.append(context.getVariationCategoryList(\
base_category_list=(base_category,))) 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
request = container.REQUEST request = container.REQUEST
RESPONSE = request.RESPONSE
stat_line = request.get('stat_line', None) stat_line = request.get('stat_line', None)
return stat_line return stat_line
...@@ -4,9 +4,8 @@ and milestones. ...@@ -4,9 +4,8 @@ and milestones.
""" """
translateString = context.Base_translateString translateString = context.Base_translateString
request = context.REQUEST if not reference:
current_type = context.getPortalType() reference='SO'
if not reference: reference='SO'
def generateReference(prefix, order, portal_type): def generateReference(prefix, order, portal_type):
for order_line in order.contentValues(portal_type=portal_type): for order_line in order.contentValues(portal_type=portal_type):
......
# 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 # 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 # This report will mainly usefull when the same resource is ordered on many
# different lines # different lines
...@@ -14,15 +17,12 @@ error_kw = {} ...@@ -14,15 +17,12 @@ error_kw = {}
default_quantity_unit = None default_quantity_unit = None
default_quantity_unit_title = '' default_quantity_unit_title = ''
resource_dict = {} resource_dict = {}
summary_quantity_dict = {}
object_list = [] object_list = []
untranslatable_column_list = [] # We should not translate some columns untranslatable_column_list = [] # We should not translate some columns
full_total_price = 0 full_total_price = 0
worker_column_list = [] worker_column_list = []
source_trade_dict = {} source_trade_dict = {}
context_relative_url = context.getRelativeUrl()
def sortMovement(a, b): def sortMovement(a, b):
return cmp(a.getRelativeUrl(), b.getRelativeUrl()) return cmp(a.getRelativeUrl(), b.getRelativeUrl())
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
...@@ -5,15 +5,6 @@ entered on the fast input ...@@ -5,15 +5,6 @@ entered on the fast input
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() 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 = [('', '')] result_item_list = [('', '')]
resource_value = context.getResourceValue() resource_value = context.getResourceValue()
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -31,7 +31,7 @@ for listitem in listbox : ...@@ -31,7 +31,7 @@ for listitem in listbox :
with ImmediateReindexContextManager() as immediate_reindex_context_manager: with ImmediateReindexContextManager() as immediate_reindex_context_manager:
# we build 'container_count' containers # 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) new_container_id = 'c'+str(next_container_number)
# we use container_type to know which are the resource (and variation) # we use container_type to know which are the resource (and variation)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Message import Message state_change['object'].Base_checkConsistency()
from Products.DCWorkflow.DCWorkflow import ValidationFailed
inventory = state_change['object']
# use of the constraint
inventory.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