Commit 6ef748d0 authored by Jérome Perrin's avatar Jérome Perrin

specify the portal_type when getting the Account to make sure we do not acquire from the parent


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5461 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68f01373
...@@ -100,34 +100,34 @@ if transaction.getPortalType() not in (\'Balance Transaction\',) :\n ...@@ -100,34 +100,34 @@ if transaction.getPortalType() not in (\'Balance Transaction\',) :\n
transaction_line.getDestinationInventoriatedTotalAssetPrice() or 0\n transaction_line.getDestinationInventoriatedTotalAssetPrice() or 0\n
\n \n
sum += int(round(quantity * 100))\n sum += int(round(quantity * 100))\n
if transaction_line.getSourceValue() is None :\n \n
# TODO: validate from both source and destination\n
account = transaction_line.getSourceValue(portal_type = \'Account\')\n
if account is None :\n
continue\n continue\n
\n \n
if transaction_line.getSourceValue().getValidationState() != \'validated\' :\n if account .getValidationState() != \'validated\' :\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
\'Action impossible : Account ${account_title} is ${state}\',\n \'Action impossible : Account ${account_title} is ${state}\',\n
mapping = {\'account_title\': unicode(transaction_line\\\n mapping = {\'account_title\': unicode(account.getTranslatedTitle(), \'utf8\'),\n
.getSourceValue().getTranslatedTitle(), \'utf8\'),\n \'state\': unicode(account.getTranslatedValidationStateTitle(), \'utf8\')})\n
\'state\': unicode(transaction_line.getSourceValue()\\\n
.getTranslatedValidationStateTitle(), \'utf8\')})\n
\n \n
if transaction_line.getSourceValue().getAccountTypeId() in (\n if account.getAccountTypeId() in ("receivable", "payable") and \\\n
"receivable", "payable") and \\\n
transaction_line.getDestinationSection() in (None, "") :\n transaction_line.getDestinationSection() in (None, "") :\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
\'Action impossible : no Third Party defined for line ${line} \'+\n \'Action impossible : no Third Party defined for line ${line} \'+\n
\'where Account Type is ${account_type}.\',\n \'where Account Type is ${account_type}.\',\n
mapping = { \'line\': transaction_line.getId(),\n mapping = { \'line\': transaction_line.getId(),\n
\'account_type\' : unicode(transaction_line.getSourceValue()\\\n \'account_type\' : unicode(account\\\n
.getAccountTypeValue().getTranslatedLogicalPath(), \'utf8\')})\n .getAccountTypeValue().getTranslatedLogicalPath(), \'utf8\')})\n
\n \n
if transaction_line.getSourceValue().isMemberOf("account_type/asset/cash") \\\n if account.isMemberOf("account_type/asset/cash") \\\n
and transaction_line.getSourcePayment() in (None, "") :\n and transaction_line.getSourcePayment() in (None, "") :\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
\'Action impossible : no Bank Account defined for line ${line} \'+\n \'Action impossible : no Bank Account defined for line ${line} \'+\n
\'where Account Type is ${account_type}.\',\n \'where Account Type is ${account_type}.\',\n
mapping = { \'line\': transaction_line.getId(),\n mapping = { \'line\': transaction_line.getId(),\n
\'account_type\' : unicode(transaction_line.getSourceValue()\\\n \'account_type\' : unicode(account\\\n
.getAccountTypeValue().getTranslatedLogicalPath(), \'utf8\')})\n .getAccountTypeValue().getTranslatedLogicalPath(), \'utf8\')})\n
\n \n
if sum > 0:\n if sum > 0:\n
...@@ -222,6 +222,7 @@ transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n ...@@ -222,6 +222,7 @@ transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
<string>quantity</string> <string>quantity</string>
<string>int</string> <string>int</string>
<string>round</string> <string>round</string>
<string>account</string>
<string>None</string> <string>None</string>
<string>unicode</string> <string>unicode</string>
</tuple> </tuple>
......
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