Commit 7f212c74 authored by Roque's avatar Roque

erp5_officejs: changes on getFormDefinition method

parent 12d527d3
......@@ -53,32 +53,17 @@
.declareMethod("checkMoreActions", function (portal_type, action_category) {
var gadget = this,
//for now, views and actions are handle together via handle_action gadget
has_more_dict = {views: {}, actions: {}},
query;
//if target action is a type of view, get all actions/views for the portal_type
// get all actions/views for the portal_type, if target action is a type of view
// (exclude custom scripts and dialogs)
if (view_categories.includes(action_category)) {
query = 'portal_type: "Action Information" AND parent_relative_url: "portal_types/' + portal_type + '"';
return gadget.jio_allDocs({query: query})
.push(function (action_list) {
var path_for_jio_get_list = [], row;
for (row in action_list.data.rows) {
if (action_list.data.rows.hasOwnProperty(row)) {
path_for_jio_get_list.push(gadget.jio_get(action_list.data.rows[row].id));
}
}
return RSVP.all(path_for_jio_get_list);
})
.push(function (action_document_list) {
var get_action_settings_list = [], page, action_key, action_doc;
for (action_key in action_document_list) {
if (action_document_list.hasOwnProperty(action_key)) {
action_doc = action_document_list[action_key];
if (view_categories.includes(action_doc.action_type)) {
has_more_dict.has_more_views = true;
} else {
has_more_dict.has_more_actions = true;
}
}
if (action_list.data.rows.length > 0) {
has_more_dict.has_more_actions = true;
}
return has_more_dict;
});
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.40669.15893.6946</string> </value>
<value> <string>975.47864.34898.9710</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1557496163.64</float>
<float>1557927902.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -187,7 +187,7 @@
header_dict.save_action = true;
}
}
if (options.form_definition.has_more_actions) {
if (options.form_definition.has_more_actions || options.form_definition.has_more_views) {
header_dict.actions_url = url_list[1];
}
if (add_url) {
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.39468.60846.58214</string> </value>
<value> <string>975.46515.39016.26350</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1557758125.07</float>
<float>1557927355.84</float>
<string>UTC</string>
</tuple>
</state>
......
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