Commit 79960ff2 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Xiaowu Zhang

erp5_travel_expense: can select validated missions in expense record

erp5_travel_expense: avoid undefined value

erp5_travel_expense: link related to Travel Request instead of record

erp5_travel_expense: can use listbox to search related mission in expense record
parent 423198da
......@@ -80,7 +80,11 @@
i;
all_docs_result = result;
for (i = 0, i_len = result.data.total_rows; i < i_len; i += 1) {
promise_list.push(gadget.getUrlFor({jio_key: result.data.rows[i].id, page: 'view'}));
if (option_dict.came_from_jio_key) {
promise_list.push(gadget.getUrlFor({jio_key: option_dict.came_from_jio_key, page: 'view', came_from_jio_key: result.data.rows[i].id}));
} else {
promise_list.push(gadget.getUrlFor({jio_key: result.data.rows[i].id, page: 'view'}));
}
}
return RSVP.all(promise_list);
......@@ -146,7 +150,8 @@
return gadget.redirect({
jio_key: gadget.property_dict.option_dict.jio_key || '',
page: gadget.property_dict.option_dict.search_page || '',
search: evt.target[0].value
search: evt.target[0].value,
came_from_jio_key: gadget.property_dict.option_dict.came_from_jio_key
});
}
);
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.5700.26625.14643</string> </value>
<value> <string>956.14016.52782.35993</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1451303858.2</float>
<float>1482742612.5</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,6 +15,17 @@
<script src="alertify.js"></script>
<script id="relation-listview-template" type="text/x-handlebars-template">
{{#if list.length}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">Select from the {{list.length}} Search Results</li>
{{#each list}}
<li class="ui-li ui-bar-inherit ui-li-static ui-body-inherit ui-icon-mail-forward ui-btn-icon-right" data-relative-url='{{id}}' >{{value}}</li>
{{/each}}
{{else}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit" role="heading">No result</li>
{{/if}}
<li class="ui-li-static ui-body-inherit ui-last-child ui-bar-inherit ui-icon-search ui-btn-icon-right" data-explore=true >Explore the Search Result List</li>
</script>
<script class="view-expense-record-template" type="text/x-handlebars-template">
<form class="view-expense-record-form">
......@@ -83,6 +94,18 @@
<textarea name="comment">{{comment}}</textarea>
</div>
<div class="ui-field-contain">
<label data-i18n="Related Mission">Related Mission</label>
<div class='ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon'>
<div>
<input class='relation_input' type='search' name='related_mission' autocomplete="off" data-enhanced="true" value="{{related_mission}}" >
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
<a href='{{related_mission_url}}' class='{{related_mission_class}}'></a>
</div>
</div>
</div>
<div class="ui-field-contain">
<label data-i18n="Sync Method">Sync Method</label>
<div>
......@@ -146,11 +169,24 @@
<label data-i18n="Input Date">Input Date</label>
<input type="date" name="date" value="{{date}}" readonly class='ui-state-readonly'>
</div>
<div class="ui-field-contain">
<label data-i18n="Related Mission">Related Mission</label>
<div class='ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon'>
<div>
<input class='relation_input' type='search' name='related_mission' autocomplete="off" data-enhanced="true" value="{{related_mission}}" readonly class='ui-state-readonly' >
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
<a href='{{related_mission_url}}' class='{{related_mission_class}}'></a>
</div>
</div>
</div>
<div class="ui-field-contain">
<label data-i18n="Comment">Comment</label>
<textarea name="comment" readonly class='ui-state-readonly'>{{comment}}</textarea>
</div>
{{/if}}
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.53749.31461.40891</string> </value>
<value> <string>956.9748.40508.8396</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1481299470.34</float>
<float>1482499947.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.64184.36962.20923</string> </value>
<value> <string>956.14178.1267.12151</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1481819367.98</float>
<float>1482759569.14</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -64,16 +64,25 @@
return gadget.getUrlFor({page: "add_travel_request_record"});
})
.push(function (url) {
return gadget.updateHeader({
title: gadget.props.document_title_plural,
add_url: url
});
var header = {
title: gadget.props.document_title_plural
};
if (!options.came_from_jio_key) {
header.add_url = url;
}
return gadget.updateHeader(header);
})
.push(function () {
return gadget.getDeclaredGadget("listbox");
})
.push(function (listbox) {
var query;
query = 'portal_type:("' + gadget.props.portal_type + '")';
if (options.came_from_jio_key) {
query += ' AND state: "Accepted"';
}
return listbox.render({
came_from_jio_key: options.came_from_jio_key,
search_page: 'travel_request_record_list',
search: options.search,
column_list: [
......@@ -97,7 +106,7 @@
title: 'State'
}],
query: {
query: 'portal_type:("' + gadget.props.portal_type + '")',
query: query,
select_list: ['resource_title', 'title', 'destination_node_title',
'start_date', 'stop_date', 'state'],
sort_on: [["start_date", "descending"]]
......
......@@ -256,7 +256,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -270,7 +270,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.52778.21897.47291</string> </value>
<value> <string>956.14048.56221.51336</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -288,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>1481299585.41</float>
<float>1482743098.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -110,7 +110,8 @@
sub_options = {
doc: doc,
jio_key: args.jio_key,
search: args.search
search: args.search,
came_from_jio_key: args.came_from_jio_key
};
if (base_portal_type.search(/_temp$/) >= 0) {
//Remove "_temp"
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.64151.8170.5836</string> </value>
<value> <string>956.7340.20565.20701</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1481817362.42</float>
<float>1482502019.34</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>related_mission_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>related_mission_url_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -21,7 +21,12 @@ record.setDestinationReference(ticket.getReference())
record.setFollowUpValue(ticket)
related_mission_url = record.getRelatedMissionUrl()
if related_mission_url:
travel_request = context.restrictedTraverse(related_mission_url)
source_project_url = travel_request.getFollowUp()
else:
source_project_url = ""
ticket.edit(
title=record.getTitle(),
#resource=record.getSource(),
......@@ -35,6 +40,7 @@ ticket.edit(
description=record.getComment(),
latitude=record.getLatitude(),
longitude=record.getLongitude(),
source_project=source_project_url
)
photo_data = record.getPhotoData()
if photo_data:
......
......@@ -92,6 +92,8 @@
<string>your_simulation_state</string>
<string>your_state</string>
<string>my_title</string>
<string>my_related_mission_url</string>
<string>my_related_mission</string>
</list>
</value>
</item>
......
......@@ -9,7 +9,10 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>allow_creation</string>
<string>portal_type</string>
</list>
</value>
</item>
<item>
......@@ -69,6 +72,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>allow_creation</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_source_project_title</string> </value>
......@@ -77,6 +84,17 @@
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<tuple>
<string>Travel Request</string>
<string>Travel Request</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </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