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.
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"
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.
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:
non_strict_base_category_set[
budget_variation.getProperty('variation_base_category')] = True
def reversed(seq):
seq = seq[::]
seq.sort(reverse=True)
return seq
# build a dict of dependant dimensions
dependant_dimensions_dict = {}
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:
dependant_vc_list = [other_vc for other_vc in vcl
if other_vc.startswith('%s/' % vc)
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\
item_list)
item_list = [x for x in item_list if x not in (('',''), ['',''])]
sub_field_dict = {}
split_depth = 1
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</string> </value>
<value> <string>item_list, value_list, default_sub_field_property_dict=None, is_right_display=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5Type.Message import translateString
updated_cell_count = 0
dependant_dimensions_dict = context.BudgetLine_getSummaryDimensionKeyDict()
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
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):
if dimension in dependant_dimensions_dict:
dependant_cell_list = []
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\
item_list)
item_list = [x for x in item_list if x not in (('',''), ['',''])]
sub_field_dict = {}
split_depth = 1
......
......@@ -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>
......
......@@ -10,7 +10,7 @@ if line.getMembershipCriterionBaseCategoryList():
for variation in budget_line_category_list:
if not variation:
continue
base, category = variation.split('/', 1)
base = variation.split('/', 1)[0]
if base in line.getMembershipCriterionBaseCategoryList():
line.setMembershipCriterionCategoryList(
[variation,] + line.getMembershipCriterionCategoryList())
from Products.DCWorkflow.DCWorkflow import ValidationFailed
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)
state_change['object'].Base_checkConsistency()
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
from Products.Formulator.Errors import FormValidationError
from Products.CMFActivity.Errors import ActivityPendingError
from Products.ERP5Type.Utils import convertToUpperCase
request=container.REQUEST
......@@ -26,7 +25,6 @@ if not silent_mode and not request.AUTHENTICATED_USER.has_permission('Modify por
# Get the form
form = getattr(context,form_id)
edit_order = form.edit_order
try:
# Validate
......
try:
return context.getTypeInfo().getContentTranslationDomainPropertyNameList() and True
except:
except Exception:
# First time after cache is cleared, something is wrong and does not work.
return False
from Products.ERP5Type.Document import newTempBase
request = context.REQUEST
portal = context.getPortalObject()
# we can use current_web_document in case it's "embedded" into a Web Section
document = request.get('current_web_document', context)
......
......@@ -12,16 +12,16 @@ The parameters are
base_category_list -- list of acceptable base categories
(used to filter part of the criteria)
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
"""
category_list = []
if object is None:
if obj is None:
return []
criterion_list = object.getMembershipCriterionCategoryList()
criterion_list = obj.getMembershipCriterionCategoryList()
for criterion in criterion_list:
id_list = criterion.split('/')
base_category = id_list[0]
......
......@@ -50,7 +50,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
"""
Create basic KM account using ERP5 credentials system.
"""
from Products.Formulator.Errors import ValidationError, FormValidationError
portal = context.getPortalObject()
translateString = context.Base_translateString
website = context.getWebSiteValue()
......@@ -12,7 +10,7 @@ result, result_type = context.Base_edit(form_id, silent_mode=1, field_prefix='yo
# Return if not appropriate
if result_type != 'edit':
return result
kw, encapsulated_editor_list = result
kw, _ = result
# XXX: hard coded due to erp5_credentials requirement
kw['role_list'] = ['internal']
......
......@@ -10,7 +10,7 @@ kw = {}
try:
workflow_tool = context.portal_workflow
workflow = getattr(workflow_tool, action['workflow_id'])
except:
except AttributeError:
return {}
# If this is a worklist action, read the worklist definition
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>relation_id_list=[],**kw</string> </value>
<value> <string>relation_id_list=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""
Returns a document by its reference in a gadget.
"""
request = context.REQUEST
portal = context.getPortalObject()
if box_relative_url:
......
from Products.ERP5Type.Message import Message
# XXX for now, we always use the default Base_getODSStyleSheet
# we use to have Base_getODSListStyleSheet with a line at the bottom of
# the page, for better print display. Now we rather agreed that
# ods_style is a style for export, not report and the rendering appearance
# was not so important.
# the page, for better print display and also Base_getODSStyleSheetLandscape
# when landscape mode is used.
# 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
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 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_getEditableFieldDict</string> </value>
<value> <string>ListBox_getEditableFieldDict</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_getReportTreeStructure</string> </value>
<value> <string>ListBox_getReportTreeStructure</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,12 +16,12 @@
selection_name python: listbox.get_value('selection_name', 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)];
editable_fields listbox/Listbox_getEditableFieldDict;
editable_fields listbox/ListBox_getEditableFieldDict;
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);
is_report_tree_mode selection/report_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);
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];
first first | nothing;
global merge_report_section_list python: request.get('merge_report_section_list', False);
......
......@@ -31,38 +31,38 @@ from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.SupplyCell import SupplyCell
class OpenOrderCell(SupplyCell):
"""
An Open Order Cell allows to define specific properties
for each variation of a resource in an Open Order Line.
"""
meta_type = 'ERP5 Open Order Cell'
portal_type = 'Open Order Cell'
add_permission = Permissions.AddPortalContent
"""
An Open Order Cell allows to define specific properties
for each variation of a resource in an Open Order Line.
"""
meta_type = 'ERP5 Open Order Cell'
portal_type = 'Open Order Cell'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.Discount
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.Reference
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.Discount
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.Reference
)
def getTotalPrice(self):
"""Returns the total price for this open order cell.
Unlike Amount, we do not calculate a price implicitly if not defined.
Actually, I (jerome) think amount behaviour itself if wrong.
"""
return (self.getQuantity() or 0) * (self.getPrice() or 0)
def getTotalPrice(self):
"""Returns the total price for this open order cell.
Unlike Amount, we do not calculate a price implicitly if not defined.
Actually, I (jerome) think amount behaviour itself if wrong.
"""
return (self.getQuantity() or 0) * (self.getPrice() or 0)
......@@ -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>OpenOrderCell</string> </value>
......@@ -43,18 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
......@@ -64,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>
......@@ -83,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>
......@@ -92,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>
......
......@@ -32,54 +32,54 @@ from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.SupplyLine import SupplyLine
class OpenOrderLine(SupplyLine):
"""
An Open Order Line is a Supply Line with additional
properties to define repeatability
"""
An Open Order Line is a Supply Line with additional
properties to define repeatability
"""
meta_type = 'ERP5 Open Order Line'
portal_type = 'Open Order Line'
add_permission = Permissions.AddPortalContent
"""
meta_type = 'ERP5 Open Order Line'
portal_type = 'Open Order Line'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.VariationRange
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.Comment
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.VariationRange
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.Comment
)
def getTotalQuantity(self, default=0):
"""Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are
returned.
"""
if self.hasCellContent(base_id='path'):
return sum([cell.getQuantity() for cell in
self.getCellValueList(base_id='path')])
return self.getQuantity(default)
def getTotalQuantity(self, default=0):
"""Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are
returned.
"""
if self.hasCellContent(base_id='path'):
return sum([cell.getQuantity() for cell in
self.getCellValueList(base_id='path')])
return self.getQuantity(default)
def getTotalPrice(self):
"""Returns the total price for this open order line.
If the order line contains cells, the total price of cells are
returned.
"""
if self.hasCellContent(base_id='path'):
return sum([cell.getTotalPrice() for cell in
self.getCellValueList(base_id='path')])
return SupplyLine.getTotalPrice(self)
def getTotalPrice(self):
"""Returns the total price for this open order line.
If the order line contains cells, the total price of cells are
returned.
"""
if self.hasCellContent(base_id='path'):
return sum([cell.getTotalPrice() for cell in
self.getCellValueList(base_id='path')])
return SupplyLine.getTotalPrice(self)
......@@ -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>OpenOrderLine</string> </value>
......@@ -43,25 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
......@@ -71,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>
......@@ -90,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>
......@@ -99,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>
......
......@@ -226,7 +226,7 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return None
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')
if open_order_line is None:
return None
......@@ -262,8 +262,16 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return []
return open_order_line.getSpecialiseValueList()
def _getCategoryMembershipList(self, category, spec=(), filter=None,
portal_type=(), base=0, keep_default=1, checked_permission=None, **kw):
def _getCategoryMembershipList(
self,
category,
spec=(),
filter=None, # pylint:disable=redefined-builtin
portal_type=(),
base=0,
keep_default=1,
checked_permission=None,
**kw):
if category == 'specialise':
open_order_line = self.getAggregateRelatedValue(portal_type='Open Sale Order Line')
return open_order_line._getCategoryMembershipList(category, spec=spec, filter=filter,
......
......@@ -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>SubscriptionItem</string> </value>
......@@ -43,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
......@@ -56,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>
......@@ -75,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>
......@@ -84,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>
......
......@@ -6,10 +6,10 @@ if resource is not None:
for base_category in base_category_list:
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,), 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:
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
......@@ -3,7 +3,7 @@ subscription_item_set = set()
for open_order_line in context.objectValues():
for ob in [open_order_line] + open_order_line.getCellValueList():
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:
subscription_item_set.add(item)
item.updateSimulation(expand_root=1)
subscription_item_set.add(item)
item.updateSimulation(expand_root=1)
......@@ -6,7 +6,7 @@
# - Implement validation of list fields
#
from Products.ERP5Type.Message import translateString
from Products.Formulator.Errors import ValidationError, FormValidationError
from Products.Formulator.Errors import FormValidationError
request=context.REQUEST
......
......@@ -28,15 +28,15 @@ for listbox_dict in listbox:
listbox_key = listbox_dict['listbox_key']
line = [x for x in line_list if x.getPath() == listbox_key][0]
uid = line.getUid()
for property in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(property, None)
key = 'field_listbox_%s_%s' % (property, uid)
for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value
if property == 'solver_configuration':
if prop == 'solver_configuration':
if value is not None:
line.updateConfiguration(**value.as_dict())
else:
line.setProperty(property, value)
line.setProperty(prop, value)
# if divergence solving is already ongoing and will be fixed by activities
if line is None:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
request= context.REQUEST
request = context.REQUEST
from Products.ERP5Type.Message import translateString
listbox = request.get('listbox')
......@@ -12,15 +12,15 @@ for listbox_key in listbox:
listbox_dict = listbox[listbox_key]
line = [x for x in line_list if x.getPath() == listbox_key][0]
uid = line.getUid()
for property in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(property, None)
key = 'field_listbox_%s_%s' % (property, uid)
for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value
if property == 'solver_configuration':
if prop == 'solver_configuration':
if value is not None:
line.updateConfiguration(**value.as_dict())
else:
line.setProperty(property, value)
line.setProperty(prop, value)
request.form['your_dialog_updated'] = '1'
# xhtml style Base_callDialogMethod does not redirected because of the listbox
......
......@@ -50,7 +50,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
......@@ -27,6 +27,7 @@
#
##############################################################################
from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type.ObjectMessage import ObjectMessage
from Products.ERP5Type import Permissions
......@@ -36,19 +37,11 @@ def getLegacyCallableIdItemList(self):
('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
cache)
@transactional_cached()
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()
# Add portal types prefix
......@@ -65,14 +58,15 @@ def getSkinPrefixList(self):
skin_prefix_list.extend(self.portal_types.getMixinTypeList())
# Add interfaces prefix
skin_prefix_list.extend(self.portal_types.getInterfaceTypeList())
# XXX getInterfaceTypeList seems empty ... keep this low-level way for now.
# XXX getInterfaceTypeList does not include file system interfaces ... keep this low-level way for now.
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'):
skin_prefix_list.append(interface_name[1:])
# XXX do we really add with the I prefix ?
skin_prefix_list.append(interface_name)
# XXX do we really add with the I prefix ?
skin_prefix_list.append(interface_name)
# Add other prefix
skin_prefix_list.extend((
......@@ -181,6 +175,7 @@ ignored_skin_id_set = {
'TaskListOverviewGadget_setPreferences',
'TaskListsGadgetListbox_getLineCss',
'InventoryModule_reindexMovementList',
'DeliveryModule_mergeDeliveryList',
}
# Generic method to check consistency of a skin item
......
......@@ -103,6 +103,12 @@ def test_suite():
testclass,
testXHTML.validator,
(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
......
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