|
@@ -16,7 +16,7 @@ const actions = {
|
|
|
commit('setLoading', false)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return axios.get('/eiru_sales/init', {
|
|
|
params: {
|
|
|
mode: getters.mode
|
|
@@ -208,7 +208,6 @@ const actions = {
|
|
|
commit('storeData', data)
|
|
|
|
|
|
dispatch('syncData').then(() => {
|
|
|
- commit('resetData')
|
|
|
commit('setLoading', false)
|
|
|
commit('setCompleted', true)
|
|
|
})
|
|
@@ -218,18 +217,9 @@ const actions = {
|
|
|
|
|
|
if (getters.isWired) {
|
|
|
dispatch('syncData')
|
|
|
- commit('resetData')
|
|
|
}
|
|
|
},
|
|
|
- syncData({ getters, dispatch }) {
|
|
|
- if (getters.data.length == 0) {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (getters.isSynchronizable) {
|
|
|
- dispatch('notify', 'Estás conectado nuevamente. Sincronizaremos sus datos en segundo plano')
|
|
|
- }
|
|
|
-
|
|
|
+ syncData({ getters, commit, dispatch }) {
|
|
|
return axios.post('/eiru_sales/finish', {
|
|
|
jsonrpc: '2.0',
|
|
|
method: 'call',
|
|
@@ -237,6 +227,8 @@ const actions = {
|
|
|
data: getters.data
|
|
|
}
|
|
|
}).then(() => {
|
|
|
+ commit('resetData')
|
|
|
+
|
|
|
if (getters.isSynchronizable) {
|
|
|
dispatch('notify', 'Los datos fueron sincronizados con éxito')
|
|
|
}
|
|
@@ -341,16 +333,26 @@ const actions = {
|
|
|
|
|
|
dispatch('initProcess')
|
|
|
},
|
|
|
- changeNetStatus({ commit, dispatch }, isWired) {
|
|
|
- dispatch('hideTopbar', isWired)
|
|
|
+ changeNetStatus({ commit, dispatch, getters }, isWired) {
|
|
|
commit('setNetStatus', isWired)
|
|
|
+ dispatch('hideTopbar', isWired)
|
|
|
|
|
|
if (isWired) {
|
|
|
- dispatch('syncData')
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ if (getters.isSynchronizable && getters.hasDataToSync) {
|
|
|
+ dispatch('notify', 'Estás conectado nuevamente. Sus datos serán sincronizados en segundo plano')
|
|
|
+ dispatch('syncData')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (getters.wasWired) {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- dispatch('notify', 'Estás sin conexión. Ocultaremos el menú superior mientras sigas trabajando')
|
|
|
+ dispatch('notify', 'Estás conectado nuevamente')
|
|
|
+ } else {
|
|
|
+ dispatch('notify', 'Estás sin conexión. Ocultaremos el menú superior mientras sigas trabajando')
|
|
|
+ }
|
|
|
},
|
|
|
hideTopbar(_, isWired) {
|
|
|
if (!openerp.eiru_topbar_toggler) {
|