forked from OCA/sale-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from TDu/mobile_app_controller
Mobile app front router and controller
- Loading branch information
Showing
15 changed files
with
3,049 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
from odoo import http | ||
|
||
|
||
class ShopfloorMobileAppController(http.Controller): | ||
|
||
module_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] | ||
|
||
@http.route( | ||
["/shopfloormobile/scanner/<path:path_fragment>", "/shopfloormobile/scanner"], | ||
auth="public", | ||
) | ||
def load_app_and_assets(self, path_fragment=""): | ||
# TODO Should be authorized via api.key except for the login ? | ||
if path_fragment.startswith("src/"): | ||
# Serving an asset | ||
payload = os.path.join(self.module_path, "static", "wms", path_fragment) | ||
else: | ||
# Serving the app | ||
payload = os.path.join(self.module_path, "static", "wms", "index.html") | ||
return http.send_file(payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {HomePage} from './homepage.js' | ||
import {ScanAnything} from "./scenario/scan_anything.js"; | ||
import {LoginPage} from './loginpage.js' | ||
// const NotFound = { template: '<div>Lost in the scanner app.</div>' } | ||
|
||
const routes = [ | ||
{ path: '/', component: HomePage, name: 'home'}, | ||
{ path: '/login', component: LoginPage, name: 'login'}, | ||
{ path: '/scananything/:codebar?', component: ScanAnything, name: 'scananything' }, | ||
// TODO Fix this it needs to be the last route, but I think it is not anymore with the dynamic one added. | ||
// { path: '*', component: NotFound }, | ||
] | ||
|
||
const router = new VueRouter({ | ||
routes: routes, | ||
}) | ||
router.beforeEach(async (to, from, next) => { | ||
await Vue.nextTick() | ||
if (!router.app.config.authenticated && to.name!='login'){ | ||
next('login') | ||
} else { | ||
next() | ||
} | ||
}) | ||
|
||
export {router}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
shopfloor_mobile/static/wms/src/scenario/single_pack_putaway.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.