[Erp5-report] r22873 - /erp5/trunk/products/ERP5/Document/Movement.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Aug 4 19:45:52 CEST 2008
Author: jerome
Date: Mon Aug 4 19:45:52 2008
New Revision: 22873
URL: http://svn.erp5.org?rev=22873&view=rev
Log:
_setVariationCategoryList only works if resource is defined, so if
movement.edit(resource=something, variation_category_list=something) is called
and edit edit sets variation_category_list before setting resource, variation
category list will not be set. So make sure that resource is set before
variation_category_list.
Modified:
erp5/trunk/products/ERP5/Document/Movement.py
Modified: erp5/trunk/products/ERP5/Document/Movement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Movement.py?rev=22873&r1=22872&r2=22873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Movement.py (original)
+++ erp5/trunk/products/ERP5/Document/Movement.py Mon Aug 4 19:45:52 2008
@@ -810,7 +810,8 @@
security.declarePrivate('_edit')
def _edit(self, **kw):
"""Overloaded _edit to support setting debit and credit at the same time,
- which is required for the GUI.
+ which is required for the GUI. Also sets the resource first, because
+ _setVariationCategoryList needs the resource to be set.
"""
quantity = 0
if kw.has_key('source_debit') and kw.has_key('source_credit'):
@@ -821,7 +822,11 @@
quantity += (kw.pop('destination_debit') or 0 -
kw.pop('destination_credit') or 0)
kw['quantity'] = quantity
- XMLObject._edit(self, **kw)
+ if 'resource' in kw:
+ self._setResource(kw.pop('resource'))
+ if 'resource_value' in kw:
+ self._setResourceValue(kw.pop('resource_value'))
+ return XMLObject._edit(self, **kw)
# Debit and credit methods for asset
security.declareProtected( Permissions.AccessContentsInformation,
More information about the Erp5-report
mailing list