Commit 3839536e authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Xiaowu Zhang

erp5_travel_request: Add Type and Distinct image

erp5_travel_expense: Add mission Administration

erp5_travel_expense: Add missing category

erp5_travel_expense: Make Expense document publication customizable by script

erp5_travel_expense: Add mission jio_view action on Service
parent 3c1184de
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jio_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Service_viewAsJio</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/hr</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>HR</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>HR</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hr</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>HR</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Human Resources</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/hr/expense_validation_request</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>EVR</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>EVR</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>expense_validation_request</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Expense Validation</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Expense Validation Request</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/hr/travel_request</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>TR</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TR</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>travel_request</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Travel Request</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Travel Request</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -85,6 +85,9 @@
column_list: [{
select: 'comment',
title: 'Description'
}, {
select: 'type_title',
title: 'Type'
}, {
select: 'quantity',
title: 'Total Price'
......@@ -104,9 +107,9 @@
query: {
query: 'portal_type:("Expense Record" OR "Expense Record Temp")',
select_list: ['doc_id', 'quantity', 'resource_title',
'comment', 'date', 'portal_type', 'sync_flag',
'comment', 'date', 'type_title',
'state'],
sort_on: [["doc_id", "descending"]]
sort_on: [["modification_date", "descending"]]
}
});
});
......
......@@ -59,6 +59,19 @@
</select>
</div>
<div class="ui-field-contain">
<label data-i18n="Type">Type</label>
<select class="new-performed-task" name="type" required>
{{#each type_options}}
{{#if is_selected}}
<option value={{value}} selected>{{title}}</option>
{{else}}
<option value={{value}}>{{title}}</option>
{{/if}}
{{/each}}
</select>
</div>
<div class="ui-field-contain">
<label data-i18n="Photo">Photo</label>
<input name="photo" type="file" accept="image/*" capture="camera">
......@@ -135,6 +148,19 @@
</select>
</div>
<div class="ui-field-contain" class='ui-state-readonly'>
<label data-i18n="Type">Type</label>
<select name="type" readonly class='ui-state-readonly'>
{{#each type_options}}
{{#if is_selected}}
<option value={{value}} selected>{{title}}</option>
{{else}}
<option value={{value}}>{{title}}</option>
{{/if}}
{{/each}}
</select>
</div>
<div class="ui-field-contain" style="display:none;">
<label data-i18n="Photo">Photo</label>
<input name="photo" type="file" accept="image/*" capture="camera" readonly class='ui-state-readonly'>
......
......@@ -48,10 +48,12 @@
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 (form[i].nodeName === "SELECT"){
doc[form[i].name] = form[i].value;
doc[form[i].name + "_title"] =
form[i].options[form[i].selectedIndex].text;
}
doc[form[i].name] = form[i].value;
}
}
if (doc.sync_flag === "1"){
......@@ -74,6 +76,34 @@
return sync_state;
}
function getTypeSelectList(gadget, doc) {
return new RSVP.Queue()
.push(function (){
return gadget.allDocs({
query: 'portal_type:"Service" AND use:"hr/expense_validation_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.type === result.data.rows[i].value.relative_url) {
tmp.is_selected = true;
}
select_options.push(tmp);
}
return select_options;
});
}
function geoLocationPromise() {
return new Promise(function (resolve, reject) {
var err;
......@@ -231,17 +261,21 @@
geoLocation = {coords: {latitude: "", longitude: ""}};
}
gadget.props.geoLocation = geoLocation;
return gadget.allDocs({
query: 'portal_type:"Currency"',
select_list: ['relative_url', 'title'],
limit: [0, 100]
});
return RSVP.all([
gadget.allDocs({
query: 'portal_type:"Currency"',
select_list: ['relative_url', 'title'],
limit: [0, 100]
}),
getTypeSelectList(gadget, options.doc)
]);
})
.push(function (result) {
.push(function (result_list) {
var i = 0,
tmp,
ops,
select_options = [];
select_options = [],
result = result_list[0];
if (options.doc.resource === undefined) {
options.doc.resource = "currency_module/2";
}
......@@ -269,6 +303,7 @@
sync_checked: sync_checked,
not_sync_checked: not_sync_checked,
select_options: select_options,
type_options: result_list[1],
longitude: geoLocation.coords.longitude || "",
latitude: geoLocation.coords.latitude || "",
related_mission_url: related_mission_url || "",
......@@ -626,4 +661,4 @@
);
});
}(window, document, RSVP, rJS, Handlebars, loopEventListener, promiseEventListener, alertify));
\ No newline at end of file
}(window, document, RSVP, rJS, Handlebars, loopEventListener, promiseEventListener, alertify));
<?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>type_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: ""</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>type_title_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: ""</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getPreferredExpenseDocumentPublicationSectionValue</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -18,7 +18,6 @@ else:
ticket = record.getFollowUpValue()
record.setDestinationReference(ticket.getReference())
record.setFollowUpValue(ticket)
related_mission_url = record.getRelatedMissionUrl()
......@@ -29,7 +28,7 @@ else:
source_project_url = ""
ticket.edit(
title=record.getTitle(),
#resource=record.getSource(),
resource=record.getType(),
start_date=DateTime(record.getDate()),
stop_date=DateTime(record.getDate()),
# Specific
......@@ -40,11 +39,24 @@ ticket.edit(
description=record.getComment(),
latitude=record.getLatitude(),
longitude=record.getLongitude(),
source_project=source_project_url
source_project=source_project_url,
)
publication_section = portal.ERP5Site_getPreferredExpenseDocumentPublicationSectionValue()
photo_data = record.getPhotoData()
if photo_data:
ticket.setPhotoData(photo_data)
if "," in photo_data and ticket:
photo_data = photo_data.split(",")[1]
image = portal.portal_contributions.newContent(
data = photo_data.decode('base64'),
reference=ticket.getReference()+ "-justificatif",
title = ticket.getReference() + " Justificatif",
description = ticket.getDescription(),
filename="tmp.png",
follow_up=ticket.getRelativeUrl(),
publication_section=publication_section.getRelativeUrl(),
)
image.share()
record.deliver()
......
......@@ -94,6 +94,8 @@
<string>your_title</string>
<string>my_related_mission_url</string>
<string>my_related_mission</string>
<string>my_type</string>
<string>my_type_title</string>
</list>
</value>
</item>
......
......@@ -28,6 +28,8 @@ new_record.edit(
comment=context.getDescription(),
latitude=context.getLatitude(),
longitude=context.getLongitude(),
type=context.getResource(),
type_title=context.getResourceTitle(),
)
new_record.setPhotoData(None)
......
portal = context.getPortalObject()
publication_section = portal.ERP5Site_getPreferredExpenseDocumentPublicationSectionValue()
proof_list = portal.portal_catalog(
strict_follow_up_uid=context.getUid(),
publication_section_uid=publication_section.getUid(),
validation_state="shared",
limit=1,
select_list=["relative_url"]
)
if not proof_list:
return ""
return "/".join([portal.absolute_url(), proof_list[0].relative_url])
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ExpenseValidationRequest_getRelatedExpenseProofUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -301,7 +301,7 @@
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python:\'<img src="%s">\' % here.getPhotoData()
python:\'<a href="%(image_url)s"><img src="%(image_url)s?display=large"></a>\' % {\'image_url\': here.ExpenseValidationRequest_getRelatedExpenseProofUrl()}
]]></string> </value>
</item>
......
......@@ -9,6 +9,8 @@ Expense Validation Request | view
Leave Request Record | jio_view
Leave Request Record | view
Record Module | view
Service | jio_view
System Preference | hr_preference
Travel Request Module | view
Travel Request Record | jio_view
Travel Request Record | view
......
portal_categories/publication_section/administration
portal_categories/publication_section/administration/expense
\ No newline at end of file
portal_alarms/alarm_process_draft_record_list
portal_categories/use/hr
portal_categories/use/hr/**
web_page_module/gadget_hr_*
web_site_module/officejs_hr
web_site_module/officejs_hr/**
\ No newline at end of file
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