Commit a47bf004 authored by Fabien Morin's avatar Fabien Morin

- remove ApparelModelMorphologyVariation PropertySheet, now it's not required to

overload variation_base_category, the default variation_base_category should be
defined on preference
(preferred_apparel_model_individual_variation_base_category_list).
- add init_script on Apparel Model Colour Variation and Apparel Model
Morphology portal_types to automatically set base_category using preferences
- remove variation_base_category from ApparelModelColourVariation
PropertySheet, now it's not needed to overload this property since it should
be define throught preferences
- add field my_variation_base_category on ApparelModelColourVariation_view and
ApparelModelMorphologyVariation_view to show which variation_base_category is
used

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29593 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d4c45bdd
......@@ -27,7 +27,6 @@
<item>ApparelModelColourVariation</item>
</portal_type>
<portal_type id="Apparel Model Morphology Variation">
<item>ApparelModelMorphologyVariation</item>
<item>TransformedResource</item>
</portal_type>
<portal_type id="System Preference">
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A colour variation from apparel model\n
<value> <string>A colour variation from apparel model\r\n
</string> </value>
</item>
<item>
......@@ -67,7 +67,13 @@
</item>
<item>
<key> <string>init_script</string> </key>
<value> <string></string> </value>
<value> <string>ApparelModelColourAndMorphologieVariation_init</string> </value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A morphology variation from apparel model\n
<value> <string>A morphology variation from apparel model\r\n
</string> </value>
</item>
<item>
......@@ -67,7 +67,13 @@
</item>
<item>
<key> <string>init_script</string> </key>
<value> <string></string> </value>
<value> <string>ApparelModelColourAndMorphologieVariation_init</string> </value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -40,21 +40,6 @@ class ApparelModelColourVariation:
'description' : 'define the prototype variation',
'type' : 'boolean',
'mode' : 'w' },
# Override default value XXX
{ 'id' : 'variation_base_category',
'description' : 'A list of base categories which define possible discrete variations. '\
'Variation ranges are stored as category membership. '\
'(prev. variation_category_list).',
'type' : 'tokens',
'default' : ['colour' ],
'mode' : 'r' },
# { 'id' : 'variation_base_category',
# 'description' : 'A list of base categories which define possible discrete variations. '\
# 'Variation ranges are stored as category membership. '\
# '(prev. variation_category_list).',
# 'type' : 'lines',
# 'default' : ('colour', ),
# 'mode' : 'r' },
)
# Trash for better design
##############################################################################
#
# Copyright (c) 2002 Coramy SAS and Contributors. All Rights Reserved.
# Thierry Faucher <Thierry_Faucher@coramy.com>
# Copyright (c) 2004, 2009 Nexedi SA and Contributors. All Rights Reserved.
# Romain Courteaud <romain@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.
#
##############################################################################
class ApparelModelMorphologyVariation:
"""
ApparelModelMorphologyVariation properties and categories
"""
_properties = (
{ 'id' : 'apparel_cloth_title',
'description' : 'title of the apparel clothes used',
'type' : 'lines',
'acquisition_base_category' : ('specialise',),
'acquisition_portal_type' : ('Apparel Cloth',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None,
'mode' : 'w' },
# Override default value XXX
{ 'id' : 'variation_base_category',
'description' : 'A list of base categories which define possible discrete variations. '\
'Variation ranges are stored as category membership. '\
'(prev. variation_category_list).',
'type' : 'tokens',
'default' : ['morphology' ],
'mode' : 'r' },
# { 'id' : 'variation_base_category',
# 'description' : 'A list of base categories which define possible discrete variations. '\
# 'Variation ranges are stored as category membership. '\
# '(prev. variation_category_list).',
# 'type' : 'lines',
# 'default' : ('colour', ),
# 'mode' : 'r' },
)
# XXX _categories = ( 'morpho_type', 'specialise')
# trash for betterimplementation (category)
# remove this feature
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
This script select the good base category according to the portal_type and if\n
the category is in variation range\n
"""\n
\n
portal_type = context.getPortalType()\n
if portal_type in context.getPortalVariationTypeList():\n
portal_type = context.getParentValue().getPortalType()\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
def getIndividualVariationBaseCategoryList(portal_type):\n
result = []\n
#xxx default preference value [] for fix a bug\n
method_name = \'getPreferred%sIndividualVariationBaseCategoryList\' % portal_type.replace(\' \', \'\')\n
method = getattr(context.portal_preferences, method_name)\n
url_list = method([])\n
for url in url_list:\n
base_category = context.portal_categories[url]\n
result.append((base_category.getTranslatedTitle(), base_category.getRelativeUrl()))\n
return result\n
\n
getIndividualVariationBaseCategoryList = CachingMethod(getIndividualVariationBaseCategoryList,\n
id=(script.id, context.Localizer.get_selected_language()),\n
cache_factory=\'erp5_ui_long\')\n
\n
base_category_list = [y for x, y in getIndividualVariationBaseCategoryList(portal_type)]\n
\n
if context.getPortalType() == \'Apparel Model Colour Variation\' and \'colour\' in base_category_list:\n
context.edit(variation_base_category_list=(\'colour\',))\n
elif context.getPortalType() == \'Apparel Model Morphology Variation\' and \'morphology\' in base_category_list:\n
context.edit(variation_base_category_list=(\'morphology\',))\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>args</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_type</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>getIndividualVariationBaseCategoryList</string>
<string>script</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>y</string>
<string>base_category_list</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ApparelModelColourAndMorphologieVariation_init</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -76,6 +76,7 @@
<list>
<string>my_title</string>
<string>my_destination_reference</string>
<string>my_variation_base_category</string>
<string>my_prototype</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_variation_base_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>A list of base categories which define possible discrete variations.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_individual_variation_base_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Resource_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Individual Variation Base Category</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -75,6 +75,7 @@
<value>
<list>
<string>my_title</string>
<string>my_variation_base_category</string>
</list>
</value>
</item>
......@@ -82,7 +83,6 @@
<key> <string>right</string> </key>
<value>
<list>
<string>my_apparel_morpho_type</string>
<string>my_apparel_cloth_title_list</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ListField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_apparel_morpho_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Morphology</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/portal_categories/apparel_morpho_type/getCategoryChildLogicalPathItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_variation_base_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>A list of base categories which define possible discrete variations.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_individual_variation_base_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Resource_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Individual Variation Base Category</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
109
\ No newline at end of file
114
\ No newline at end of file
......@@ -9,6 +9,5 @@ Apparel Component | DefaultSupply
Apparel Consumption | ApparelConsumption
Apparel Fabric Colour Variation | ApparelFabricColourVariation
Apparel Model Colour Variation | ApparelModelColourVariation
Apparel Model Morphology Variation | ApparelModelMorphologyVariation
Apparel Model Morphology Variation | TransformedResource
System Preference | ApparelPreference
\ No newline at end of file
......@@ -6,7 +6,6 @@ ApparelConsumption
ApparelComponent
ApparelModel
ApparelLabel
ApparelModelMorphologyVariation
ApparelColourRangeVariation
ApparelAssortment
ApparelFabricColourVariation
......
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