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
paid = False\n
break\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
elif context.getTotalPrice() == 0:\n
result = "Free!"\n
......
......@@ -52,9 +52,11 @@
<key> <string>_body</string> </key>
<value> <string>person = context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()\n
if person:\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
return context.getPortalObject().portal_catalog(\n
default_destination_section_uid=person.getUid(),\n
query=NegatedQuery(Query(title="Reversal Transaction for %")),\n
sort_on=(("creation_date", "DESC"),),\n
**kw\n
)\n
\n
......
......@@ -89,6 +89,7 @@
<list>
<string>listbox_start_date</string>
<string>listbox_download</string>
<string>listbox_total_price</string>
</list>
</value>
</item>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>columns</string>
<string>editable_columns</string>
<string>list_method</string>
<string>portal_types</string>
<string>search</string>
......@@ -117,6 +118,17 @@
</list>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>total_price</string>
<string>Total Price</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_mode_listbox</string> </value>
......
57
\ No newline at end of file
58
\ 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