index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 '@/components/filters/currency'
  6. import absolute from '@/components/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_purchases = (instance, local) => {
  14. local.PurchasesWidget = 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. })
  32. },
  33. destroy() {
  34. this.vm.$destroy()
  35. $(this.vm.$el).remove()
  36. this.vm = null
  37. this.sidebarUnfold()
  38. this._super.apply(this, arguments)
  39. },
  40. sidebarFold() {
  41. if (!instance.eiru_sidebar_toggler) return
  42. instance.eiru_sidebar_toggler.sidebar_fold()
  43. },
  44. sidebarUnfold() {
  45. if (!instance.eiru_sidebar_toggler) return
  46. instance.eiru_sidebar_toggler.sidebar_unfold()
  47. }
  48. })
  49. instance.web.client_actions.add('eiru_purchases.action_launch', 'instance.eiru_purchases.PurchasesWidget')
  50. }