diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.js index 574db15680f897b4085ed86b8ffa704e72973791..eced69a70e614785088f6d4cfa87a30c2b823c0c 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.js +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.js @@ -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 }); } ); diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.xml index deaee86eab15d21de8aac68ab83f8705f7370171..ab08716948789e7e0d11b0aea4d2377d06ced783 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_widget_listbox_js.xml @@ -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> diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.html b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.html index 5b951b6f927dc6c7927acd0bcb3d83233d84803d..7fdc8d959e3d20e25c97cc8d33d8023cbc2ee4d8 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.html +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.html @@ -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}} diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.xml b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.xml index f46fc8c2aa1c2a783063f9f247398abc957af21a..66b289b86c5868df11006f4edf7f68aaf7b414dc 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.xml +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_html.xml @@ -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> diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.js b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.js index 425ee78e8ae3bd74b19b61692d9d82a26f68a666..17c17c1e32a5023eb7e6b0787b822eaf1904fd93 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.js +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.js @@ -7,8 +7,61 @@ source = gadget_klass.__template_element .querySelector(".view-expense-record-template") .innerHTML, - template = Handlebars.compile(source); + template = Handlebars.compile(source), + relation_listview_source = gadget_klass.__template_element + .getElementById("relation-listview-template") + .innerHTML, + relation_listview_template = Handlebars.compile(relation_listview_source), + + searching = "animation ui-btn ui-corner-all ui-btn-icon-notext" + + " ui-input-clear ui-icon-spinner ui-icon-spin", + searched = "animation ui-hidden-accessible", + jump_on = "animation ui-btn ui-corner-all ui-btn-icon-notext " + + "ui-icon-plane ui-shadow-inset ui-input-clear", + jump_off = jump_on + " ui-disabled", + jump_unknown = "animation ui-btn ui-corner-all ui-btn-icon-notext " + + "ui-icon-warning ui-shadow-inset ui-input-clear ui-disabled"; + + + + function getData(gadget) { + var form = gadget.props.element.querySelector('form'); + return getSequentialID(gadget, 'EXP') + .push(function (source_reference) { + var i, + doc = { + parent_relative_url: "expense_record_module", + portal_type: "Expense Record Temp", + source_reference: source_reference, + visible_in_html5_app_flag: 1, + record_revision: (gadget.options.doc.record_revision || 1), + photo_data: gadget.options.doc.photo_data || "", + modification_date: new Date().toISOString() + }; + for (i = 0; i < form.length; i += 1) { + // XXX Should check input type instead + if (form[i].name && form[i].type != "submit") { + if ((form[i].type == "radio" || form[i].type == "checkbox") && !form[i].checked){ + continue; + } + if (form[i].name === "photo") { + continue; + } + doc[form[i].name] = form[i].value; + if (form[i].name === 'resource') { + doc.resource_title = form[i][form[i].selectedIndex].text; + } + } + } + if (doc.sync_flag === "1"){ + doc.simulation_state = 'draft'; + doc.portal_type = 'Expense Record'; // For to avoid sync + } + doc.related_mission_url = gadget.props.related_mission_url; + return doc; + }); + } function getWorkflowState(id, sync_flag) { var sync_state; if(id.indexOf("_module/") > 0){ @@ -121,7 +174,7 @@ .declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('setSetting', 'setSetting') .declareAcquiredMethod("repair", "jio_repair") - + .declareAcquiredMethod("getUrlFor", "getUrlFor") .declareMethod('triggerSubmit', function () { return this.props.element.querySelector('button').click(); @@ -132,11 +185,46 @@ sync_checked, sync_state = getWorkflowState(options.jio_key, options.doc.sync_flag), geoLocation, + related_mission_class, + related_mission_url, + related_mission, not_sync_checked; gadget.options = options; return new RSVP.Queue() - .push (function () { + .push(function () { + if(options.came_from_jio_key) { + gadget.props.related_mission_url = options.came_from_jio_key; + return gadget.get(options.came_from_jio_key) + .push(function (data) { + related_mission_class = jump_on; + related_mission = data.title; + options.doc.related_mission = related_mission; + options.doc.related_mission_url = gadget.props.related_mission_url; + //saved when return from listbox + return gadget.put(gadget.options.jio_key, options.doc); + }) + .push(function () { + return gadget.getUrlFor({jio_key: options.came_from_jio_key, page: 'view'}); + }); + } else { + related_mission = options.doc.related_mission; + if (options.doc.related_mission_url) { + related_mission_class = jump_on; + gadget.props.related_mission_url = options.doc.related_mission_url; + return gadget.getUrlFor({jio_key: options.doc.related_mission_url, page: 'view'}); + } else { + if (related_mission) { + related_mission_class = jump_unknown; + } else { + related_mission_class = jump_off; + } + return; + } + } + }) + .push (function (url) { + related_mission_url = url; if (sync_state === 'Synced') { geoLocation= {coords: {latitude: options.doc.latitude, longitude: options.doc.longitude}}; } else { @@ -183,7 +271,10 @@ not_sync_checked: not_sync_checked, select_options: select_options, longitude: geoLocation.coords.longitude || "", - latitude: geoLocation.coords.latitude || "" + latitude: geoLocation.coords.latitude || "", + related_mission_url: related_mission_url || "", + related_mission_class: related_mission_class, + related_mission: related_mission }; if (sync_state !== 'Synced') { ops.not_readonly = true; @@ -310,38 +401,11 @@ form, 'submit', false, - function (submit_event) { - return getSequentialID(gadget, 'EXP') - .push(function (source_reference) { - var i, - doc = { - parent_relative_url: "expense_record_module", - portal_type: "Expense Record Temp", - source_reference: source_reference, - visible_in_html5_app_flag: 1, - record_revision: (gadget.options.doc.record_revision || 1), - photo_data: gadget.options.doc.photo_data || "", - modification_date: new Date().toISOString() - }; - for (i = 0; i < submit_event.target.length; i += 1) { - // XXX Should check input type instead - if (submit_event.target[i].name && submit_event.target[i].type != "submit") { - if ((submit_event.target[i].type == "radio" || submit_event.target[i].type == "checkbox") && !submit_event.target[i].checked){ - continue - } - if (submit_event.target[i].name === "photo") { - continue - } - doc[submit_event.target[i].name] = submit_event.target[i].value; - if (submit_event.target[i].name === 'resource') { - doc.resource_title = submit_event.target[i][submit_event.target[i].selectedIndex].text; - } - } - } - if (doc.sync_flag === "1"){ + function () { + return getData(gadget) + .push(function (doc) { + if (doc.sync_flag === '1') { sync = 1; - doc.simulation_state = 'draft'; - doc.portal_type = 'Expense Record'; // For to avoid sync } return gadget.put(gadget.options.jio_key, doc); }) @@ -465,6 +529,102 @@ } ); }); + }) + .declareService(function () { + var gadget = this, + my_value, + props = gadget.props, + input = gadget.props.element.querySelector('.relation_input'), + ul = gadget.props.element.querySelector(".search_ul"), + animation = gadget.props.element.querySelector('.animation'); + + function generateList(event) { + my_value = event.target.value; + ul.innerHTML = ""; + gadget.props.related_mission_url = ''; + if (my_value === "") { + animation.className = searched; + return; + } + animation.className = searching; + return new RSVP.Queue() + .push(function () { + return gadget.allDocs({ + "query": 'portal_type: "Travel Request Record" AND state: "Accepted" AND title: %' + my_value + '%', + "limit": [0, 11], + "select_list": ['title'] + }); + }) + .push(function (result) { + var list = [], + i, + html; + for (i = 0; i < result.data.rows.length; i += 1) { + list.push({ + id: result.data.rows[i].id, + value: result.data.rows[i].value['title'] + }); + } + animation.className = searched; + html = relation_listview_template({ + list: list, + value: my_value + }); + $(ul).toggle(); + ul.innerHTML = html; + $(ul).toggle(); + }); + } + function setSelectedElement(event) { + var element = event.target, + jump_url = element.getAttribute("data-relative-url"); + ul.innerHTML = ""; + if (jump_url) { + input.value = element.textContent; + return gadget.getUrlFor({jio_key: jump_url, page: 'view'}) + .push(function (url) { + gadget.props.related_mission_url = jump_url; + animation.href = url; + animation.className = jump_on; + }); + } else { + return getData(gadget) + .push(function (doc) { + doc.sync_flag = "0"; + doc.portal_type = 'Expense Record Temp'; + return gadget.put(gadget.options.jio_key, doc); + }) + .push(function () { + return gadget.redirect({ + page: 'travel_request_record_list', + came_from_jio_key: gadget.options.jio_key, + search: my_value + }); + }); + } + } + + return RSVP.all([ + loopEventListener(input, 'input', false, generateList), + loopEventListener(input, 'blur', false, function () { + return new RSVP.Queue() + .push(function () { + return RSVP.any([ + RSVP.delay(200), + promiseEventListener(ul, "click", true) + ]); + }) + .push(function (event) { + if (event) { + return setSelectedElement(event); + } + if (ul.innerHTML) { + ul.innerHTML = ""; + animation.className = jump_unknown; + } + }); + })] + ); }); }(window, document, RSVP, rJS, Handlebars, loopEventListener, promiseEventListener, alertify)); \ No newline at end of file diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.xml b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.xml index 91ce7ed5310c5f49def6c48fd317fcebca8b118c..23956fd0ef5c8e754edfbec73b6fee148c791320 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.xml +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_expense_record_view_js.xml @@ -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> diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.js b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.js index 61781b5855310daf1abc97e2ad273da1cc56c934..bfb5f028e1674cea32d17ef748e8314dddd890fd 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.js +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.js @@ -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"]] diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.xml b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.xml index a7febb171a88b0e24e9ca57eec7aaca880cf383f..959b0cb851f32f531cf5ea604822175473b7da93 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.xml +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_mission_request_record_list_js.xml @@ -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> diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.js b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.js index 4f7b04bce7a049328c66f373d8103da9512cda40..63e6b6643688a40871fc8a3521f41e366c3f2041 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.js +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.js @@ -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" diff --git a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.xml b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.xml index 98b952823407027405c55d274cc36d7e9c1e9358..6f8f48be105330690c2e1e9f5f91ded15181db9f 100644 --- a/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.xml +++ b/bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_router_js.xml @@ -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> diff --git a/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_property.xml b/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b2cc7494d6936ff233594a6c6f3a956414bcd4d --- /dev/null +++ b/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_property.xml @@ -0,0 +1,34 @@ +<?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> diff --git a/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_url_property.xml b/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_url_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..2941044cccaa54955bf7b6a69e87661bad8409cc --- /dev/null +++ b/bt5/erp5_travel_expense/PropertySheetTemplateItem/portal_property_sheets/ExpenseRecord/related_mission_url_property.xml @@ -0,0 +1,34 @@ +<?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> diff --git a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py index df7e9ae010aa789810eefb8f4ca3dc5842000f04..02cbde0264aa3ecda192a8d18ea630227dbe861f 100644 --- a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py +++ b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py @@ -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: diff --git a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio.xml b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio.xml index f1d18b6a11f5104b0605277252d279f8222b184f..277e5f29ac36b59a5079c08e1f2e703277a64697 100644 --- a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio.xml +++ b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio.xml @@ -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> diff --git a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission.xml b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission.xml new file mode 100644 index 0000000000000000000000000000000000000000..bbcd344da82a6ce2e1ded9b4e0fdec69959fde9e --- /dev/null +++ b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission.xml @@ -0,0 +1,272 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="StringField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_related_mission</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> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string>text</string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Related Mission</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission_url.xml b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission_url.xml new file mode 100644 index 0000000000000000000000000000000000000000..4cfd1c8e76ca7b832b8d17a192fae094185c970f --- /dev/null +++ b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_viewAsJio/my_related_mission_url.xml @@ -0,0 +1,272 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="StringField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_related_mission_url</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> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string>text</string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Related Mission Url</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_view/my_source_project_title.xml b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_view/my_source_project_title.xml index 9a13d519f23e7703b6a15d94b080d4150f9e2f6f..cdbd181e0fc4c26d8fb33bdc91ffb751a12647f7 100644 --- a/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_view/my_source_project_title.xml +++ b/bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_view/my_source_project_title.xml @@ -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>