@@ -1095,6 +1095,8 @@ def model(self):
1095
1095
not_filter_opts = (True ,),
1096
1096
)),
1097
1097
),
1098
+ self .gis_location_id (label = T ("To Location" ),
1099
+ ),
1098
1100
organisation_id (
1099
1101
label = T ("To Organization" ),
1100
1102
readable = show_org ,
@@ -1183,6 +1185,8 @@ def model(self):
1183
1185
s3_comments (),
1184
1186
* s3_meta_fields ())
1185
1187
1188
+ levels = current .gis .get_relevant_hierarchy_levels ()
1189
+
1186
1190
# Filter Widgets
1187
1191
filter_widgets = [
1188
1192
S3TextFilter (["sender_id$first_name" ,
@@ -1194,7 +1198,7 @@ def model(self):
1194
1198
"recipient_id$first_name" ,
1195
1199
"recipient_id$middle_name" ,
1196
1200
"recipient_id$last_name" ,
1197
- ],
1201
+ ] + [ "location_id$%s" % level for level in levels ] ,
1198
1202
label = T ("Search" ),
1199
1203
comment = T ("Search for an item by text." ),
1200
1204
),
@@ -1204,6 +1208,9 @@ def model(self):
1204
1208
cols = 2 ,
1205
1209
hidden = True ,
1206
1210
),
1211
+ S3LocationFilter ("location_id" ,
1212
+ levels = levels ,
1213
+ ),
1207
1214
S3TextFilter ("type" ,
1208
1215
label = T ("Shipment Type" ),
1209
1216
hidden = True ,
@@ -1278,6 +1285,7 @@ def model(self):
1278
1285
"req_ref" ,
1279
1286
"sender_id" ,
1280
1287
"site_id" ,
1288
+ "location_id" ,
1281
1289
"date" ,
1282
1290
"recipient_id" ,
1283
1291
"delivery_date" ,
@@ -2407,6 +2415,24 @@ def prep(r):
2407
2415
else :
2408
2416
set_send_attr (SHIP_STATUS_IN_PROCESS )
2409
2417
sendtable .send_ref .readable = False
2418
+ script = \
2419
+ """
2420
+ $("#inv_send_to_site_id__row").hide();
2421
+ $("[id^='inv_send_location_id']").hide();
2422
+ $('<div id="facility_or_location_radio" class = "form-row row"><input type="radio" name="site_or_location" value="site"><label style="font-weight: bold;">To Facility</label><input type="radio" name="site_or_location" value="location"><label style="font-weight: bold;">To Location</label></div>'
2423
+ ).insertBefore( "#inv_send_to_site_id__row" );
2424
+ $("input[name=site_or_location]").on( "change", function() {
2425
+ if ($("input[name=site_or_location]:checked").val()=="site") {
2426
+ $("#inv_send_to_site_id__row").show();
2427
+ $("[id^='inv_send_location_id']").hide();
2428
+ } else {
2429
+ $("#inv_send_to_site_id__row").hide();
2430
+ $("[id^='inv_send_location_id']").show();
2431
+ }
2432
+
2433
+ });
2434
+ """
2435
+ s3 .jquery_ready .append (script )
2410
2436
return True
2411
2437
2412
2438
args = request .args
0 commit comments