diff --git a/controllers/inv.py b/controllers/inv.py index 3721db8d8d..e43c2ca823 100644 --- a/controllers/inv.py +++ b/controllers/inv.py @@ -1378,7 +1378,7 @@ def track_item(): #"send_id", #"req_item_id", (T("Date Released"), "send_id$date"), - (T("Beneficiary"), "send_id$site_id"), + (T("Beneficiary"), "send_id$to_site_id"), (settings.get_inv_send_shortname(), "send_id$send_ref"), (settings.get_req_shortname(), "send_id$req_ref"), (T("Items/Description"), "item_id"), @@ -1460,6 +1460,33 @@ def track_item(): ] ) s3.filter = (FS("expiry_date") != None) + elif report == "dist": + # Summary of Releases + s3.crud_strings["inv_track_item"] = Storage(title_list = T("Distribution Report")) + + level_fields = ["send_id$to_site_id$location_id$%s" % level for + level in current.gis.get_relevant_hierarchy_levels()] + + s3db.configure("inv_track_item", + list_fields = ["id", + #"send_id", + #"req_item_id", + (T("Date Sent"), "send_id$date"), + (s3db.inv_send.to_site_id.label, "send_id$to_site_id")] + + level_fields + + [(settings.get_inv_send_shortname(), "send_id$send_ref"), + (settings.get_req_shortname(), "send_id$req_ref"), + (T("Items"), "item_id"), + (T("Source"), "supply_org_id"), + (T("Unit"), "item_pack_id"), + (T("Quantity"), "quantity"), + (T("Unit Cost"), "pack_value"), + (T("Total Cost"), "total_value"), + ], + orderby = "inv_send.date dsc", + sort = True + ) + s3.filter = (FS("send_id$type") == 21) output = s3_rest_controller(rheader = s3db.inv_rheader) return output diff --git a/modules/s3/s3gis.py b/modules/s3/s3gis.py index 42888bd5f9..e13b982ae3 100644 --- a/modules/s3/s3gis.py +++ b/modules/s3/s3gis.py @@ -1527,6 +1527,7 @@ def get_location_hierarchy(self, level=None, location=None): db = current.db s3db = current.s3db table = s3db.gis_hierarchy + ltable = s3db.gis_location fields = (table.uuid, table.L1, @@ -1536,7 +1537,15 @@ def get_location_hierarchy(self, level=None, location=None): table.L5, ) - query = (table.uuid == "SITE_DEFAULT") + countries = current.deployment_settings.get_gis_countries() + if len(countries) == 1: + #If the site is only configed for one country, use the hierarchy for that country + query = (table.location_id == ltable.id) & \ + (ltable.level == "L0") & \ + (ltable.name == self.get_country(countries[0],key_type="code")) + else: + query = (table.uuid == "SITE_DEFAULT") + if not location: config = GIS.get_config() location = config.region_location_id diff --git a/modules/s3/s3query.py b/modules/s3/s3query.py index b2cdc7fd9f..b0447e6310 100644 --- a/modules/s3/s3query.py +++ b/modules/s3/s3query.py @@ -676,7 +676,8 @@ def __init__(self, resource, selector, label=None): # Fall back to the field label if label is None: fname = self.fname - if fname in ["L1", "L2", "L3", "L3", "L4", "L5"]: + # Does this really belong here? Better on gis_location fields + if fname in ("L1", "L2", "L3", "L3", "L4", "L5"): try: label = current.gis.get_location_hierarchy(fname) except: diff --git a/modules/s3cfg.py b/modules/s3cfg.py index 7aa31bc1cd..1827e9fb69 100644 --- a/modules/s3cfg.py +++ b/modules/s3cfg.py @@ -3482,6 +3482,11 @@ def get_req_restrict_on_complete(self): # ------------------------------------------------------------------------- # Supply # + def get_supply_autocomplete(self): + """ + Whether supply fields should use an Autocomplete instead of a dropdown + """ + return self.supply.get("autocomplete", False) def get_supply_catalog_default(self): return self.inv.get("catalog_default", "Default") diff --git a/modules/s3db/hrm.py b/modules/s3db/hrm.py index 1de73d62e4..d27e500e26 100644 --- a/modules/s3db/hrm.py +++ b/modules/s3db/hrm.py @@ -5165,7 +5165,7 @@ def hrm_human_resource_onaccept(form): ltable.insert(human_resource_id=id, job_title_id=job_title_id, main=True, - start_date=request.utcnow, + date=request.utcnow, ) data = Storage() diff --git a/modules/s3db/inv.py b/modules/s3db/inv.py index 11aa3b55ed..2010f4ab8a 100644 --- a/modules/s3db/inv.py +++ b/modules/s3db/inv.py @@ -1050,6 +1050,9 @@ def model(self): #send_type_opts.update(self.inv_item_status_opts) send_type_opts.update(settings.get_inv_send_types()) + self.org_facility # Load model + crud_strings + ADD_FACILITY = crud_strings.org_facility.label_create + site_types = auth.org_site_types tablename = "inv_send" define_table(tablename, @@ -1094,6 +1097,10 @@ def model(self): not_filterby = "obsolete", not_filter_opts = (True,), )), + comment = S3AddResourceLink(c="org", + f="facility", + label=ADD_FACILITY, + title=ADD_FACILITY) ), organisation_id( label = T("To Organization"), @@ -1183,6 +1190,8 @@ def model(self): s3_comments(), *s3_meta_fields()) + levels = current.gis.get_relevant_hierarchy_levels() + # Filter Widgets filter_widgets = [ S3TextFilter(["sender_id$first_name", @@ -1194,7 +1203,7 @@ def model(self): "recipient_id$first_name", "recipient_id$middle_name", "recipient_id$last_name", - ], + ] + ["location_id$%s" % level for level in levels], label = T("Search"), comment = T("Search for an item by text."), ), @@ -1204,6 +1213,9 @@ def model(self): cols = 2, hidden = True, ), + S3LocationFilter("to_site_id$location_id", + levels=levels, + ), S3TextFilter("type", label = T("Shipment Type"), hidden = True, @@ -1875,6 +1887,12 @@ def model(self): label = T("Search"), #comment = recv_search_comment, ), + S3OptionsFilter("send_id$site_id"), + S3LocationFilter("send_id$to_site_id$location_id", + #hidden=True, + label=T("Sent to Location"), + levels=levels, + ), S3DateFilter("send_id$date", label = T("Sent date"), hidden = True, @@ -2142,7 +2160,8 @@ def inv_send_controller(cls): s3 = response.s3 # Limit site_id to sites the user has permissions for - error_msg = T("You do not have permission for any facility to send a shipment.") + error_msg = T("You do not have permission for any %s to send a shipment.") % \ + current.deployment_settings.get_inv_facility_label() current.auth.permitted_facilities(table=sendtable, error_msg=error_msg) # Set Validator for checking against the number of items in the warehouse @@ -2534,7 +2553,7 @@ def inv_send_process(): site_id = send_record.to_site_id, comments = send_record.comments, status = SHIP_STATUS_SENT, - type = 1, # 1:"Another Inventory" + type = 11, # 11:"Another Inventory" ) # Change the status for all track items in this shipment to In transit diff --git a/modules/s3db/supply.py b/modules/s3db/supply.py index 8c4f6faebd..a0a45ebb39 100644 --- a/modules/s3db/supply.py +++ b/modules/s3db/supply.py @@ -425,6 +425,10 @@ def model(self): supply_item_represent = supply_ItemRepresent(show_link=True) # Reusable Field + if settings.get_supply_autocomplete(): + default_widget = S3AutocompleteWidget("supply", "item"), + else: + default_widget = None supply_item_id = S3ReusableField("item_id", "reference %s" % tablename, # 'item_id' for backwards-compatibility label = T("Item"), @@ -434,7 +438,7 @@ def model(self): supply_item_represent, sort=True), sortby = "name", - widget = S3AutocompleteWidget("supply", "item"), + widget = default_widget, comment=S3AddResourceLink(c="supply", f="item", label=ADD_ITEM, diff --git a/modules/s3db/vol.py b/modules/s3db/vol.py index 6c6d584854..e9c8bd8255 100644 --- a/modules/s3db/vol.py +++ b/modules/s3db/vol.py @@ -742,6 +742,8 @@ def prep(r): list_fields.append((T("Trainings"),"person_id$training.course_id")) if settings.get_hrm_use_certificates(): list_fields.append((T("Certificates"),"person_id$certification.certificate_id")) + if r.representation == "xls": + list_fields.append("person_id$comments") # Volunteer Programme and Active-status report_options = get_config("report_options") diff --git a/modules/s3menus.py b/modules/s3menus.py index e0d1e3bfe1..25d2b11f7e 100644 --- a/modules/s3menus.py +++ b/modules/s3menus.py @@ -1197,6 +1197,8 @@ def inv(): vars=dict(report="inc")), M("Summary of Releases", c="inv", f="track_item", vars=dict(report="rel")), + M("Distribution Report", c="inv", f="track_item", + vars=dict(report="dist")), ), M(inv_recv_list, c="inv", f="recv", translate=False)( # Already T() M("Create", m="create"), diff --git a/modules/templates/IFRC/config.py b/modules/templates/IFRC/config.py index c006b0fd31..6ee170a8d8 100644 --- a/modules/templates/IFRC/config.py +++ b/modules/templates/IFRC/config.py @@ -484,6 +484,9 @@ def currency_default(default): # Activity types for experience record settings.hrm.activity_types = {"rdrt": "RDRT Mission"} + # ----------------------------------------------------------------------------- + # Supply / Inventory / Warehouse + settings.supply.autocomplete = True # ============================================================================= # Template Modules # Comment/uncomment modules here to disable/enable them diff --git a/modules/templates/Nepal/config.py b/modules/templates/Nepal/config.py index d5754b9175..6aba12092e 100644 --- a/modules/templates/Nepal/config.py +++ b/modules/templates/Nepal/config.py @@ -8,6 +8,7 @@ from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current +from gluon.html import * from gluon.storage import Storage def config(settings): @@ -23,7 +24,7 @@ def config(settings): T = current.T settings.base.system_name = T("Nepal Sahana Disaster Management Platform") - #settings.base.system_name_short = T("Sahana") + settings.base.system_name_short = T("Sahana") # PrePopulate data settings.base.prepopulate = ("Nepal", "default/users") @@ -39,6 +40,7 @@ def config(settings): # Do new users need to be approved by an administrator prior to being able to login? #settings.auth.registration_requires_approval = True settings.auth.registration_requests_organisation = True + settings.auth.registration_requests_site = True # Approval emails get sent to all admins settings.mail.approver = "ADMIN" @@ -101,13 +103,20 @@ def config(settings): #settings.L10n.translate_gis_location = True # Uncomment this to Translate Organisation Names/Acronyms #settings.L10n.translate_org_organisation = True + # Finance settings - #settings.fin.currencies = { - # "EUR" : T("Euros"), - # "GBP" : T("Great British Pounds"), - # "USD" : T("United States Dollars"), - #} - #settings.fin.currency_default = "USD" + settings.fin.currencies = { + "NPR" : T("Nepalese Rupee"), + "AUD" : T("Australian Dollar"), + "EUR" : T("Euro"), + "GBP" : T("British Pound"), + "INR" : T("Indian Rupee"), + "KRW" : T("South-Korean Won"), + "JPY" : T("Japanese Yen"), + "NZD" : T("New Zealand Dollar"), + "USD" : T("United States Dollars"), + } + settings.fin.currency_default = "NPR" # Security Policy # http://eden.sahanafoundation.org/wiki/S3AAA#System-widePolicy @@ -123,11 +132,153 @@ def config(settings): settings.security.policy = 6 # Organisation-ACLs # ------------------------------------------------------------------------- + # Module Settings # Simple Requests settings.req.req_type = ("Other",) # Uncomment to disable the Commit step in the workflow & simply move direct to Ship settings.req.use_commit = False + # Doesn't appear to work... Need inline field and/or component tab? + settings.hrm.multi_job_titles = True + + # ------------------------------------------------------------------------- + def customise_inv_home(): + response = current.response + response.title = T("Sahana : Warehouse Management") + s3 = response.s3 + s3db = current.s3db + s3.stylesheets.append("../themes/CERT/homepage.css") + s3.stylesheets.append("../fonts/font-awesome/css/font-awesome.css") + + response.title + from s3 import S3CustomController + S3CustomController._view("Nepal","inv_index.html") + site_id = current.auth.user.site_id + if current.auth.user.site_id: + current_site = DIV(XML(T("You are currently managing stock for: %(site)s") % \ + {"site":s3db.org_site_represent(site_id, + show_link = True)}), + _title = T("Contact Administrator to change your default facility."), + ) + else: + current_site = "" + menus = [{"title": T("Receive"), + "icon": "sign-in", + "description": T("Receive a New shipment or an Existing shipment at your site"), + "module": "inv", + "function": "recv", + "args": "create", + "vars": {"recv.status":2}, + "buttons": [{"args": "create", + "icon": "plus", + "label": T("New"), + }, + {"args":"", + "vars": {"recv.status":2}, + "icon": "list", + "label": T("Existing"), + }] + }, + {"title": T("Send"), + "icon": "sign-out", + "description": T("Send a shipment from your site."), + "module": "inv", + "function": "send", + "args": "create", + "buttons": [{"args": "create", + "icon": "plus", + "label": T("New"), + }] + }, + {"title": T("Stock"), + "icon": "cubes", + "description": T("List of stock at sites"), + "module": "inv", + "function": "inv_item", + "args": None, + "buttons": [{"args": "create", + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args": "list", + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Received Shipments"), + "icon": "indent", + "description": T("List of received shipments"), + "module": "inv", + "function": "recv", + "args": "summary", + "vars": {"recv.status__ne":2}, + "buttons": [{"args":"", + "vars": {"recv.status__ne":2}, + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args":"", + "vars": {"recv.status__ne":2}, + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Sent Shipments"), + "icon": "outdent", + "description": T("List of sent shipments"), + "module": "inv", + "function": "send", + "args": "summary", + "buttons": [{"args": "create", + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args": "list", + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Warehouses"), + "icon": "th", + "description": T("List of Warehouses."), + "module": "inv", + "function": "warehouse", + "args": "summary", + "buttons": [{"args": "create", + "icon": "plus", + "label": T("Create"), #@ToDo: look up name of facility + }, + {"args": "summary", + "icon": "list", + "label": T("All"), + }] + }, + ] + return dict(menus = menus, + current_site = current_site) + settings.customise_inv_home = customise_inv_home + # ------------------------------------------------------------------------- + def customise_inv_recv_controller(**attr): + s3 = current.response.s3 + # Custom PreP + standard_prep = s3.prep + def custom_prep(r): + # Call standard prep + if callable(standard_prep): + result = standard_prep(r) + if not result: + return False + + # Customise titles + if r.vars.get("recv.status") == "2": + s3.crud_strings.inv_recv.title_list = T("Existing Shipments to Received") + if r.vars.get("recv.status__ne") == "2": + s3.crud_strings.inv_recv.title_list = T("Received Shipments") + return True + s3.prep = custom_prep + return attr + settings.customise_inv_recv_controller = customise_inv_recv_controller + # ------------------------------------------------------------------------- # Comment/uncomment modules here to disable/enable them # Modules menu is defined in modules/eden/menu.py @@ -185,7 +336,7 @@ def config(settings): #description = "Central point to record details on People", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) - module_type = 10 + module_type = None )), ("org", Storage( name_nice = T("Organizations"), @@ -197,7 +348,7 @@ def config(settings): name_nice = T("Staff"), #description = "Human Resources Management", restricted = True, - module_type = 2, + module_type = None, )), ("vol", Storage( name_nice = T("Volunteers"), @@ -209,7 +360,7 @@ def config(settings): name_nice = T("Content Management"), #description = "Content Management System", restricted = True, - module_type = 10, + module_type = None, )), #("doc", Storage( # name_nice = T("Documents"), @@ -231,12 +382,12 @@ def config(settings): restricted = True, module_type = None, # Not displayed )), - #("inv", Storage( - # name_nice = T("Warehouses"), - # #description = "Receiving and Sending Items", - # restricted = True, - # module_type = 4 - #)), + ("inv", Storage( + name_nice = T("Warehouses"), + #description = "Receiving and Sending Items", + restricted = True, + module_type = 4 + )), #("asset", Storage( # name_nice = T("Assets"), # #description = "Recording and Assigning Assets", @@ -256,12 +407,12 @@ def config(settings): restricted = True, module_type = 10, )), - #("project", Storage( - # name_nice = T("Projects"), - # #description = "Tracking of Projects, Activities and Tasks", - # restricted = True, - # module_type = 2 - #)), + ("project", Storage( + name_nice = T("Projects"), + #description = "Tracking of Projects, Activities and Tasks", + restricted = True, + module_type = 10 + )), ("cr", Storage( name_nice = T("Shelters"), #description = "Tracks the location, capacity and breakdown of victims in Shelters", @@ -272,10 +423,10 @@ def config(settings): name_nice = T("Hospitals"), #description = "Helps to monitor status of hospitals", restricted = True, - module_type = 10 + module_type = 3 )), ("patient", Storage( - name_nice = T("Patient Tracking"), + name_nice = T("Patients"), #description = "Tracking of Patients", restricted = True, module_type = 10 @@ -286,12 +437,12 @@ def config(settings): # restricted = True, # module_type = 10, #)), - #("event", Storage( - # name_nice = T("Events"), - # #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", - # restricted = True, - # module_type = 10, - #)), + ("event", Storage( + name_nice = T("Events"), + #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", + restricted = True, + module_type = 10, + )), #("transport", Storage( # name_nice = T("Transport"), # restricted = True, diff --git a/modules/templates/Nepal/controllers.py b/modules/templates/Nepal/controllers.py index c7f83c6a9e..c128c1b145 100644 --- a/modules/templates/Nepal/controllers.py +++ b/modules/templates/Nepal/controllers.py @@ -17,6 +17,7 @@ def __call__(self): response = current.response s3 = response.s3 s3.stylesheets.append("../themes/CERT/homepage.css") + s3.stylesheets.append("../fonts/font-awesome/css/font-awesome.css") settings = current.deployment_settings output["title"] = response.title = settings.get_system_name() @@ -64,37 +65,38 @@ def __call__(self): item = "" output["item"] = item - menus = [{"title": T("Volunteers"), - "icon": "user", - "description": T("Manage people who have volunteered for your organization, their contact details, certicates and trainings."), - "module": "vol", - "function": "volunteer", + menus = [{"title": T("Organizations"), + "icon": "sitemap", + "description": T("List of Organizations responding with contact details and their activities to provide 3W (Who's Doing What Where)."), + "module": "org", + "function": "organisation", + "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Shelters"), - "icon": "home", - "description": T("List of Shelters."), - "module": "cr", - "function": "shelter", + {"title": T("Volunteers"), + "icon": "user", + "description": T("Manage people volunteering for your organization, their contact details, certificates and trainings."), + "module": "vol", + "function": "volunteer", "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, {"title": T("Hospitals"), - "icon": "h-sign", - "description": T("List of Hospitals."), + "icon": "hospital-o", + "description": T("List of Hospitals and other Health Facilities."), "module": "hms", "function": "hospital", "buttons": [{"args": "summary", @@ -102,51 +104,81 @@ def __call__(self): "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Patients"), - "icon": "ambulance", - "description": T("List of Patients."), - "module": "patient", - "function": "patient", + {"title": T("Warehouses"), + "icon": "th", + "description": T("Manage Warehouses, their stock and shipments."), + "module": "inv", + "function": "index", + "buttons": [{"function": "warehouse", + "args": "summary", + "icon": "list", + "label": T("View"), + }, + {"function": "warehouse", + "args": "create", + "icon": "plus", + "label": T("Create"), + }] + }, + {"title": T("Resources"), + "icon": "cube", + "description": T("Resources that organizations have that are useful for response."), + "module": "org", + "function": "resource", + "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Requests"), - "icon": "truck", - "description": T("Requests for goods or services."), - "module": "req", - "function": "req", - "args": None, + {"title": T("Shelters"), + "icon": "home", + "description": T("List of Shelters for displaced people."), + "module": "cr", + "function": "shelter", "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Resources"), - "icon": "wrench", - "description": T("Resources that organizations have that are useful for response."), - "module": "org", - "function": "resource", + {"title": T("Patients"), + "icon": "ambulance", + "description": T("Register and of Patients."), + "module": "patient", + "function": "patient", + "buttons": [{"args": "summary", + "icon": "list", + "label": T("View"), + }, + {"args": "create", + "icon": "plus", + "label": T("Create"), + }] + }, + {"title": T("Requests"), + "icon": "truck", + "description": T("Requests for resources or services."), + "module": "req", + "function": "req", "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, diff --git a/modules/templates/Nepal/css.cfg b/modules/templates/Nepal/css.cfg deleted file mode 100644 index 0bcec78d39..0000000000 --- a/modules/templates/Nepal/css.cfg +++ /dev/null @@ -1,43 +0,0 @@ -../themes/default/layout.css -../themes/default/xtheme-gray.css -../themes/default/footer.css -../themes/default/widgets.css -../themes/default/shortcut.css -../themes/default/homepage.css -bootstrap/font-awesome.css -plugins/jquery.cluetip.css -plugins/jquery.dataTables.css -plugins/jquery.dataTables.responsive.css -#ui/accordion.css -ui/core.css -ui/autocomplete.css -ui/button.css -ui/datepicker.css -ui/dialog.css -# Needed for Delphi -#ui/draggable.css -ui/menu.css -#ui/progressbar.css -ui/resizable.css -ui/selectmenu.css -ui/slider.css -#ui/sortable.css -#ui/spinner.css -ui/tabs.css -#ui/tooltip.css -ui/fgtimepicker.css -ui/multiselect.css -ui/timepicker-addon.css -foundation/jquery-ui.theme.css -gis/style.css -zocial/zocial.css -../themes/default/gis.css -../themes/foundation/map.css -../themes/default/mobile.css -../themes/default/print.css -d3/nv.d3.css -../themes/default/report.css -../themes/default/survey.css -../themes/default/style.css -#../themes/MY_THEME/style.css -# Final line required for parsing diff --git a/modules/templates/Nepal/menus.py b/modules/templates/Nepal/menus.py new file mode 100644 index 0000000000..600937447b --- /dev/null +++ b/modules/templates/Nepal/menus.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +from gluon import current +from s3 import * +from s3layouts import * +try: + from .layouts import * +except ImportError: + pass +import s3menus as default + +# ============================================================================= +class S3OptionsMenu(default.S3OptionsMenu): + """ + Custom Application Options Menu + + Define one function per controller with the controller prefix as + function name and with "self" as its only argument (must be an + instance method!), and let it return the controller menu + definition as an instance of the layout (=an S3NavigationItem + subclass, standard: M). + + In the standard layout, the main item in a controller menu does + not have a label. If you want to re-use a menu for multiple + controllers, do *not* define a controller setting (c="xxx") in + the main item. + """ + + def __init__(self, name): + """ Constructor """ + + try: + self.menu = getattr(self, name)() + except: + self.menu = None + + # ------------------------------------------------------------------------- + @staticmethod + def inv(): + """ INV / Inventory """ + + ADMIN = current.session.s3.system_roles.ADMIN + + current.s3db.inv_recv_crud_strings() + inv_recv_list = current.response.s3.crud_strings.inv_recv.title_list + + settings = current.deployment_settings + use_adjust = lambda i: not settings.get_inv_direct_stock_edits() + use_commit = lambda i: settings.get_req_use_commit() + + return M()( + M("Receive", c="inv", f="recv")( + M("New", m="create"), + M("Exiting", vars = {"a":1}), # + M("Timeline", args="timeline"), + ), + M("Send", c="inv", f="send")( + M("New", m="create"), + M("Exiting", vars = {"a":1}), # + M("Sent Shipments", m="summary"), # + M("Search Shipped Items", f="track_item"), + M("Timeline", args="timeline"), + ), + M("Stock", c="inv", f="inv_item", m="summary")( + M("Adjust Stock Levels", f="adj", check=use_adjust), + M("Kitting", f="kitting"), + M("Import", f="inv_item", m="import", p="create"), + ), + M("Warehouses", c="inv", f="warehouse")( + M("Create", m="create"), + M("Import", m="import", p="create"), + ), + M("Requests", c="req", f="req")( + M("Create", m="create"), + M("Requested Items", f="req_item"), + ), + M("Commitments", c="req", f="commit", check=use_commit)( + ), + M("Reports", c="inv", f="inv_item")( + M("Stock Matrix", f="inv_item", m="report"), + M("Distribution Report", c="inv", f="track_item", + vars=dict(report="dist")), + ), + M("Administration", restrict=[ADMIN])( + M("Items", c="supply", f="item", m="summary"), + M("Catalogs", c="supply", f="catalog"), + M("Item Categories", c="supply", f="item_category", + restrict=[ADMIN]), + M("Suppliers", c="inv", f="supplier"), + M("Facilities", c="inv", f="facility"), + M("Facility Types", c="inv", f="facility_type", + restrict=[ADMIN]), + M("Warehouse Types", c="inv", f="warehouse_type", + restrict=[ADMIN]), + ) + ) diff --git a/modules/templates/Nepal/tasks.cfg b/modules/templates/Nepal/tasks.cfg index 9aefce6c21..90dcc44a57 100644 --- a/modules/templates/Nepal/tasks.cfg +++ b/modules/templates/Nepal/tasks.cfg @@ -43,3 +43,14 @@ org,office_type,default/office_type.csv,office_type.xsl # ----------------------------------------------------------------------------- cms,post,cms_post.csv,post.xsl # ============================================================================= +# DEMO Data Only +# Inventory +# inv,inv_item,inv_item.csv,inv_item.xsl +# Requests +#req,req,test/inv-mngt/req_req.csv,req.xsl +#req,req_item,test/inv-mngt/req_item.csv,req_item.xsl +# The order in which the items are shipped is important +# so do not try to change the order or merge the following track_item files +#inv,track_item,test/inv-mngt/track_item1.csv,track_item.xsl +#inv,track_item,test/inv-mngt/track_item2.csv,track_item.xsl +#inv,track_item,test/inv-mngt/track_item3.csv,track_item.xsl diff --git a/modules/templates/Nepal/views/index.html b/modules/templates/Nepal/views/index.html index a4d7585d4d..d4d87d9208 100644 --- a/modules/templates/Nepal/views/index.html +++ b/modules/templates/Nepal/views/index.html @@ -1,5 +1,5 @@ {{extend "layout.html"}} -
+
+ {{i=0}} {{for menu in menus:}} + {{i+=1}} + {{if i>4:}} + {{i=0}} +
+
+ {{pass}}
-

+

{{=menu["title"]}}

- + {{if "buttons" in menu:}} + + {{pass}}

{{=menu["description"]}}

{{pass}} diff --git a/modules/templates/Nepal/views/inv_index.html b/modules/templates/Nepal/views/inv_index.html new file mode 100644 index 0000000000..99ab138197 --- /dev/null +++ b/modules/templates/Nepal/views/inv_index.html @@ -0,0 +1,34 @@ +{{extend "layout.html"}} +