index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import Vue from 'vue'
  2. import App from '@/App'
  3. import VueModal from 'vue-js-modal'
  4. import store from '@/store'
  5. import currency from '@@/filters/currency'
  6. import absolute from '@@/filters/absolute'
  7. Vue.filter('currency', currency)
  8. Vue.filter('absolute', absolute)
  9. Vue.use(VueModal)
  10. Vue.config.productionTip = false
  11. Vue.config.silent = true
  12. Vue.config.devTools = true
  13. openerp.eiru_pos = (instance, local) => {
  14. local.PosWidget = instance.Widget.extend({
  15. init(parent, action) {
  16. this._super(parent)
  17. this.mode = action.params.mode
  18. },
  19. start() {
  20. this.sidebarFold()
  21. this.vm = new Vue({
  22. store,
  23. el: this.el,
  24. template: '<App />',
  25. components: {
  26. App
  27. },
  28. data: {
  29. mode: this.mode
  30. },
  31. created() {
  32. this.$store.dispatch('resetProcess')
  33. },
  34. destroyed() {
  35. this.$store.dispatch('resetProcess')
  36. }
  37. });
  38. },
  39. destroy() {
  40. this.vm.$destroy()
  41. $(this.vm.$el).remove()
  42. this.vm = null
  43. this.sidebarUnfold()
  44. this._super.apply(this, arguments)
  45. },
  46. sidebarFold() {
  47. if (!instance.eiru_sidebar_toggler) return
  48. instance.eiru_sidebar_toggler.sidebar_fold()
  49. },
  50. sidebarUnfold() {
  51. if (!instance.eiru_sidebar_toggler) return
  52. instance.eiru_sidebar_toggler.sidebar_unfold()
  53. }
  54. })
  55. instance.web.client_actions.add('eiru_pos.action_launch', 'instance.eiru_pos.PosWidget')
  56. }