Commit 97cda6c8 authored by Sebastien Robin's avatar Sebastien Robin

make purchase invoice transaction working

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6315 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aedd7369
......@@ -85,7 +85,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/AccountingRuleCell_viewSource</string> </value>
<value> <string>string:${object_url}/AccountingRuleCell_viewDestination</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>SaleInvoiceTransaction_postTransactionLineGeneration</string> </value>
<value> <string>InvoiceTransaction_postTransactionLineGeneration</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
......@@ -139,7 +139,7 @@
</item>
<item>
<key> <string>delivery_select_method_id</string> </key>
<value> <string>SaleInvoiceTransaction_selectDelivery</string> </value>
<value> <string>InvoiceTransaction_selectDelivery</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -140,7 +140,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>AccountingTransaction_view</string> </value>
<value> <string>AccountingRuleCell_viewDestination</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -281,7 +281,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -134,7 +134,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>AccountingTransaction_view</string> </value>
<value> <string>AccountingRuleCell_viewSource</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -77,7 +77,7 @@ sale_invoice = context\n
\n
sale_invoice.activate(\n
after_method_id=[\'immediateReindexObject\', \'recursiveImmediateReindexObject\']\n
).SaleInvoiceTransaction_postGenerationActivity(**kw)\n
).InvoiceTransaction_postGenerationActivity(**kw)\n
</string> </value>
</item>
<item>
......
......@@ -68,55 +68,55 @@
<key> <string>_body</string> </key>
<value> <string>#\n
# this script is called in an activity on the Sale Invoice Transaction\n
# after the sale_invoice_builder delivery builder has created\n
# after the invoice_builder delivery builder has created\n
# the new Sale Invoice Transaction\n
#\n
from ZODB.POSException import ConflictError \n
\n
sale_invoice = context\n
invoice = context\n
\n
LOG = lambda msg:context.log(\n
"SaleInvoiceTransaction_postGenerationActivity on %s" % (sale_invoice.getPath()), msg)\n
"InvoiceTransaction_postGenerationActivity on %s" % (invoice.getPath()), msg)\n
\n
# set the causality relation \n
sale_invoice.Delivery_setCausalityFromSimulation()\n
invoice.Delivery_setCausalityFromSimulation()\n
\n
related_packing_list = sale_invoice.getDefaultCausalityValue()\n
#LOG(\'causality %s \' %sale_invoice.getCausalityValueList())\n
related_packing_list = invoice.getDefaultCausalityValue()\n
#LOG(\'causality %s \' %invoice.getCausalityValueList())\n
\n
# get a price_currency from the packing list\n
related_order = related_packing_list.getDefaultCausalityValue()\n
if related_order is not None :\n
price_currency = related_order.getPriceCurrency()\n
sale_invoice.edit(\n
invoice.edit(\n
resource = price_currency,\n
price_currency = price_currency,\n
)\n
\n
# copy title, if not updating a new delivery\n
if sale_invoice.getTitle() is None :\n
sale_invoice.setTitle(related_packing_list.getTitle())\n
if invoice.getTitle() is None :\n
invoice.setTitle(related_packing_list.getTitle())\n
\n
# initialize accounting_workflow to planned state\n
if sale_invoice.getSimulationState() == \'draft\' : \n
if invoice.getSimulationState() == \'draft\' : \n
try :\n
context.getPortalObject().portal_workflow.doActionFor(\n
sale_invoice, \'plan_action\', wf_id=\'accounting_workflow\',\n
invoice, \'plan_action\', wf_id=\'accounting_workflow\',\n
comment = \'Initialized by Delivery Builder\',\n
skip_period_validation = 1 )\n
except (ConflictError, RuntimeError), e : raise\n
except Exception, e :\n
LOG(\'Exception in plan_action\', e)\n
if sale_invoice.getSimulationState() == \'draft\' : \n
LOG(\'Exception in plan_action %s\' % e)\n
if invoice.getSimulationState() == \'draft\' : \n
# call the workflow method, if the user cannot perform this operation.\n
sale_invoice.plan()\n
invoice.plan()\n
\n
# First set the invoice in the building state on the causality workflow\n
sale_invoice.startBuilding()\n
invoice.startBuilding()\n
\n
# Then an activity should put the causality state in diverged or solved\n
# XXX after_method_id is not good, it should be after_group_id, but not yet implemented\n
sale_invoice.activate(\n
invoice.activate(\n
after_method_id = ( \'immediateReindexObject\',\n
\'recursiveImmediateReindexObject\',\n
)).updateCausalityState()\n
......@@ -164,7 +164,7 @@ sale_invoice.activate(\n
<string>ZODB.POSException</string>
<string>ConflictError</string>
<string>context</string>
<string>sale_invoice</string>
<string>invoice</string>
<string>LOG</string>
<string>_getattr_</string>
<string>related_packing_list</string>
......
......@@ -108,7 +108,7 @@ if destination_section is not None and \\\n
if destination_section is None and check_destination :\n
raiseError(\'Destination Section is not Defined.\')\n
\n
currency = transaction.getResource()\n
currency = transaction.getResource(portal_type = \'Currency\')\n
if not currency :\n
raiseError(\'Currency is not Defined.\')\n
\n
......
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