Commit 3679aab9 authored by Jérome Perrin's avatar Jérome Perrin

Enable coding style test on more business templates

km, content_translation, ods_style, open_trade, simulation and budget

See merge request !1094
parents c93a94b0 ca302cf5
# We don't have good implementation of budget predicate yet, so don't fill predicate table for now. # We don't have good implementation of budget predicate yet, so don't fill predicate table for now.
return None return None
# XXX strict membership is missing ?
# ideally strict membership should be an option for each category, but this API
# does not exist in predicates.
# TODO: support virtual "All other nodes" # TODO: support virtual "All other nodes"
return context.generatePredicate(
multimembership_criterion_base_category_list = ('resource',),
criterion_property_list = ('start_date', 'stop_date'))
# We don't have good implementation of budget predicate yet, so don't fill predicate table for now. # We don't have good implementation of budget predicate yet, so don't fill predicate table for now.
return None return None
context = context.asContext(
_range_criterion = {'start_date': (context.getStartDateRangeMin(),
context.getStartDateRangeMax())
})
return context
return context.generatePredicate(criterion_property_list=('start_date', 'stop_date'))
return context.generatePredicate(_range_criterion = {'start_date': (context.getStartDate(),
context.getStopDate())
})
return context.generatePredicate(criterion_property_list=('start_date',))
return context.generatePredicate(multimembership_criterion_base_category_list = ('resource',),
criterion_property_list = ('start_date',))
context = context.asContext(
criterion_property_list=['start_date'],
range_criterion = {'start_date': (context.getStartDate(),
context.getStopDate())
})
return context
...@@ -28,16 +28,11 @@ if budget_model is not None: ...@@ -28,16 +28,11 @@ if budget_model is not None:
non_strict_base_category_set[ non_strict_base_category_set[
budget_variation.getProperty('variation_base_category')] = True budget_variation.getProperty('variation_base_category')] = True
def reversed(seq):
seq = seq[::]
seq.sort(reverse=True)
return seq
# build a dict of dependant dimensions # build a dict of dependant dimensions
dependant_dimensions_dict = {} dependant_dimensions_dict = {}
for bc in non_strict_base_category_set.keys(): for bc in non_strict_base_category_set.keys():
vcl = reversed(context.getVariationCategoryList(base_category_list=(bc,))) vcl = sorted(context.getVariationCategoryList(base_category_list=(bc,)), reverse=True)
for vc in vcl: for vc in vcl:
dependant_vc_list = [other_vc for other_vc in vcl dependant_vc_list = [other_vc for other_vc in vcl
if other_vc.startswith('%s/' % vc) if other_vc.startswith('%s/' % vc)
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items # Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\ item_list = [x for x in item_list if x not in (('',''), ['',''])]
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
......
...@@ -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.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
updated_cell_count = 0 updated_cell_count = 0
dependant_dimensions_dict = context.BudgetLine_getSummaryDimensionKeyDict() dependant_dimensions_dict = context.BudgetLine_getSummaryDimensionKeyDict()
cell_key_list = context.getCellKeyList() cell_key_list = context.getCellKeyList()
def reversed(seq):
seq = seq[::]
seq.sort(reverse=True)
return seq
# we iterate in reversed order to update the deepest cells first # we iterate in reversed order to update the deepest cells first
for cell_key in reversed(cartesianProduct(context.getCellRange())): for cell_key in sorted(cartesianProduct(context.getCellRange()), reverse=True):
for idx, dimension in enumerate(cell_key): for idx, dimension in enumerate(cell_key):
if dimension in dependant_dimensions_dict: if dimension in dependant_dimensions_dict:
dependant_cell_list = [] dependant_cell_list = []
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items # Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\ item_list = [x for x in item_list if x not in (('',''), ['',''])]
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
......
...@@ -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>
......
...@@ -10,7 +10,7 @@ if line.getMembershipCriterionBaseCategoryList(): ...@@ -10,7 +10,7 @@ if line.getMembershipCriterionBaseCategoryList():
for variation in budget_line_category_list: for variation in budget_line_category_list:
if not variation: if not variation:
continue continue
base, category = variation.split('/', 1) base = variation.split('/', 1)[0]
if base in line.getMembershipCriterionBaseCategoryList(): if base in line.getMembershipCriterionBaseCategoryList():
line.setMembershipCriterionCategoryList( line.setMembershipCriterionCategoryList(
[variation,] + line.getMembershipCriterionCategoryList()) [variation,] + line.getMembershipCriterionCategoryList())
from Products.DCWorkflow.DCWorkflow import ValidationFailed state_change['object'].Base_checkConsistency()
object = state_change['object']
error_msg = 'Please correct the following errors:'
consistency = object.checkConsistency()
for elem in consistency:
error_msg =error_msg+' '+elem[4]
if consistency != []:
raise ValidationFailed, str(error_msg)
object = state_change['object'] state_change['object'].Base_checkConsistency()
object.Base_checkConsistency()
from Products.Formulator.Errors import FormValidationError from Products.Formulator.Errors import FormValidationError
from Products.CMFActivity.Errors import ActivityPendingError
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
request=container.REQUEST request=container.REQUEST
...@@ -26,7 +25,6 @@ if not silent_mode and not request.AUTHENTICATED_USER.has_permission('Modify por ...@@ -26,7 +25,6 @@ if not silent_mode and not request.AUTHENTICATED_USER.has_permission('Modify por
# Get the form # Get the form
form = getattr(context,form_id) form = getattr(context,form_id)
edit_order = form.edit_order
try: try:
# Validate # Validate
......
try: try:
return context.getTypeInfo().getContentTranslationDomainPropertyNameList() and True return context.getTypeInfo().getContentTranslationDomainPropertyNameList() and True
except: except Exception:
# First time after cache is cleared, something is wrong and does not work. # First time after cache is cleared, something is wrong and does not work.
return False return False
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject()
# we can use current_web_document in case it's "embedded" into a Web Section # we can use current_web_document in case it's "embedded" into a Web Section
document = request.get('current_web_document', context) document = request.get('current_web_document', context)
......
...@@ -12,16 +12,16 @@ The parameters are ...@@ -12,16 +12,16 @@ The parameters are
base_category_list -- list of acceptable base categories base_category_list -- list of acceptable base categories
(used to filter part of the criteria) (used to filter part of the criteria)
user_name -- the user identifier (not used) user_name -- the user identifier (not used)
object -- object which we want to assign roles to obj -- object which we want to assign roles to
portal_type -- portal type of object portal_type -- portal type of object
""" """
category_list = [] category_list = []
if object is None: if obj is None:
return [] return []
criterion_list = object.getMembershipCriterionCategoryList() criterion_list = obj.getMembershipCriterionCategoryList()
for criterion in criterion_list: for criterion in criterion_list:
id_list = criterion.split('/') id_list = criterion.split('/')
base_category = id_list[0] base_category = id_list[0]
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
""" """
Create basic KM account using ERP5 credentials system. Create basic KM account using ERP5 credentials system.
""" """
from Products.Formulator.Errors import ValidationError, FormValidationError
portal = context.getPortalObject()
translateString = context.Base_translateString translateString = context.Base_translateString
website = context.getWebSiteValue() website = context.getWebSiteValue()
...@@ -12,7 +10,7 @@ result, result_type = context.Base_edit(form_id, silent_mode=1, field_prefix='yo ...@@ -12,7 +10,7 @@ result, result_type = context.Base_edit(form_id, silent_mode=1, field_prefix='yo
# Return if not appropriate # Return if not appropriate
if result_type != 'edit': if result_type != 'edit':
return result return result
kw, encapsulated_editor_list = result kw, _ = result
# XXX: hard coded due to erp5_credentials requirement # XXX: hard coded due to erp5_credentials requirement
kw['role_list'] = ['internal'] kw['role_list'] = ['internal']
......
...@@ -10,7 +10,7 @@ kw = {} ...@@ -10,7 +10,7 @@ kw = {}
try: try:
workflow_tool = context.portal_workflow workflow_tool = context.portal_workflow
workflow = getattr(workflow_tool, action['workflow_id']) workflow = getattr(workflow_tool, action['workflow_id'])
except: except AttributeError:
return {} return {}
# If this is a worklist action, read the worklist definition # If this is a worklist action, read the worklist definition
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>relation_id_list=[],**kw</string> </value> <value> <string>relation_id_list=(), **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
""" """
Returns a document by its reference in a gadget. Returns a document by its reference in a gadget.
""" """
request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
if box_relative_url: if box_relative_url:
......
from Products.ERP5Type.Message import Message
# XXX for now, we always use the default Base_getODSStyleSheet # XXX for now, we always use the default Base_getODSStyleSheet
# we use to have Base_getODSListStyleSheet with a line at the bottom of # we use to have Base_getODSListStyleSheet with a line at the bottom of
# the page, for better print display. Now we rather agreed that # the page, for better print display and also Base_getODSStyleSheetLandscape
# ods_style is a style for export, not report and the rendering appearance # when landscape mode is used.
# was not so important. # Now we rather agreed that ods_style is a style for export, not report and
# the rendering appearance was not so important.
return context.Base_getODSStyleSheet return context.Base_getODSStyleSheet
translate = lambda msg: Message('ui', msg)
request = context.REQUEST
landscape = int(request.get('landscape', 0))
if context.pt != 'form_list':
if landscape == 1:
#normal style sheet with preview of landscape
return context.Base_getODSStyleSheetLandscape
else:
#preview portrait(Default)
return context.Base_getODSStyleSheet
else:
if landscape == 1:
#style sheet for list, there is under line in preview
return context.Base_getODSListStyleSheetLandscape
else:
#preview portrait(Default)
return context.Base_getODSListStyleSheet
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Listbox_getEditableFieldDict</string> </value> <value> <string>ListBox_getEditableFieldDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Listbox_getReportTreeStructure</string> </value> <value> <string>ListBox_getReportTreeStructure</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
selection_name python: listbox.get_value('selection_name', REQUEST=request); selection_name python: listbox.get_value('selection_name', REQUEST=request);
editable_columns python: listbox.get_value('editable_columns', REQUEST=request); editable_columns python: listbox.get_value('editable_columns', REQUEST=request);
untranslatable_columns python: [x[0] for x in listbox.get_value('untranslatable_columns', REQUEST=request)]; untranslatable_columns python: [x[0] for x in listbox.get_value('untranslatable_columns', REQUEST=request)];
editable_fields listbox/Listbox_getEditableFieldDict; editable_fields listbox/ListBox_getEditableFieldDict;
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request); selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);
is_report_tree_mode selection/report_tree_mode | python: 0; is_report_tree_mode selection/report_tree_mode | python: 0;
is_domain_tree_mode selection/domain_tree_mode | python: 0; is_domain_tree_mode selection/domain_tree_mode | python: 0;
max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode); max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list[1:], is_report_tree_mode=is_report_tree_mode, is_domain_tree_mode=is_domain_tree_mode, max_section_depth=max_section_depth); listbox_line_structure python: here.ListBox_getReportTreeStructure(listbox_line_list=listboxline_list[1:], is_report_tree_mode=is_report_tree_mode, is_domain_tree_mode=is_domain_tree_mode, max_section_depth=max_section_depth);
listboxline python:listboxline_list[0]; listboxline python:listboxline_list[0];
first first | nothing; first first | nothing;
global merge_report_section_list python: request.get('merge_report_section_list', False); global merge_report_section_list python: request.get('merge_report_section_list', False);
......
...@@ -31,38 +31,38 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -31,38 +31,38 @@ from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.SupplyCell import SupplyCell from erp5.component.document.SupplyCell import SupplyCell
class OpenOrderCell(SupplyCell): class OpenOrderCell(SupplyCell):
""" """
An Open Order Cell allows to define specific properties An Open Order Cell allows to define specific properties
for each variation of a resource in an Open Order Line. for each variation of a resource in an Open Order Line.
""" """
meta_type = 'ERP5 Open Order Cell' meta_type = 'ERP5 Open Order Cell'
portal_type = 'Open Order Cell' portal_type = 'Open Order Cell'
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Amount , PropertySheet.Amount
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.SupplyLine , PropertySheet.SupplyLine
, PropertySheet.Discount , PropertySheet.Discount
, PropertySheet.Path , PropertySheet.Path
, PropertySheet.FlowCapacity , PropertySheet.FlowCapacity
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.MappedValue , PropertySheet.MappedValue
, PropertySheet.Reference , PropertySheet.Reference
) )
def getTotalPrice(self): def getTotalPrice(self):
"""Returns the total price for this open order cell. """Returns the total price for this open order cell.
Unlike Amount, we do not calculate a price implicitly if not defined. Unlike Amount, we do not calculate a price implicitly if not defined.
Actually, I (jerome) think amount behaviour itself if wrong. Actually, I (jerome) think amount behaviour itself if wrong.
""" """
return (self.getQuantity() or 0) * (self.getPrice() or 0) return (self.getQuantity() or 0) * (self.getPrice() or 0)
...@@ -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>OpenOrderCell</string> </value> <value> <string>OpenOrderCell</string> </value>
...@@ -43,18 +49,7 @@ ...@@ -43,18 +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: 34, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 38, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 39, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 43, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 44, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 47, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 62, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -64,13 +59,28 @@ ...@@ -64,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>
...@@ -83,7 +93,7 @@ ...@@ -83,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>
...@@ -92,7 +102,7 @@ ...@@ -92,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>
......
...@@ -32,54 +32,54 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -32,54 +32,54 @@ from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.SupplyLine import SupplyLine from erp5.component.document.SupplyLine import SupplyLine
class OpenOrderLine(SupplyLine): class OpenOrderLine(SupplyLine):
""" """
An Open Order Line is a Supply Line with additional An Open Order Line is a Supply Line with additional
properties to define repeatability properties to define repeatability
""" """
meta_type = 'ERP5 Open Order Line' meta_type = 'ERP5 Open Order Line'
portal_type = 'Open Order Line' portal_type = 'Open Order Line'
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject , PropertySheet.XMLObject
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Amount , PropertySheet.Amount
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Arrow , PropertySheet.Arrow
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Price , PropertySheet.Price
, PropertySheet.SupplyLine , PropertySheet.SupplyLine
, PropertySheet.VariationRange , PropertySheet.VariationRange
, PropertySheet.Path , PropertySheet.Path
, PropertySheet.FlowCapacity , PropertySheet.FlowCapacity
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Comment , PropertySheet.Comment
) )
def getTotalQuantity(self, default=0): def getTotalQuantity(self, default=0):
"""Returns the total quantity for this open order line. """Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are If the order line contains cells, the total quantity of cells are
returned. returned.
""" """
if self.hasCellContent(base_id='path'): if self.hasCellContent(base_id='path'):
return sum([cell.getQuantity() for cell in return sum([cell.getQuantity() for cell in
self.getCellValueList(base_id='path')]) self.getCellValueList(base_id='path')])
return self.getQuantity(default) return self.getQuantity(default)
def getTotalPrice(self): def getTotalPrice(self):
"""Returns the total price for this open order line. """Returns the total price for this open order line.
If the order line contains cells, the total price of cells are If the order line contains cells, the total price of cells are
returned. returned.
""" """
if self.hasCellContent(base_id='path'): if self.hasCellContent(base_id='path'):
return sum([cell.getTotalPrice() for cell in return sum([cell.getTotalPrice() for cell in
self.getCellValueList(base_id='path')]) self.getCellValueList(base_id='path')])
return SupplyLine.getTotalPrice(self) return SupplyLine.getTotalPrice(self)
...@@ -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>OpenOrderLine</string> </value> <value> <string>OpenOrderLine</string> </value>
...@@ -43,25 +49,7 @@ ...@@ -43,25 +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: 35, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 42, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 45, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 46, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 49, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 65, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 66, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 70, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 71, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 73, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 75, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 76, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 81, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 83, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -71,13 +59,28 @@ ...@@ -71,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>
...@@ -90,7 +93,7 @@ ...@@ -90,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>
...@@ -99,7 +102,7 @@ ...@@ -99,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>
......
...@@ -226,7 +226,7 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin, ...@@ -226,7 +226,7 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return None return None
return open_order_line.getQuantityUnit(checked_permission=checked_permission) return open_order_line.getQuantityUnit(checked_permission=checked_permission)
def getPrice(self): def getPrice(self, context=None):
open_order_line = self.getAggregateRelatedValue(portal_type='Open Sale Order Line') open_order_line = self.getAggregateRelatedValue(portal_type='Open Sale Order Line')
if open_order_line is None: if open_order_line is None:
return None return None
...@@ -262,8 +262,16 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin, ...@@ -262,8 +262,16 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return [] return []
return open_order_line.getSpecialiseValueList() return open_order_line.getSpecialiseValueList()
def _getCategoryMembershipList(self, category, spec=(), filter=None, def _getCategoryMembershipList(
portal_type=(), base=0, keep_default=1, checked_permission=None, **kw): self,
category,
spec=(),
filter=None, # pylint:disable=redefined-builtin
portal_type=(),
base=0,
keep_default=1,
checked_permission=None,
**kw):
if category == 'specialise': if category == 'specialise':
open_order_line = self.getAggregateRelatedValue(portal_type='Open Sale Order Line') open_order_line = self.getAggregateRelatedValue(portal_type='Open Sale Order Line')
return open_order_line._getCategoryMembershipList(category, spec=spec, filter=filter, return open_order_line._getCategoryMembershipList(category, spec=spec, filter=filter,
......
...@@ -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>SubscriptionItem</string> </value> <value> <string>SubscriptionItem</string> </value>
...@@ -43,10 +49,7 @@ ...@@ -43,10 +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:229, 2: Arguments number differs from overridden \'getPrice\' method (arguments-differ)</string>
<string>W:265, 58: Redefining built-in \'filter\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -56,13 +59,28 @@ ...@@ -56,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>
...@@ -75,7 +93,7 @@ ...@@ -75,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>
...@@ -84,7 +102,7 @@ ...@@ -84,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>
......
...@@ -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: 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,), display_id='translated_title' ) ) ) cell_range.append([(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list=(base_category,), display_id='translated_title')])
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
...@@ -3,7 +3,7 @@ subscription_item_set = set() ...@@ -3,7 +3,7 @@ subscription_item_set = set()
for open_order_line in context.objectValues(): for open_order_line in context.objectValues():
for ob in [open_order_line] + open_order_line.getCellValueList(): for ob in [open_order_line] + open_order_line.getCellValueList():
for item in ob.getAggregateValueList(): for item in ob.getAggregateValueList():
if getattr(item.aq_explicit, 'updateSimulation', None) is not None and \ if getattr(item.aq_explicit, 'updateSimulation', None) is not None and \
item not in subscription_item_set: item not in subscription_item_set:
subscription_item_set.add(item) subscription_item_set.add(item)
item.updateSimulation(expand_root=1) item.updateSimulation(expand_root=1)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# - Implement validation of list fields # - Implement validation of list fields
# #
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from Products.Formulator.Errors import ValidationError, FormValidationError from Products.Formulator.Errors import FormValidationError
request=context.REQUEST request=context.REQUEST
......
...@@ -28,15 +28,15 @@ for listbox_dict in listbox: ...@@ -28,15 +28,15 @@ for listbox_dict in listbox:
listbox_key = listbox_dict['listbox_key'] listbox_key = listbox_dict['listbox_key']
line = [x for x in line_list if x.getPath() == listbox_key][0] line = [x for x in line_list if x.getPath() == listbox_key][0]
uid = line.getUid() uid = line.getUid()
for property in ('solver', 'solver_configuration', 'delivery_solver', 'comment',): for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(property, None) value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (property, uid) key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value request.form[key] = request.other[key] = value
if property == 'solver_configuration': if prop == 'solver_configuration':
if value is not None: if value is not None:
line.updateConfiguration(**value.as_dict()) line.updateConfiguration(**value.as_dict())
else: else:
line.setProperty(property, value) line.setProperty(prop, value)
# if divergence solving is already ongoing and will be fixed by activities # if divergence solving is already ongoing and will be fixed by activities
if line is None: if line is None:
......
...@@ -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=\'view\', listbox=[], **kw</string> </value> <value> <string>form_id=\'view\', listbox=(), **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
request= context.REQUEST request = context.REQUEST
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
listbox = request.get('listbox') listbox = request.get('listbox')
...@@ -12,15 +12,15 @@ for listbox_key in listbox: ...@@ -12,15 +12,15 @@ for listbox_key in listbox:
listbox_dict = listbox[listbox_key] listbox_dict = listbox[listbox_key]
line = [x for x in line_list if x.getPath() == listbox_key][0] line = [x for x in line_list if x.getPath() == listbox_key][0]
uid = line.getUid() uid = line.getUid()
for property in ('solver', 'solver_configuration', 'delivery_solver', 'comment',): for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(property, None) value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (property, uid) key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value request.form[key] = request.other[key] = value
if property == 'solver_configuration': if prop == 'solver_configuration':
if value is not None: if value is not None:
line.updateConfiguration(**value.as_dict()) line.updateConfiguration(**value.as_dict())
else: else:
line.setProperty(property, value) line.setProperty(prop, value)
request.form['your_dialog_updated'] = '1' request.form['your_dialog_updated'] = '1'
# xhtml style Base_callDialogMethod does not redirected because of the listbox # xhtml style Base_callDialogMethod does not redirected because of the listbox
......
...@@ -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=\'view\', listbox=[],**kw</string> </value> <value> <string>form_id=\'view\', listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type.ObjectMessage import ObjectMessage from Products.ERP5Type.ObjectMessage import ObjectMessage
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
...@@ -36,19 +37,11 @@ def getLegacyCallableIdItemList(self): ...@@ -36,19 +37,11 @@ def getLegacyCallableIdItemList(self):
('WebSection_getPermanentURLForView', 'getPermanentURL'), ('WebSection_getPermanentURLForView', 'getPermanentURL'),
) )
# Define acceptable prefix list for skin folder items
skin_prefix_list = None
def getSkinPrefixList(self):
"""
Return the list of acceptable prefix. Cache the result.
TODO: make the cache more efficient (read-only transaction @transactional_cached()
cache) def getSkinPrefixList(self):
"""Return the list of acceptable prefixes for skins.
""" """
global skin_prefix_list
if skin_prefix_list:
return skin_prefix_list
portal = self.getPortalObject() portal = self.getPortalObject()
# Add portal types prefix # Add portal types prefix
...@@ -65,14 +58,15 @@ def getSkinPrefixList(self): ...@@ -65,14 +58,15 @@ def getSkinPrefixList(self):
skin_prefix_list.extend(self.portal_types.getMixinTypeList()) skin_prefix_list.extend(self.portal_types.getMixinTypeList())
# Add interfaces prefix # Add interfaces prefix
skin_prefix_list.extend(self.portal_types.getInterfaceTypeList()) # XXX getInterfaceTypeList does not include file system interfaces ... keep this low-level way for now.
# XXX getInterfaceTypeList seems empty ... keep this low-level way for now.
from Products.ERP5Type import interfaces from Products.ERP5Type import interfaces
for interface_name in interfaces.__dict__.keys(): for interface_name in (
list(interfaces.__dict__.keys())
+ list(self.portal_types.getInterfaceTypeList())):
if interface_name.startswith('I'): if interface_name.startswith('I'):
skin_prefix_list.append(interface_name[1:]) skin_prefix_list.append(interface_name[1:])
# XXX do we really add with the I prefix ? # XXX do we really add with the I prefix ?
skin_prefix_list.append(interface_name) skin_prefix_list.append(interface_name)
# Add other prefix # Add other prefix
skin_prefix_list.extend(( skin_prefix_list.extend((
...@@ -181,6 +175,7 @@ ignored_skin_id_set = { ...@@ -181,6 +175,7 @@ ignored_skin_id_set = {
'TaskListOverviewGadget_setPreferences', 'TaskListOverviewGadget_setPreferences',
'TaskListsGadgetListbox_getLineCss', 'TaskListsGadgetListbox_getLineCss',
'InventoryModule_reindexMovementList', 'InventoryModule_reindexMovementList',
'DeliveryModule_mergeDeliveryList',
} }
# Generic method to check consistency of a skin item # Generic method to check consistency of a skin item
......
...@@ -103,6 +103,12 @@ def test_suite(): ...@@ -103,6 +103,12 @@ def test_suite():
testclass, testclass,
testXHTML.validator, testXHTML.validator,
(tested_business_template,), (tested_business_template,),
expected_failure_list=(
# this view only works when solver decision has a relation to a solver.
# One way to fix this would be to allow a custom "init script" to be called
# on a portal type.
'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration',
),
) )
# required to create content in portal_components # required to create content in portal_components
......
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