Commit 109651e9 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

introduce Parent Delivery Property Movement Group and Parent Delivery Category...

introduce Parent Delivery Property Movement Group and Parent Delivery Category Movement Group, that should be useful to check payment condition values for grouping.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33493 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 926b4bdd
......@@ -25,6 +25,8 @@
<item>Monthly Range Movement Group</item>
<item>Nested Line Movement Group</item>
<item>Order Movement Group</item>
<item>Parent Delivery Category Movement Group</item>
<item>Parent Delivery Property Movement Group</item>
<item>Parent Explanation Movement Group</item>
<item>Predicate</item>
<item>Property Assignment Movement Group</item>
......@@ -32,9 +34,7 @@
<item>Quantity Sign Movement Group</item>
<item>Requirement Movement Group</item>
<item>Root Applied Rule Causality Movement Group</item>
<item>Split Category Movement Group</item>
<item>Split Movement Group</item>
<item>Split Property Movement Group</item>
<item>Tax Line Delivery Movement Group</item>
<item>Title Movement Group</item>
<item>Variant Movement Group</item>
......@@ -60,6 +60,8 @@
<item>Monthly Range Movement Group</item>
<item>Nested Line Movement Group</item>
<item>Order Movement Group</item>
<item>Parent Delivery Category Movement Group</item>
<item>Parent Delivery Property Movement Group</item>
<item>Parent Explanation Movement Group</item>
<item>Predicate</item>
<item>Property Assignment Movement Group</item>
......@@ -67,9 +69,7 @@
<item>Quantity Sign Movement Group</item>
<item>Requirement Movement Group</item>
<item>Root Applied Rule Causality Movement Group</item>
<item>Split Category Movement Group</item>
<item>Split Movement Group</item>
<item>Split Property Movement Group</item>
<item>Tax Line Delivery Movement Group</item>
<item>Title Movement Group</item>
<item>Variant Movement Group</item>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Split Category Movement Group</string> </value>
<value> <string>ERP5 Parent Delivery Category Movement Group</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -29,7 +29,7 @@
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addSplitCategoryMovementGroup</string> </value>
<value> <string>addParentDeliveryCategoryMovementGroup</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
......@@ -45,7 +45,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Split Category Movement Group</string> </value>
<value> <string>Parent Delivery Category Movement Group</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Split Property Movement Group</string> </value>
<value> <string>ERP5 Parent Delivery Property Movement Group</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -29,7 +29,7 @@
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addSplitPropertyMovementGroup</string> </value>
<value> <string>addParentDeliveryPropertyMovementGroup</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
......@@ -45,7 +45,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Split Property Movement Group</string> </value>
<value> <string>Parent Delivery Property Movement Group</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
......
692
\ No newline at end of file
693
\ No newline at end of file
......@@ -57,6 +57,8 @@ Organisation | document_view
Organisation | financial_view
Organisation | jump_to_persons
Organisation | view
Parent Delivery Category Movement Group | view
Parent Delivery Property Movement Group | view
Parent Explanation Movement Group | view
Person Module | view
Person | assignment
......@@ -81,9 +83,7 @@ Root Applied Rule Causality Movement Group | view
Rounding Model | predicate_view
Rounding Model | view
Rounding Tool | view
Split Category Movement Group | view
Split Movement Group | view
Split Property Movement Group | view
Tax Line Delivery Movement Group | view
Telephone | change_function
Telephone | view
......
......@@ -13,6 +13,8 @@ Delivery Builder | Mirror Movement Group
Delivery Builder | Monthly Range Movement Group
Delivery Builder | Nested Line Movement Group
Delivery Builder | Order Movement Group
Delivery Builder | Parent Delivery Category Movement Group
Delivery Builder | Parent Delivery Property Movement Group
Delivery Builder | Parent Explanation Movement Group
Delivery Builder | Predicate
Delivery Builder | Property Assignment Movement Group
......@@ -20,9 +22,7 @@ Delivery Builder | Property Movement Group
Delivery Builder | Quantity Sign Movement Group
Delivery Builder | Requirement Movement Group
Delivery Builder | Root Applied Rule Causality Movement Group
Delivery Builder | Split Category Movement Group
Delivery Builder | Split Movement Group
Delivery Builder | Split Property Movement Group
Delivery Builder | Tax Line Delivery Movement Group
Delivery Builder | Title Movement Group
Delivery Builder | Variant Movement Group
......@@ -40,6 +40,8 @@ Order Builder | Mirror Movement Group
Order Builder | Monthly Range Movement Group
Order Builder | Nested Line Movement Group
Order Builder | Order Movement Group
Order Builder | Parent Delivery Category Movement Group
Order Builder | Parent Delivery Property Movement Group
Order Builder | Parent Explanation Movement Group
Order Builder | Predicate
Order Builder | Property Assignment Movement Group
......@@ -47,9 +49,7 @@ Order Builder | Property Movement Group
Order Builder | Quantity Sign Movement Group
Order Builder | Requirement Movement Group
Order Builder | Root Applied Rule Causality Movement Group
Order Builder | Split Category Movement Group
Order Builder | Split Movement Group
Order Builder | Split Property Movement Group
Order Builder | Tax Line Delivery Movement Group
Order Builder | Title Movement Group
Order Builder | Variant Movement Group
......
......@@ -35,6 +35,8 @@ Order Movement Group
Order Tool
Organisation
Organisation Module
Parent Delivery Category Movement Group
Parent Delivery Property Movement Group
Parent Explanation Movement Group
Person
Person Module
......@@ -50,9 +52,7 @@ Role Definition
Root Applied Rule Causality Movement Group
Rounding Model
Rounding Tool
Split Category Movement Group
Split Movement Group
Split Property Movement Group
Tax Line Delivery Movement Group
Telephone
Title Movement Group
......
......@@ -25,24 +25,28 @@
#
##############################################################################
from Products.ERP5.Document.CategoryMovementGroup import CategoryMovementGroup
from Products.ERP5.Document.ParentDeliveryPropertyMovementGroup \
import ParentDeliveryPropertyMovementGroup
class SplitCategoryMovementGroup(CategoryMovementGroup):
class ParentDeliveryCategoryMovementGroup(ParentDeliveryPropertyMovementGroup):
"""
Split Category Movement Group is similar to Category Movement Group,
but it does grouping only by specified category values and do not
update documents.
Parent Delivery Category Movement Group is similar to Category
Movement Group, but it does grouping only by specified category values
on its parent simulation movement's delivery value and do not update
documents.
This is useful for acquired properties like payment_condition_*.
"""
meta_type = 'ERP5 Split Category Movement Group'
portal_type = 'Split Category Movement Group'
meta_type = 'ERP5 Parent Delivery Category Movement Group'
portal_type = 'Parent Delivery Category Movement Group'
def _getPropertyDict(self, movement, **kw):
property_dict = {}
for prop in self.getTestedPropertyList():
property_dict['_%s_list' % prop] = sorted(
movement.getPropertyList(prop))
parent_delivery = self._getParentDelivery(movement)
if parent_delivery is not None:
for prop in self.getTestedPropertyList():
property_dict['_%s_list' % prop] = sorted(
movement.getPropertyList(prop))
return property_dict
def test(self, document, property_dict, property_list=None, **kw):
......
......@@ -27,21 +27,24 @@
from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup
class SplitPropertyMovementGroup(PropertyMovementGroup):
class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
"""
Split Property Movement Group is similar to Property Movement Group,
but it does grouping only by specified property values and do not
update documents.
Parent Delivery Property Movement Group is similar to Property
Movement Group, but it does grouping only by specified category values
on its parent simulation movement's delivery value and do not update
documents.
This is useful for acquired properties like payment_condition_*.
"""
meta_type = 'ERP5 Split Property Movement Group'
portal_type = 'Split Property Movement Group'
meta_type = 'ERP5 Parent Delivery Property Movement Group'
portal_type = 'Parent Delivery Property Movement Group'
def _getPropertyDict(self, movement, **kw):
property_dict = {}
for prop in self.getTestedPropertyList():
property_dict['_%s' % prop] = movement.getProperty(prop, None)
parent_delivery = self._getParentDelivery(movement)
if parent_delivery is not None:
for prop in self.getTestedPropertyList():
property_dict['_%s' % prop] = parent_delivery.getProperty(prop, None)
return property_dict
def test(self, document, property_dict, property_list=None, **kw):
......@@ -54,3 +57,14 @@ class SplitPropertyMovementGroup(PropertyMovementGroup):
if property_dict['_%s' % prop] != document.getProperty(prop, None):
return False, property_dict
return True, property_dict
def _getParentDelivery(self, movement):
# try to find local payment conditions from the upper level delivery
rule = movement.getParentValue()
movement = rule.getParentValue()
delivery = movement.getDeliveryValue()
while delivery is None and not(rule.isRootAppliedRule()):
rule = movement.getParentValue()
movement = rule.getParentValue()
delivery = movement.getDeliveryValue()
return delivery
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