Browse Source

[FIX] producto create route

Gogs 7 years ago
parent
commit
178b8fb776

+ 1 - 1
controllers/main.py

@@ -226,7 +226,7 @@ class Sales(http.Controller):
         Create product and return data
     '''
     @http.route('/eiru_sales/create_product', type='json', auth='user', methods=['POST'], cors='*')
-    def create_customer(self, **kw):
+    def create_product(self, **kw):
         self.make_info_log('Creating customer')
 
         product = request.env['product.template'].create({

+ 2 - 2
src/App.vue

@@ -15,8 +15,8 @@
     import { FormWizard, TabContent } from 'vue-form-wizard'
     import 'vue-form-wizard/dist/vue-form-wizard.min.css'
 
-    import ProductStep from '@/components/steps/Product'
-    import CustomerStep from '@/components/steps/Customer'
+    import ProductStep from '@@/steps/Product'
+    import CustomerStep from '@@/steps/Customer'
 
     export default {
         components: {

+ 4 - 4
src/components/common/Cart.vue

@@ -4,13 +4,16 @@
             h2.currency-cart-total {{ totalInCurrencyFormat() }}
         .cart-items-wrapper
             transition-group(name='list' tag='ul' class='cart-items')
-                cart-item(v-for='item in items' :key='item.id' :item='item')
+                cart-item(v-for='(item, index) in items' :key='index' :index='index' :item='item')
 </template>
 
 <script>
     import CartItem from './CartItem'
 
     export default {
+        components: {
+            CartItem
+        },
         props: {
             items: {
                 type: Array,
@@ -50,9 +53,6 @@
                 default: 'before'
             }
         },
-        components: {
-            CartItem
-        },
         methods: {
             totalInCurrencyFormat() {
                 return this.total.toFixed(this.decimalPlaces).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,')

+ 10 - 36
src/components/common/CartItem.vue

@@ -1,11 +1,11 @@
 <template lang="pug">
     li.cart-item
-        h3.item-name {{ getName() }}
-        input.item-quantity(type='number' min='1' :value='quantity' v-model='quantity')
+        h3.item-name
+        input.item-quantity(type='number' min='1')
         span.item-x x
-        span.item-price {{ getPrice() }}
+        span.item-price
         span.item-equals =
-        span.item-subtotal {{ getSubTotal() }}
+        span.item-subtotal
         .cart-item-options-wrapper
             .cart-item-options
                 .cart-item-option(class='fa fa-plus')
@@ -16,40 +16,14 @@
 <script>
     export default {
         props: {
-            item: {
-                type: Object,
-                default: {
-                    displayName: '',
-                    price: 0,
-                    quantity: 0
-                },
+            index: {
+                type: Number,
+                default: -1,
                 required: true
-            }
-        },
-        computed: {
-            quantity: {
-                get() {
-                    return this.item.quantity
-                },
-                set(value) {
-                    this.item.quantity = parseFloat(value) || 1
-                }
-            }
-        },
-        watch: {
-            item(value) {
-                console.log(value)
-            }
-        },
-        methods: {
-            getName() {
-                return this.item.displayName || 'No name'
-            },
-            getPrice() {
-                return this.item.price || 0
             },
-            getSubTotal() {
-                return this.getPrice() * (this.quantity || 0)
+            item: {
+                type: Object,
+                default: null
             }
         }
     }

+ 3 - 3
src/components/steps/Customer.vue

@@ -11,10 +11,10 @@
 
 <script>
     import { mapGetters, mapActions } from 'vuex'
-    import { Searcher, CardGrid } from '@/components/common'
+    import { Searcher, CardGrid } from '@@/common'
 
-    import CustomerModal from '@/components/modals/CustomerModal'
-    import CustomerForm from '@/components/forms/CustomerForm'
+    import CustomerModal from '@@/modals/CustomerModal'
+    import CustomerForm from '@@/forms/CustomerForm'
 
     import { SHOW_CUSTOMER_FORM, SUBMIT_CUSTOMER, HIDE_CUSTOMER_FORM, SELECT_CUSTOMER } from '@/constants/actionTypes'