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

Build invoice per person.

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