Commit 60616031 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add Mirror Movement Group.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33302 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2c0b1dd4
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/PropertyMovementGroup_view</string> </value>
<value> <string>string:${object_url}/MovementGroup_view</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -21,6 +21,7 @@
<item>Causality Movement Group</item>
<item>Day Movement Group</item>
<item>Delivery Causality Assignment Movement Group</item>
<item>Mirror Movement Group</item>
<item>Monthly Range Movement Group</item>
<item>Nested Line Movement Group</item>
<item>Order Movement Group</item>
......@@ -53,10 +54,15 @@
<item>Category Movement Group</item>
<item>Causality Assignment Movement Group</item>
<item>Causality Movement Group</item>
<item>Day Movement Group</item>
<item>Delivery Causality Assignment Movement Group</item>
<item>Mirror Movement Group</item>
<item>Monthly Range Movement Group</item>
<item>Nested Line Movement Group</item>
<item>Order Movement Group</item>
<item>Parent Explanation Movement Group</item>
<item>Predicate</item>
<item>Property Assignment Movement Group</item>
<item>Property Movement Group</item>
<item>Quantity Sign Movement Group</item>
<item>Requirement Movement Group</item>
......@@ -64,6 +70,7 @@
<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>
<item>Variation Property Movement Group</item>
......
685
\ No newline at end of file
686
\ No newline at end of file
......@@ -36,6 +36,7 @@ Image | download
Image | fullsize_view
Image | view
Link | view
Mirror Movement Group | view
Monthly Range Movement Group | view
Nested Line Movement Group | view
Notification Message Module | view
......
......@@ -9,6 +9,7 @@ Delivery Builder | Causality Assignment Movement Group
Delivery Builder | Causality Movement Group
Delivery Builder | Day Movement Group
Delivery Builder | Delivery Causality Assignment Movement Group
Delivery Builder | Mirror Movement Group
Delivery Builder | Monthly Range Movement Group
Delivery Builder | Nested Line Movement Group
Delivery Builder | Order Movement Group
......@@ -33,10 +34,15 @@ Order Builder | Base Variant Movement Group
Order Builder | Category Movement Group
Order Builder | Causality Assignment Movement Group
Order Builder | Causality Movement Group
Order Builder | Day Movement Group
Order Builder | Delivery Causality Assignment Movement Group
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 Explanation Movement Group
Order Builder | Predicate
Order Builder | Property Assignment Movement Group
Order Builder | Property Movement Group
Order Builder | Quantity Sign Movement Group
Order Builder | Requirement Movement Group
......@@ -44,6 +50,7 @@ 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
Order Builder | Variation Property Movement Group
......
......@@ -24,6 +24,7 @@ Fax
File
Image
Link
Mirror Movement Group
Monthly Range Movement Group
Nested Line Movement Group
Notification Message
......
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5.Document.MovementGroup import MovementGroup
class MirrorMovementGroup(MovementGroup):
"""
For Payment Transaction, we don't care the direction:
* source:A, destination:B, quantity:+10
* source:B, destination:A, quantity:-10
The purpose of MirrorMovementGroup is to make to merge these two
simulation movements into one delivery movement. To do that, we need
to reverse the order with the help of Mapped Property document that
exists in the rule.
"""
meta_type = 'ERP5 Mirror Movement Group'
portal_type = 'Mirror Movement Group'
def _getPropertyDict(self, movement, **kw):
return {}
def test(self, document, property_dict, **kw):
return True, property_dict
def _separate(self, movement_list):
# record if mirrored or not in simulation movements.
mapping_dict = {}
for movement in movement_list:
if _isMirrored(movement):
applied_rule = movement.getParentValue()
# XXX do we need more precise way to find Mapped Property
# document for mirrored?
mapping_list = mapping_dict.setdefault(
applied_rule,
applied_rule.getSpecialiseValue().objectValues(
portal_type='Mapped Property') or [])
if len(mapping_list) > 0:
movement.setMappingValue(mapping_list[0])
return [[movement_list, {}]]
def _isMirrored(document):
# to merge A->B and B->A movements, here we determine if we need to
# reverse or not by just comparing its source_section's id and
# destination_section's id, whose result should be consistent for each
# document.
return document.getDestinationSectionId() <> document.getSourceSectionId()
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