Commit f464c23a authored by Łukasz Nowak's avatar Łukasz Nowak

Build invoice per person.

parent 1ec99292
......@@ -43,8 +43,8 @@ def OpenSaleOrderLine_migrate(self):
self.setPriceCurrency('currency_module/EUR')
@WorkflowMethod.disable
def VifibInvoiceLineBuilder_buildAndPlan(self, explanation):
delivery_list = self.build(explanation=explanation)
def VifibSaleInvoiceBuilder_buildAndPlan(self, movement_list):
delivery_list = self.build(movement_list=movement_list)
wf = self.getPortalObject().portal_workflow.accounting_workflow
plan_tdef = wf.transitions.get("plan")
for delivery in delivery_list:
......
......@@ -52,9 +52,8 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Applied Rule\',\n
parent_uid=portal.portal_simulation.getUid(),\n
method_id=\'RootAppliedRule_buildAndPlanInvoice\'\n
portal_type=\'Person\',\n
method_id=\'Person_buildAndPlanInvoice\'\n
)\n
</string> </value>
</item>
......
......@@ -50,16 +50,38 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.VifibInvoiceLineBuilder_buildAndPlan(context.getPortalObject().portal_deliveries.vifib_sale_invoice_builder, explanation=context.getCausalityValue())\n
</string> </value>
<value> <string encoding="cdata"><![CDATA[
person_uid = context.getUid()\n
\n
kw = {}\n
select_dict= {\'delivery_uid\': None}\n
kw.update(\n
portal_type=\'Simulation Movement\',\n
sort_on=(\'uid\', \'desc\'),\n
uid=\'>= %s\' % uid,\n
limit=69,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
delivery_uid=None,\n
**{\'movement.destination_uid\': person_uid}\n
)\n
movement_list = context.portal_catalog(**kw)\n
\n
if len(movement_list) > 0:\n
context.VifibSaleInvoiceBuilder_buildAndPlan(context.getPortalObject().portal_deliveries.vifib_sale_invoice_builder, movement_list=movement_list)\n
context.activate().Person_buildAndPlanInvoice(movement_list[-1].getUid())\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>uid=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>RootAppliedRule_buildAndPlanInvoice</string> </value>
<value> <string>Person_buildAndPlanInvoice</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>VifibInvoiceLineBuilder_buildAndPlan</string> </value>
<value> <string>VifibSaleInvoiceBuilder_buildAndPlan</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>VifibInvoiceLineBuilder_buildAndPlan</string> </value>
<value> <string>VifibSaleInvoiceBuilder_buildAndPlan</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
53
\ No newline at end of file
54
\ No newline at end of file
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