Commit 7b5a46bb authored by Jérome Perrin's avatar Jérome Perrin

_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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22873 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a3c1d023
...@@ -810,7 +810,8 @@ class Movement(XMLObject, Amount): ...@@ -810,7 +810,8 @@ class Movement(XMLObject, Amount):
security.declarePrivate('_edit') security.declarePrivate('_edit')
def _edit(self, **kw): def _edit(self, **kw):
"""Overloaded _edit to support setting debit and credit at the same time, """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 quantity = 0
if kw.has_key('source_debit') and kw.has_key('source_credit'): if kw.has_key('source_debit') and kw.has_key('source_credit'):
...@@ -821,7 +822,11 @@ class Movement(XMLObject, Amount): ...@@ -821,7 +822,11 @@ class Movement(XMLObject, Amount):
quantity += (kw.pop('destination_debit') or 0 - quantity += (kw.pop('destination_debit') or 0 -
kw.pop('destination_credit') or 0) kw.pop('destination_credit') or 0)
kw['quantity'] = quantity 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 # Debit and credit methods for asset
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
......
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