Commit 312f103f authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Xiaowu Zhang

erp5_travel_expense: Travel Request use Services for Resource

parent 291f6a73
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_viewAsJio</string> </value> <value> <string>string:${object_url}/Category_viewAsJio</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Currency_viewAsJio</string> </value> <value> <string>string:${object_url}/Base_viewAsJio</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -273,6 +273,7 @@ ...@@ -273,6 +273,7 @@
'OR (portal_type: "Travel Request Record" AND simulation_state:("draft","sent","stopped")) ' + 'OR (portal_type: "Travel Request Record" AND simulation_state:("draft","sent","stopped")) ' +
'OR (portal_type: "Leave Request Record" AND validation_state:"draft") ' + 'OR (portal_type: "Leave Request Record" AND validation_state:"draft") ' +
'OR (portal_type: "Currency" AND validation_state:"validated") ' + 'OR (portal_type: "Currency" AND validation_state:"validated") ' +
'OR (portal_type: "Service" AND validation_state:"validated") ' +
'OR (portal_type: "Person" AND id: "' + me.split("/")[1] + '")', 'OR (portal_type: "Person" AND id: "' + me.split("/")[1] + '")',
limit: [0, 1234567890] limit: [0, 1234567890]
}, },
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.53739.12093.30054</string> </value> <value> <string>956.8604.31177.32494</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481817167.84</float> <float>1482421272.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,6 +14,34 @@ ...@@ -14,6 +14,34 @@
3: {title: "Marketing", relative_url: "3"}, 3: {title: "Marketing", relative_url: "3"},
}; };
function getResouceSelectList(gadget, doc) {
return new RSVP.Queue()
.push(function (){
return gadget.allDocs({
query: 'portal_type:"Service" AND use:"hr/travel_request%"',
select_list: ['relative_url', 'title'],
limit: [0, 100]
});
})
.push(function (result) {
var i = 0,
tmp,
ops,
select_options = [];
for (i = 0; i < result.data.total_rows; i += 1) {
tmp = {
title: result.data.rows[i].value.title,
value: result.data.rows[i].value.relative_url
};
if (doc.resource === result.data.rows[i].value.relative_url) {
tmp.is_selected = true;
}
select_options.push(tmp);
}
return select_options;
});
}
function getWorkflowState(id, sync_flag) { function getWorkflowState(id, sync_flag) {
var sync_state; var sync_state;
if(id.indexOf("_module/") > 0){ if(id.indexOf("_module/") > 0){
...@@ -141,37 +169,10 @@ ...@@ -141,37 +169,10 @@
return new RSVP.Queue() return new RSVP.Queue()
.push (function () { .push (function () {
return { return getResouceSelectList(gadget, options.doc);
data: {
total_rows: 3,
rows: [
{title: "Occasionnelle", relative_url: "1"},
{title: "Urgence", relative_url: "2"},
{title: "Marketing", relative_url: "3"},
]
}
};
/*gadget.allDocs({
query: 'portal_type:"Currency"',
select_list: ['relative_url', 'title'],
limit: [0, 100]
});*/
}) })
.push(function (result) { .push(function (select_options) {
var i = 0, var ops;
tmp,
ops,
select_options = [];
for (i = 0; i < result.data.total_rows; i += 1) {
tmp = {
title: result.data.rows[i].title,
value: result.data.rows[i].relative_url
};
if (options.doc.resource === result.data.rows[i].relative_url) {
tmp.is_selected = true;
}
select_options.push(tmp);
}
if (options.doc.sync_flag === '1') { if (options.doc.sync_flag === '1') {
sync_checked = 'checked'; sync_checked = 'checked';
} else { } else {
...@@ -333,9 +334,10 @@ ...@@ -333,9 +334,10 @@
if ((submit_event.target[i].type == "radio" || submit_event.target[i].type == "checkbox") && !submit_event.target[i].checked){ if ((submit_event.target[i].type == "radio" || submit_event.target[i].type == "checkbox") && !submit_event.target[i].checked){
continue continue
} }
if (submit_event.target[i].name === "resource"){ if (submit_event.target[i].nodeName === "SELECT"){
doc[submit_event.target[i].name] = submit_event.target[i].value; doc[submit_event.target[i].name] = submit_event.target[i].value;
doc["resource_title"] = resource_type[submit_event.target[i].value].title; doc[submit_event.target[i].name + "_title"] =
submit_event.target[i].options[submit_event.target[i].selectedIndex].text;
} }
if (submit_event.target[i].name === "photo") { if (submit_event.target[i].name === "photo") {
continue continue
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.53725.56596.59084</string> </value> <value> <string>956.15594.34393.18107</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481299555.84</float> <float>1482836213.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<string>my_relative_url</string> <string>my_relative_url</string>
<string>my_parent_uid</string> <string>my_parent_uid</string>
<string>my_logical_path</string> <string>my_logical_path</string>
<string>my_category_relative_url</string> <string>my_validation_state</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>View</string> </value> <value> <string>Currency</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode_mode</string> </key> <key> <string>unicode_mode</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_title</string>
<string>my_relative_url</string>
<string>my_parent_uid</string>
<string>my_logical_path</string>
<string>my_category_relative_url</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Category_viewAsJio</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>General</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_relative_url</string> <string>my_relative_url</string>
<string>my_parent_uid</string> <string>my_parent_uid</string>
<string>my_logical_path</string> <string>my_use</string>
<string>my_validation_state</string> <string>my_validation_state</string>
</list> </list>
</value> </value>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Currency_viewAsJio</string> </value> <value> <string>Service_viewAsJio</string> </value>
</item> </item>
<item> <item>
<key> <string>method</string> </key> <key> <string>method</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_validation_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Validation State</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -23,7 +23,7 @@ record.setFollowUpValue(ticket) ...@@ -23,7 +23,7 @@ record.setFollowUpValue(ticket)
ticket.edit( ticket.edit(
title=record.getTitle(), title=record.getTitle(),
#resource=record.getSource(), resource=record.getResource(),
start_date=DateTime(record.getStartDate()), start_date=DateTime(record.getStartDate()),
stop_date=DateTime(record.getStopDate()), stop_date=DateTime(record.getStopDate()),
animation_center=record.getSite(), animation_center=record.getSite(),
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
<value> <value>
<list> <list>
<string>Expense Validation Request</string> <string>Expense Validation Request</string>
<string>Leave Request</string>
<string>Travel Request</string> <string>Travel Request</string>
</list> </list>
</value> </value>
......
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