'INV / Inventory'

@staticmethod
def inv():

    has_role = current.auth.s3_has_role
    system_roles = current.session.s3.system_roles
    ADMIN = system_roles.ADMIN
    ORG_ADMIN = system_roles.ORG_ADMIN
    s3db = current.s3db
    s3db.inv_recv_crud_strings()
    inv_recv_list = current.response.s3.crud_strings.inv_recv.title_list
    settings = current.deployment_settings
    def basic_warehouse(i):
        if (not (has_role('national_wh_manager') or has_role(ORG_ADMIN))):
            return False
        else:
            return True
    def multi_warehouse(i):
        if (not (has_role('national_wh_manager') or has_role(ORG_ADMIN))):
            return False
        else:
            return True
    use_commit = (lambda i: settings.get_req_use_commit())
    return M()(M('Warehouses', c='inv', f='warehouse', m='summary', check=multi_warehouse)(M('Create', m='create'), M('Import', m='import', p='create')), M('Warehouse    Stock', c='inv', f='inv_item', args='summary')(M('Search    Shipped    Items', f='track_item'), M('Adjust    Stock    Levels', f='adj'), M('Kitting', f='kitting'), M('Import', f='inv_item', m='import', p='create')), M('Reports', c='inv', f='inv_item')(M('Warehouse    Stock', f='inv_item', m='report'), M('Stock    Position', f='inv_item', m='grouped', vars={'report': 'default'}), M('Weight    and    Volume', f='inv_item', m='grouped', vars={'report': 'weight_and_volume'}), M('Stock    Movements', f='inv_item', m='grouped', vars={'report': 'movements'}), M('Expiration    Report', c='inv', f='track_item', vars=dict(report='exp'))), M(inv_recv_list, c='inv', f='recv', check=multi_warehouse)(M('Create', m='create')), M('Sent    Shipments', c='inv', f='send', check=multi_warehouse)(M('Create', m='create'), M('Search    Shipped    Items', f='track_item')), M('Items', c='supply', f='item', m='summary', check=basic_warehouse)(M('Create', m='create'), M('Import', f='catalog_item', m='import', p='create', restrict=[ORG_ADMIN])), M('Catalogs', c='supply', f='catalog', check=basic_warehouse)(M('Create', m='create')), M('Item    Categories', c='supply', f='item_category', restrict=[ORG_ADMIN])(M('Create', m='create')), M('Suppliers', c='inv', f='supplier')(M('Create', m='create'), M('Import', m='import', p='create', restrict=[ORG_ADMIN])), M('Facilities', c='inv', f='facility')(M('Create', m='create', t='org_facility')), M('Facility    Types', c='inv', f='facility_type', restrict=[ADMIN])(M('Create', m='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)())
