[Erp5-report] r37590 yo - /erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Aug 6 09:45:33 CEST 2010
Author: yo
Date: Fri Aug 6 09:45:31 2010
New Revision: 37590
URL: http://svn.erp5.org?rev=37590&view=rev
Log:
Initial import.
Added:
erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py
Added: erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py?rev=37590&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py (added)
+++ erp5/trunk/products/ERP5/Document/InvoiceMovementGroup.py [utf8] Fri Aug 6 09:45:31 2010
@@ -0,0 +1,57 @@
+##############################################################################
+#
+# 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 InvoiceMovementGroup(MovementGroup):
+ """
+ This movement group is used to collect movements related to the same
+ invoice. This movement group should be used in delivery level.
+ """
+ meta_type = 'ERP5 Invoice Movement Group'
+ portal_type = 'Invoice Movement Group'
+
+ def _getPropertyDict(self, movement, **kw):
+ return dict(_invoice_uid=self._getInvoiceUid(movement))
+
+ def test(self, document, property_dict, property_list=None, **kw):
+ if property_dict['_invoice_uid'] != document.getUid():
+ return False, {}
+ else:
+ return True, {}
+
+ def _getInvoiceUid(self, simulation_movement):
+ parent_rule = simulation_movement.getParentValue()
+ while not parent_rule.isRootAppliedRule():
+ parent_simulation_movement = parent_rule.getParentValue()
+ grand_parent_rule = parent_simulation_movement.getParentValue()
+ parent_delivery = parent_simulation_movement.getDeliveryValue()
+ if parent_delivery is not None and \
+ parent_delivery.getPortalType() == 'Invoice Line':
+ return parent_delivery.getExplanationValue().getUid()
+ parent_rule = grand_parent_rule
+ return None
More information about the Erp5-report
mailing list