Commit c5087385 authored by Rafael Monnerat's avatar Rafael Monnerat

[slapos_web] Improve invoice list section

- Show float with 2 digits after . only
- Don't list reversal Sale Transaction Invoices, this only leads to confusion
- Show Payment State as Cancelled if a Reversal Sale Invoice Transaction is started for the Pending account (it means Payment was cancelled).

- List Invoices in Reverse Order (start date), so it is easy to identify if you have something pending to Pay.
parent 84bc00b2
...@@ -69,7 +69,14 @@ else:\n ...@@ -69,7 +69,14 @@ else:\n
paid = False\n paid = False\n
break\n break\n
\n \n
if paid:\n reversal = portal.portal_catalog.getResultValue(\n
portal_type="Sale Invoice Transaction",\n
simulation_state="stopped",\n
default_causality_uid=context.getUid()\n
)\n
if reversal is not None and (context.getTotalPrice() + reversal.getTotalPrice()) == 0:\n
result = "Cancelled"\n
elif paid:\n
result = "Paid"\n result = "Paid"\n
elif context.getTotalPrice() == 0:\n elif context.getTotalPrice() == 0:\n
result = "Free!"\n result = "Free!"\n
......
...@@ -52,9 +52,11 @@ ...@@ -52,9 +52,11 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>person = context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()\n <value> <string>person = context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()\n
if person:\n if person:\n
\n from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
return context.getPortalObject().portal_catalog(\n return context.getPortalObject().portal_catalog(\n
default_destination_section_uid=person.getUid(),\n default_destination_section_uid=person.getUid(),\n
query=NegatedQuery(Query(title="Reversal Transaction for %")),\n
sort_on=(("creation_date", "DESC"),),\n
**kw\n **kw\n
)\n )\n
\n \n
......
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
<list> <list>
<string>listbox_start_date</string> <string>listbox_start_date</string>
<string>listbox_download</string> <string>listbox_download</string>
<string>listbox_total_price</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<value> <value>
<list> <list>
<string>columns</string> <string>columns</string>
<string>editable_columns</string>
<string>list_method</string> <string>list_method</string>
<string>portal_types</string> <string>portal_types</string>
<string>search</string> <string>search</string>
...@@ -117,6 +118,17 @@ ...@@ -117,6 +118,17 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>total_price</string>
<string>Total Price</string>
</tuple>
</list>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_list_mode_listbox</string> </value> <value> <string>my_list_mode_listbox</string> </value>
......
57 58
\ 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