1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const state = {
- currencies: []
- }
- const getters = {
- currencies(state) {
- return state.currencies
- }
- }
- const mutations = {
- pushCurrencies(state, payload) {
- state.currencies = payload.currencies
- }
- }
- const actions = {
- fetchCurrencies({ commit, dispatch }) {
- return new Promise((resolve, reject) => {
- let ResCurrency = new openerp.web.Model('res.currency')
- ResCurrency.call('get_currencies', {
- context: new openerp.web.CompoundContext()
- }).then(response => {
- commit('pushCurrencies', {
- currencies: response
- })
- dispatch('loaded', 'currencies')
- resolve()
- }).fail(error => {
- console.log(error);
- reject(error)
- })
- })
- }
- }
- export default {
- state,
- getters,
- mutations,
- actions
- }
|