Commit 85ab90fd authored by Jérome Perrin's avatar Jérome Perrin

use edit_order argument to force setting resource before other paramters


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25183 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bba353c3
...@@ -808,7 +808,7 @@ class Movement(XMLObject, Amount): ...@@ -808,7 +808,7 @@ class Movement(XMLObject, Amount):
setDestinationCredit = setSourceDebit setDestinationCredit = setSourceDebit
security.declarePrivate('_edit') security.declarePrivate('_edit')
def _edit(self, **kw): def _edit(self, edit_order=(), **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. Also sets the resource first, because which is required for the GUI. Also sets the resource first, because
_setVariationCategoryList needs the resource to be set. _setVariationCategoryList needs the resource to be set.
...@@ -822,11 +822,9 @@ class Movement(XMLObject, Amount): ...@@ -822,11 +822,9 @@ 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
if 'resource' in kw: if not edit_order:
self._setResource(kw.pop('resource')) edit_order = ('resource', 'resource_value')
if 'resource_value' in kw: return XMLObject._edit(self, edit_order=edit_order, **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