Commit 11f769f6 authored by Jérome Perrin's avatar Jérome Perrin

ERP5: Remove getVariationValue/setVariationValue

This was early designed replaced by Individual (Product|Service) Variation

This conflicts with category accessors generated from variation base
category
parent c4a2f8b6
master ERP5ify-portal_workfow_yusei_20210303 UpdateValidationStateFromConsistency addToDate_implicit_localtime arnau arnau-RD-Components-CacheTool arnau-RD-Components-ERP5Form-ERP5Report arnau-RD-Components-ERP5Form-SelectionTool-MemcachedTool arnau-RD-Components-ERP5OOo arnau-RD-Components-PreferenceTool-Preference arnau-RD-Components-Products-import-compat arnau-RD-Components-astroid_cache_per_component_reset arnau-RD-Components-erp5_crm arnau-RD-Components-erp5_trade-TODO-Interactor arnau-RD-ERP5ify-portal_workflow arnau-RD-ERP5ify-portal_workflow-1-seb-merged-with-recent-master arnau-RD-ERP5ify-portal_workflow-2-do-not-rename-erp5_workflow-portal_types arnau-RD-ERP5ify-portal_workflow-BAK arnau-RD-ERP5ify-portal_workflow-WIP arnau-RD-ERP5ify-portal_workflow-WITHOUT-MIGRATION arnau-RD-ERP5ify-portal_workflow-WORKFLOWS-NOT-MIGRATED arnau-TM-Components-Migrate-PortalTransforms arnau-TM-Components-ModuleSecurityInfo arnau-TM-FEC-output arnau-TM-WIP arnau-TM-isBuildable-with-multiple-BusinessLinks arnau-TM-newContent-temp_object arnau-TM-runUnitTest-clear-previous-execution-catalog arnau-TM-wkhtmltopdf arnau-WIP arnau-real-time-inventory-accounting bt5_config cache-control-304-response callable-jupyter-storage catalog_filter cherry-pick-4a8e045d cleanup_acquisition_base_category cloud_reliability_test cribjs-bootloader delivery_item_barcode display_tools_in_erp5js dsn-phase3 enhance_scalability_testing erp5-component erp5-imt erp5-messenger erp5-vifib erp5_catalog erp5_catalog_final erp5_corporate_identity erp5_hal_json_style_fix_restricted_access_with_traverse erp5_payslip_migration erp5testnode_max_timeout feat/dms_implicit_predecessor_successor_fields feat/erp5_ide feat/inventory_api_group_by_time_interval_list feat/notification-message-ignore-missing feat/olapy feat/python_language_support feat/show_user_on_logout_page feat/slapos-computer-partition-capabilities feat/trim_username feat/update-ckeditor feature/renderjs-ui-no-header fix/ZMI_editor_preference fix/advance_ecommerce_coding_crimes fix/business-template-update-tool fix/cmf_activity_global_request fix/component-editor fix/getParent fix/login_validate_check_consistency fix/organisation_jump fix/support-request-app-empty fix/test_result_after_mep fix/workflow_method_security fix_web_illustration for_testrunner_1 for_testrunner_2 for_testrunner_3 gadget-json-value hotfix/rjs-formfields-padding initsite inventory jm/form-action-guard js-ui limit_accelerated_http_cache_manager listbox_url lle-bout/metadata-modules macros_fix mic_wind monitoring-graph mr1362 my2to3 no_longer_simulated_state notebook_roque override_cache_control_header_by_caching_policy_manager portal_callables publish_recursiveReindexObject refactor/base_edit reindex_calendar_after_change_calendar_exception restore-from-trashbin revert-38554dbe rjs_listbox_sort_icon scalability-master scalability-roque scalability-roque-2 scalability-run-command scalability_crash_mariadb shop-box-rebase streaming_fix streaming_fix-0 support_relative_url_in_hyperlink_field support_request taskdistribution-xmlrpc-binary test-renderjs-float-field-step testnode_shorter_paths trustable-x-forwarded-for ttrm unify_predicate_edit valentin_translation_fix view-aggregated-amounts wsgi wsgi-gevent wsgi_backport_setbody_lock wsgi_medusa_stream_fix yusei_20210303 0.4.59.1 0.4.59 test-ui test-rjsacc test-rjs renderjs-test nexedi-erp5-vifib-20201105 erp5.util-0.4.69 erp5.util-0.4.68 erp5.util-0.4.67 erp5.util-0.4.66 erp5.util-0.4.65 erp5.util-0.4.64 erp5.util-0.4.63 erp5.util-0.4.62 erp5.util-0.4.61 erp5.util-0.4.60 erp5.util-0.4.59.1 erp5.util-0.4.59 erp5.util-0.4.58 erp5.util-0.4.57 erp5.util-0.4.56 erp5.util-0.4.55 erp5.util-0.4.54 erp5.util-0.4.53 erp5.util-0.4.52 erp5.util-0.4.49 erp5.util-0.4.46 erp5-vifib-20201229 erp5-vifib-20200129
No related merge requests found
......@@ -32,7 +32,6 @@ from collections import defaultdict
from math import log
from AccessControl import ClassSecurityInfo
from Products.ERP5.mixin.variated import VariatedMixin
from Products.ERP5.VariationValue import VariationValue
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Base import Base
from Products.CMFCategory.Renderer import Renderer
......@@ -47,9 +46,6 @@ class Amount(Base, VariatedMixin):
A mix-in class which provides some utilities
(variations, conversions, etc.)
Utilities include
- getVariation accesors (allows to access variations of whatever)
-
"""
......@@ -188,28 +184,6 @@ class Amount(Base, VariatedMixin):
self.getVariationBaseCategoryList(),
display_id=display_id,**kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getVariationValue')
def getVariationValue(self):
"""
New Method for dicrete and countinuous variations
using a VariantValue instance
A new instance of VariationValue is created with categories
and attributes set to what they should be.
A this point, we only implement discrete variations
"""
return VariationValue(context = self)
def _setVariationValue(self, variation_value):
return variation_value.setVariationValue(self)
security.declareProtected(Permissions.ModifyPortalContent, 'setVariationValue')
def setVariationValue(self, variation_value):
self._setVariationValue(variation_value)
self.reindexObject()
security.declareProtected(Permissions.AccessContentsInformation, \
'getVariationRangeCategoryItemList')
def getVariationRangeCategoryItemList(self, *args, **kw):
......
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type import interfaces
from Products.ERP5Type.Context import Context
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5.mixin.variated import VariatedMixin
from zope.interface import implements
def newVariationValue(context=None, REQUEST=None, **kw):
# Create context object
context_obj = VariationValue(context=context, REQUEST=REQUEST, **kw)
# Wrap the context
if context is not None:
return context_obj.asContext(context = context)
else:
return context_obj
class VariationValue(Context, VariatedMixin):
"""
Embodies a variation value. Implements discrete variations.
"""
# Declarative interfaces
implements(interfaces.IVariated)
def __init__(self, context=None, REQUEST=None, **kw):
Context.__init__(self, context=context, REQUEST=REQUEST, **kw)
if hasattr(self, 'categories'):
self.categories = getattr(self,'categories')
elif hasattr(REQUEST,'categories'):
self.categories = getattr(REQUEST,'categories')
else:
self.categories = context.getVariationCategoryList()
def setVariationValue(self, context):
context.setVariationCategoryList(self.categories)
def __cmp__(self, other):
same = 0
a = getattr(self, 'categories', ())
b = getattr(other, 'categories', ())
for ka in a:
if not ka in b:
same = 1
for kb in b:
if not kb in a:
same = -1
return same
InitializeClass(VariationValue)
......@@ -53,7 +53,7 @@ class IVariated(Interface):
# The following methods are intended to access to the
# variation value of a variated object. Discrete variations
# are based on categories. General variations are encapsulated
# into VariationValue instances.
# into Individual Variation instances.
# Property Variation Accessors
def getVariationPropertyList():
......
......@@ -370,16 +370,6 @@ class VariatedMixin:
# display is on left
return [x[1] for x in vrcil]
# Context related methods
security.declarePublic('newVariationValue')
def newVariationValue(self, context=None, REQUEST=None, **kw):
# PERFORMANCE ISSUE
from Products.ERP5.VariationValue import newVariationValue
if context is None:
return newVariationValue(REQUEST=REQUEST, **kw)
else:
return newVariationValue(context=context, REQUEST=REQUEST, **kw)
# Provide a string representation of variations
security.declarePublic('getVariationText')
def getVariationText(self):
......
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