Commit a74838cc authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Display same information present on the printout

parent 70d396c4
......@@ -17,7 +17,8 @@
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -64,26 +65,36 @@
"Payment State",
"Download",
"Invoice:",
"Data updated."
"Data updated.",
"Instance",
"From",
"To",
"Quantity"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.getTranslationList(translation_list)
gadget.getTranslationList(translation_list),
gadget.getSetting("hateoas_url")
]);
})
.push(function (result) {
gadget.message_translation = result[1][8];
page_title_translation = result[1][7];
var form_gadget = result[0],
column_list = [
["title", result[1][9]],
["start_date", result[1][10]],
["stop_date", result[1][11]],
["quantity", result[1][12]]
],
start_date = new Date(gadget.state.doc.start_date),
total_price = window.parseFloat(gadget.state.doc.total_price).toFixed(2);
return form_gadget.render({
erp5_document: {
"_embedded": {"_view": {
"my_start_date": {
"allow_empty_time": 0,
"ampm_time_style": 0,
"css_class": "date_field",
......@@ -157,6 +168,26 @@
"key": "monitoring_status",
"hidden": 0,
"type": "GadgetField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": column_list,
"key": "listbox",
"lines": 20,
"list_method": "SaleInvoiceTransaction_getRelatedHostingSubscriptionReportLineList",
"list_method_template": result[2] + gadget.state.jio_key + "/ERP5Document_getHateoas?mode=search&" +
"list_method=SaleInvoiceTransaction_getRelatedHostingSubscriptionReportLineList" +
"{&query,select_list*,limit*,sort_on*,local_roles*}",
"query": "urn:jio:allDocs?query=",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["start_date", "ASC"]],
"title": "Subscriptions",
"type": "ListBox"
}
}},
"_links": {
......@@ -171,6 +202,9 @@
"left",
[["my_start_date"], ["my_reference"], ["my_total_price"],
["my_resource_title"], ['my_payment_state'], ["my_download"]]
],[
"bottom",
[["listbox"]]
]]
}
});
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>992.9718.3353.42939</string> </value>
<value> <string>992.9877.18647.54442</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1621364990.01</float>
<float>1621377250.27</float>
<string>UTC</string>
</tuple>
</state>
......
aggregated_reference = context.getCausalityReferenceList(portal_type='Sale Packing List', checked_permission='View')
from Products.ERP5Type.Document import newTempBase
from DateTime import DateTime
portal = context.getPortalObject()
if not aggregated_reference:
return []
item_dict = []
for line in portal.portal_catalog(portal_type='Sale Packing List Line',
grouping_reference=aggregated_reference,
default_resource_uid=portal.service_module.slapos_instance_subscription.getUid(),
sort_on=[('default_aggregate_uid', 'ASC'), ('movement.start_date', 'ASC')]):
item_relative_url = line.getAggregate(portal_type='Hosting Subscription')
if not item_relative_url:
continue
item_title = line.getAggregateTitle(portal_type='Hosting Subscription')
start_date = line.getStartDate()
stop_date = line.getStopDate()
quantity = line.getQuantity()
item_dict.setdefault(item_relative_url, [item_title, start_date, stop_date, 0])
item_dict.update({item_relative_url: [item_title,
min(item_dict[item_relative_url][1], start_date),
max(item_dict[item_relative_url][2], stop_date),
sum([item_dict[item_relative_url][3], quantity])]})
report_line_list = []
for relative_url in item_dict:
title, start_date, stop_date, quantity = item_dict[relative_url]
report_line_list.append(
newTempBase(portal, relative_url,
title=title,
start_date=start_date,
stop_date=stop_date,
quantity=quantity)
)
return report_line_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_getRelatedHostingSubscriptionReportLineList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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