|
@@ -13,8 +13,8 @@ const getters = {
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
|
- fetchProducts (state) {
|
|
|
-
|
|
|
+ pushProducts(state, payload) {
|
|
|
+ state.products = payload.products
|
|
|
},
|
|
|
selectProducts (state, payload) {
|
|
|
state.selectedProducts = []
|
|
@@ -27,10 +27,17 @@ const mutations = {
|
|
|
|
|
|
const actions = {
|
|
|
fetchProducts ({ commit }) {
|
|
|
-
|
|
|
+ let product = new openerp.web.Model('product.product')
|
|
|
+ product.query(['name', 'display_name', 'list_price', 'qty_available', 'image_medium']).all().then(response => {
|
|
|
+ commit('pushProducts', {
|
|
|
+ products: response
|
|
|
+ })
|
|
|
+ }).fail(error => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
},
|
|
|
- selectProducts({ commit }, payload) {
|
|
|
- commit('selectProducts', payload)
|
|
|
+ selectProduct({ commit }) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|