From c6e6f23ef39b5d034b7de995a784efe2b7f372df Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 18 May 2010 13:19:04 +0000
Subject: [PATCH] introduce force_update property that will enable to update
 existing document even if there are differences.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35430 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/CategoryMovementGroup.py | 2 ++
 product/ERP5/Document/PropertyMovementGroup.py | 2 ++
 product/ERP5/PropertySheet/MovementGroup.py    | 4 ++++
 3 files changed, 8 insertions(+)

diff --git a/product/ERP5/Document/CategoryMovementGroup.py b/product/ERP5/Document/CategoryMovementGroup.py
index 42c9d6710d..443892528a 100644
--- a/product/ERP5/Document/CategoryMovementGroup.py
+++ b/product/ERP5/Document/CategoryMovementGroup.py
@@ -47,6 +47,8 @@ class CategoryMovementGroup(PropertyMovementGroup):
     return property_dict
 
   def test(self, document, property_dict, property_list=None, **kw):
+    if self.isForceUpdate():
+      return True, property_dict
     if property_list not in (None, []):
       target_property_list = [x for x in self.getTestedPropertyList() \
                               if x in property_list]
diff --git a/product/ERP5/Document/PropertyMovementGroup.py b/product/ERP5/Document/PropertyMovementGroup.py
index c6e0a02f5a..7868fd73c6 100644
--- a/product/ERP5/Document/PropertyMovementGroup.py
+++ b/product/ERP5/Document/PropertyMovementGroup.py
@@ -46,6 +46,8 @@ class PropertyMovementGroup(MovementGroup):
     return property_dict
 
   def test(self, document, property_dict, property_list=None, **kw):
+    if self.isForceUpdate():
+      return True, property_dict
     if property_list not in (None, []):
       target_property_list = [x for x in self.getTestedPropertyList() \
                               if x in property_list]
diff --git a/product/ERP5/PropertySheet/MovementGroup.py b/product/ERP5/PropertySheet/MovementGroup.py
index e0da776bd7..969b4377d3 100644
--- a/product/ERP5/PropertySheet/MovementGroup.py
+++ b/product/ERP5/PropertySheet/MovementGroup.py
@@ -32,5 +32,9 @@ class MovementGroup:
        'type'        : 'lines',
        'default'     : (),
        'mode'        : 'w' },
+    {  'id'          : 'force_update',
+       'description' : 'Update always if enabled',
+       'type'        : 'boolean',
+       'mode'        : 'w' },
     )
   _categories = ('collect_order_group', 'divergence_scope',)
-- 
2.30.9