Commit ce84faa8 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Get rid of acquisition_sync_value. This property was initially

designed to handle synchronization problems between 2 ERP5 systems
however the logic of synchronization should be handled by conduits and
not by accessors



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43653 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9ddf84a
......@@ -106,7 +106,6 @@
<string>my_acquisition_append_value</string>
<string>my_acquisition_copy_value</string>
<string>my_acquisition_mask_value</string>
<string>my_acquisition_sync_value</string>
<string>my_category_type_list</string>
</list>
</value>
......
217
\ No newline at end of file
218
\ No newline at end of file
......@@ -923,8 +923,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
acquisition_mask_value -- if set to 1, the value of the category of self
has priority on the looked up value
acquisition_sync_value -- if set to 1, keep self and looked up value in sync
_acquired_object_set is a special, internal parameter to deal with
recursive calls on the same object.
......@@ -1064,9 +1062,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
result.extend(new_result)
elif len(new_result) > 0:
#LOG("new_result ",0,str(new_result))
if (len(original_result) == 0 \
and base_category_value.getAcquisitionCopyValue()) \
or base_category_value.getAcquisitionSyncValue():
if len(original_result) == 0 \
and base_category_value.getAcquisitionCopyValue():
# If copy is set and result was empty, then copy it once
# If sync is set, then copy it again
self.setCategoryMembership( context, base_category, new_result,
......@@ -1076,8 +1073,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
if len(result) > 0 \
and (base_category_value.getAcquisitionCopyValue() \
or base_category_value.getAcquisitionSyncValue()):
and base_category_value.getAcquisitionCopyValue():
# If copy is set and result was empty, then copy it once
# If sync is set, then copy it again
self.setCategoryMembership( context, base_category, result,
......
......@@ -68,11 +68,6 @@ class BaseCategory:
'type' : 'boolean',
'default' : 0,
'mode' : 'w' },
{ 'id' : 'acquisition_sync_value',
'description' : 'Determines if the acquired value should be synced',
'type' : 'boolean',
'default' : 0,
'mode' : 'w' },
{ 'id' : 'read_permission',
'description' : 'permission needed to access Getters',
'type' : 'string',
......
......@@ -142,7 +142,6 @@ class TestCMFCategory(ERP5TypeTestCase):
portal_categories[bc].setAcquisitionMaskValue(0)
portal_categories[bc].setAcquisitionCopyValue(0)
portal_categories[bc].setAcquisitionAppendValue(0)
portal_categories[bc].setAcquisitionSyncValue(1)
portal_categories[bc].setAcquisitionObjectIdList(['default_career'])
for bc in ('gender', ):
if not hasattr(portal_categories, bc):
......@@ -151,7 +150,6 @@ class TestCMFCategory(ERP5TypeTestCase):
portal_categories[bc].setAcquisitionMaskValue(0)
portal_categories[bc].setAcquisitionCopyValue(0)
portal_categories[bc].setAcquisitionAppendValue(0)
portal_categories[bc].setAcquisitionSyncValue(1)
portal_categories[bc].setFallbackBaseCategoryList(['subordination'])
def beforeTearDown(self):
......
......@@ -125,7 +125,6 @@ class AssortedResource(TransformedResource):
'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0,
'acquisition_accessor_id' : 'getVariationBaseCategoryList', ### XXX BUG
'acquisition_depends' : None,
'mode' : 'w' },
......
......@@ -110,7 +110,6 @@ def setBaseAcquisition(self):
pc[bc].setAcquisitionMaskValue(0)
pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0)
pc[bc].setAcquisitionSyncValue(1)
pc[bc].setAcquisitionObjectIdList(['default_career'])
# Immobilisation acquisition
for bc in ('input_account', 'output_account', 'immobilisation_account',
......
......@@ -108,7 +108,6 @@
<string>my_acquisition_copy_value</string>
<string>my_acquisition_mask_value</string>
<string>my_acquisition_append_value</string>
<string>my_acquisition_sync_value</string>
<string>my_category_type_list</string>
<string>my_translated_validation_state_title</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>default</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_acquisition_sync_value</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>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<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>Determines if the acquired value should be synced</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_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>Acquisition Sync Value</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getAcquisitionSyncValue()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
40904
\ No newline at end of file
40905
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/boolean</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Determines if the acquired value should be synced</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>acquisition_sync_value_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string>w</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: 0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
3
\ No newline at end of file
4
\ No newline at end of file
......@@ -48,7 +48,6 @@ class DefaultGetter(BaseGetter):
acquisition_accessor_id,
acquisition_copy_value,
acquisition_mask_value,
acquisition_sync_value,
storage_id=None,
alt_accessor_id = None,
acquisition_object_id=None,
......@@ -78,7 +77,6 @@ class DefaultGetter(BaseGetter):
self._acquisition_accessor_id = acquisition_accessor_id
self._acquisition_copy_value = acquisition_copy_value
self._acquisition_mask_value = acquisition_mask_value
self._acquisition_sync_value = acquisition_sync_value
if storage_id is None:
storage_id = "%s%s" % (ATTRIBUTE_PREFIX, key)
self._storage_id = storage_id
......@@ -106,7 +104,6 @@ class DefaultGetter(BaseGetter):
accessor_id=self._acquisition_accessor_id,
copy_value=self._acquisition_copy_value,
mask_value=self._acquisition_mask_value,
sync_value=self._acquisition_sync_value,
storage_id=self._storage_id,
alt_accessor_id=self._alt_accessor_id,
acquisition_object_id=self._acquisition_object_id,
......@@ -138,7 +135,6 @@ class ListGetter(BaseGetter):
acquisition_accessor_id,
acquisition_copy_value,
acquisition_mask_value,
acquisition_sync_value,
storage_id=None,
alt_accessor_id = None,
acquisition_object_id=None,
......@@ -168,7 +164,6 @@ class ListGetter(BaseGetter):
self._acquisition_accessor_id = acquisition_accessor_id
self._acquisition_copy_value = acquisition_copy_value
self._acquisition_mask_value = acquisition_mask_value
self._acquisition_sync_value = acquisition_sync_value
if storage_id is None:
storage_id = "%s%s" % (ATTRIBUTE_PREFIX, key)
self._storage_id = storage_id
......@@ -197,7 +192,6 @@ class ListGetter(BaseGetter):
accessor_id=self._acquisition_accessor_id,
copy_value=self._acquisition_copy_value,
mask_value=self._acquisition_mask_value,
sync_value=self._acquisition_sync_value,
storage_id=self._storage_id,
alt_accessor_id=self._alt_accessor_id,
acquisition_object_id=self._acquisition_object_id,
......
......@@ -51,7 +51,6 @@ class Getter(BaseGetter):
acquisition_accessor_id,
acquisition_copy_value,
acquisition_mask_value,
acquisition_sync_value,
storage_id=None,
alt_accessor_id = None,
acquisition_object_id=None,
......@@ -82,7 +81,6 @@ class Getter(BaseGetter):
self._acquisition_accessor_id = acquisition_accessor_id
self._acquisition_copy_value = acquisition_copy_value
self._acquisition_mask_value = acquisition_mask_value
self._acquisition_sync_value = acquisition_sync_value
self._acquired_property = acquired_property
if storage_id is None:
storage_id = "%s%s" % (ATTRIBUTE_PREFIX, key)
......@@ -103,7 +101,6 @@ class Getter(BaseGetter):
accessor_id=self._acquisition_accessor_id,
copy_value=self._acquisition_copy_value,
mask_value=self._acquisition_mask_value,
sync_value=self._acquisition_sync_value,
storage_id=self._storage_id,
alt_accessor_id=self._alt_accessor_id,
acquisition_object_id=self._acquisition_object_id,
......@@ -140,7 +137,6 @@ class Setter(BaseSetter):
acquisition_accessor_id,
acquisition_copy_value,
acquisition_mask_value,
acquisition_sync_value,
storage_id=None,
alt_accessor_id = None,
acquisition_object_id = None,
......@@ -171,7 +167,6 @@ class Setter(BaseSetter):
self._acquisition_accessor_id = acquisition_accessor_id
self._acquisition_copy_value = acquisition_copy_value
self._acquisition_mask_value = acquisition_mask_value
self._acquisition_sync_value = acquisition_sync_value
self._acquired_property = acquired_property
if storage_id is None:
storage_id = "%s%s" % (ATTRIBUTE_PREFIX, key)
......
......@@ -204,7 +204,6 @@ class AcquiredPropertyGetter(AcquiredProperty.Getter):
accessor_id=self._acquisition_accessor_id,
copy_value=self._acquisition_copy_value,
mask_value=self._acquisition_mask_value,
sync_value=self._acquisition_sync_value,
storage_id=self._storage_id,
alt_accessor_id=self._alt_accessor_id,
acquisition_object_id=self._acquisition_object_id,
......
......@@ -911,7 +911,7 @@ class Base( CopyContainer,
# Generic accessor
def _getDefaultAcquiredProperty(self, key, default_value, null_value,
acquisition_object_id=None, base_category=None, portal_type=None,
copy_value=0, mask_value=0, sync_value=0, accessor_id=None, depends=None,
copy_value=0, mask_value=0, accessor_id=None, depends=None,
storage_id=None, alt_accessor_id=None, is_list_type=0, is_tales_type=0,
checked_permission=None):
"""
......@@ -935,15 +935,13 @@ class Base( CopyContainer,
mask_value -- if set to 1, the value of the attribute of self
has priority on the looked up value
sync_value -- if set to 1, keep self and looked up value in sync
accessor_id -- the id of the accessor to call on the related filtered objects
depends -- a list of parameters to propagate in the look up process
acquisition_object_id -- List of object Ids where look up properties
before looking up on acquired objects
The purpose of copy_value / mask_value / sync_value is to solve issues
The purpose of copy_value / mask_value is to solve issues
related to relations and synchronisation of data. copy_value determines
if a value should be copied as an attribute of self. Copying a value is
useful for example when we do invoices and want to remember the price at
......@@ -976,7 +974,7 @@ class Base( CopyContainer,
portal_type = ()
acquisition_key = ('_getDefaultAcquiredProperty', self.getPath(), key,
acquisition_object_id, base_category, portal_type,
copy_value, mask_value, sync_value, accessor_id, depends,
copy_value, mask_value, accessor_id, depends,
storage_id, alt_accessor_id, is_list_type, is_tales_type,
checked_permission)
if acquisition_key in tv:
......@@ -1142,7 +1140,7 @@ class Base( CopyContainer,
pass
def _getAcquiredPropertyList(self, key, default_value, null_value,
base_category, portal_type=None, copy_value=0, mask_value=0, sync_value=0, append_value=0,
base_category, portal_type=None, copy_value=0, mask_value=0, append_value=0,
accessor_id=None, depends=None, storage_id=None, alt_accessor_id=None,
acquisition_object_id=None,
is_list_type=0, is_tales_type=0, checked_permission=None):
......@@ -1162,8 +1160,8 @@ class Base( CopyContainer,
elif portal_type is None:
portal_type = ()
acquisition_key = ('_getAcquiredPropertyList', self.getPath(), key, base_category,
portal_type, copy_value, mask_value, sync_value,
accessor_id, depends, storage_id, alt_accessor_id,
portal_type, copy_value, mask_value, accessor_id,
depends, storage_id, alt_accessor_id,
acquisition_object_id, is_list_type, is_tales_type,
checked_permission)
if acquisition_key in tv:
......
......@@ -86,13 +86,6 @@ class BaseCategoryDocumentationHelper(DocumentationHelper):
"""
return self.getDocumentedObject().getAcquisitionCopyValue() and 'True' or 'False'
security.declareProtected(Permissions.AccessContentsInformation, 'getAcquisitionSyncValue')
def getAcquisitionSyncValue(self):
"""
Returns the value of acquisition sync value of the documented base category
"""
return self.getDocumentedObject().getAcquisitionSyncValue() and 'True' or 'False'
security.declareProtected(Permissions.AccessContentsInformation, 'getAcquisitionBaseCategoryList')
def getAcquisitionBaseCategoryList(self):
"""
......
......@@ -1684,7 +1684,6 @@ def createDefaultAccessors(property_holder, id, prop = None,
prop['acquisition_accessor_id'],
prop.get('acquisition_copy_value',0),
prop.get('acquisition_mask_value',0),
prop.get('acquisition_sync_value',0),
prop.get('storage_id'),
prop.get('alt_accessor_id'),
prop.get('acquisition_object_id'),
......@@ -1767,7 +1766,6 @@ def createDefaultAccessors(property_holder, id, prop = None,
prop['acquisition_accessor_id'],
prop.get('acquisition_copy_value',0),
prop.get('acquisition_mask_value',0),
prop.get('acquisition_sync_value',0),
prop.get('storage_id'),
prop.get('alt_accessor_id'),
prop.get('acquisition_object_id'),
......@@ -2773,7 +2771,6 @@ def createTranslationAcquiredPropertyAccessors(
property['acquisition_accessor_id'],
property.get('acquisition_copy_value',0),
property.get('acquisition_mask_value',0),
property.get('acquisition_sync_value',0),
property.get('storage_id'),
property.get('alt_accessor_id'),
property.get('acquisition_object_id'),
......@@ -2826,7 +2823,6 @@ def createTranslationAcquiredPropertyAccessors(
property['acquisition_accessor_id'],
property.get('acquisition_copy_value',0),
property.get('acquisition_mask_value',0),
property.get('acquisition_sync_value',0),
property.get('storage_id'),
property.get('alt_accessor_id'),
property.get('acquisition_object_id'),
......
......@@ -1102,7 +1102,6 @@ Inside PropertySheet: programmable acquisition
'acquisition_portal_type' : ('Organisation',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0,
'acquisition_append_value' : 0,
'acquisition_accessor_id' : 'getDefaultAddress',
'acquisition_depends' : None,
......@@ -1135,11 +1134,6 @@ Inside PropertySheet: programmable acquisition
in synchronization processes where we do not want to erase
some data entered in documents, yet use the propper data.
- *acquisition_sync_value*: keep local property and
acquired property in sync. For example, if
we change the address localy, the address should be updated
on the acquired property.
- *acquisition_append_value*: all acquired properties
should be appended in a list
......@@ -1169,7 +1163,7 @@ Open Questions
Q2
Define the semantics of combination of acquisition_copy_value, acquisition_mask_value,
acquisition_sync_value and acquisition_append_value.
and acquisition_append_value.
Not Integrated
......@@ -1186,7 +1180,6 @@ Not Integrated
'acquisition_portal_type' : ('Organisation',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1,
'acquisition_sync_value' : 0,
'acquisition_accessor_id' : 'getDefaultTelephone',
'acquisition_depends' : None,
'mode' : 'w' },
......
......@@ -433,7 +433,6 @@ PropertySheets
copy_value
mask_value
sync_value
Future
......
......@@ -1206,8 +1206,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
'acquisition_portal_type' : "python: ( 'Person', )",
'acquisition_accessor_id' : 'getDefaultOrganisationValue',
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1,
'acquisition_sync_value' : 0,
'acquisition_mask_value' : 1
}
def test_19_AcquiredContentAccessor(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