robert пре 6 година
родитељ
комит
16d737e139

+ 5 - 10
controllers/helpers/__init__.py

@@ -100,7 +100,7 @@ def process_data(data=None):
 
         return order.id
 
-    def paying_order(order_id, supplier_invoice_number=None, date_now=None, payment_term_id=None):
+    def paying_order(order_id, supplier_invoice_number=None, date_now=None, payment_term_id=None, mode=None):
         order = get_purchase_order(order_id)
 
         lines = [{
@@ -152,14 +152,9 @@ def process_data(data=None):
     payment = float(data.get('payment', 0.0))
 
     if mode not in ('product_picking', 'payment', 'product_taking'):
-        order_id = None
-
-        if mode == 'purchase':
-            order_id, currency_id = drafting_order(currency_id, supplier_id, cart_items, date_now, payment_term_id)
-            making_order(order_id)
-            complete_order(order_id)
-        else:
-            paying_order(order_id)
+        order_id, currency_id = drafting_order(currency_id, supplier_id, cart_items, date_now, payment_term_id, warehouse_id)
+        confirm_purchase_order(order_id)
+        paying_order(order_id, supplier_invoice_number, date_now, payment_term_id, mode)
 
     if mode == 'product_picking':
         order_id, currency_id = drafting_order(currency_id, supplier_id, cart_items, date_now, payment_term_id, warehouse_id)
@@ -171,7 +166,7 @@ def process_data(data=None):
         if not order_id:
             return
 
-        paying_order(order_id, supplier_invoice_number, date_now, payment_term_id)
+        paying_order(order_id, supplier_invoice_number, date_now, payment_term_id, mode)
         done_purchase_order(order_id)
 
     if mode == 'product_taking':

+ 1 - 1
controllers/helpers/account_invoice.py

@@ -52,7 +52,7 @@ def validate_invoice(invoice_ids, type=None):
     invoice.action_number()
     invoice.invoice_validate()
 
-    if type != 'purchase':
+    if type == 'expense':
         name = 'GASTO' + invoice.name[invoice.name.index('/'):]
         invoice.write({
             'number': name,

+ 2 - 2
controllers/helpers/product_template.py

@@ -45,7 +45,7 @@ def get_products(type=None, location_ids=[]):
             'name': p.name,
             'displayName': p.display_name,
             'ean13': p.ean13,
-            'imageMedium': p.image_medium,
+            'image': p.image_medium,
             'standardPrice': p.standard_price,
             'variantCount': p.product_variant_count,
             'quantity': 1,
@@ -57,7 +57,7 @@ def get_products(type=None, location_ids=[]):
                 'name': v.name,
                 'displayName': v.display_name,
                 'ean13': v.ean13,
-                'imageMedium': v.image_medium,
+                'image': v.image_medium,
                 'standardPrice': v.standard_price,
                 'quantity': 1,
                 'price': v.standard_price,

+ 1 - 1
controllers/helpers/res_bank.py

@@ -11,4 +11,4 @@ def get_banks():
             'id': bank.id,
             'name': bank.display_name
         } for bank in r.env['res.bank'].search(domain)
-    ]
+    ]

+ 1 - 1
controllers/helpers/res_partner.py

@@ -13,7 +13,7 @@ def get_suppliers():
             'id': s.id,
             'name': s.name,
             'displayName': s.display_name,
-            'imageMedium': s.image_medium,
+            'image': s.image_medium,
             'ruc': s.ruc,
             'phone': s.phone,
             'mobile': s.mobile,

+ 1 - 1
controllers/helpers/stock_warehouse.py

@@ -19,4 +19,4 @@ def get_location_id(warehouse_id):
     if not warehouse_id:
         return None
 
-    return r.env.user.store_id.warehouse_ids.filtered(lambda x: x.id == warehouse_id).id
+    return r.env.user.store_id.warehouse_ids.filtered(lambda x: x.id == warehouse_id).lot_stock_id.id

+ 1 - 1
src/App.vue

@@ -4,7 +4,7 @@
             template(v-if='isPurchase || isExpense')
                 tab-content(title='Cuál es su proveedor?' :beforeChange='checkSupplier')
                     supplier-step
-                tab-content(title="mode === 'purchase' ? 'Qué productos comprarás?' : 'En que gastarás?'" :beforeChange='checkCart')
+                tab-content(:title="mode === 'purchase' ? 'Qué productos comprarás?' : 'En que gastarás?'" :beforeChange='checkCart')
                     product-step
                 tab-content(title='Cómo quieres pagar?' :beforeChange='checkAmountReceived')
                     payment-step

+ 34 - 5
src/components/steps/ProductStep.vue

@@ -1,11 +1,40 @@
 <template lang="pug">
     .purchase-step
         .products-selector
-            searcher(:items='variants' :keys="['name', 'displayName', 'ean13']" @onSearch='filterProducts')
-            card-grid(:items='visibleProducts' :details="['price:c']" :options='selectedCurrency' @onSelect='selectProduct')
-            variant-modal(:items='productWithVariant && productWithVariant.variants' :show='!!productWithVariant' @onSelect='selectProduct' @onClose='selectProduct')
-            price-modal(:item='itemPriced' :options='selectedCurrency' :show='!!itemPriced' @onAccept='changePrice' @onCancel='changePrice')
-        cart(:items='cartItems' @onIncrementQty='addToCart' @onChangePrice='changePrice' @onUndoPrice='undoPrice' @onDecrementQty='decreaseFromCart' @onDeleteItem='removeFromCart' @onTotalComputed='updateCartTotal' :options='selectedCurrency')
+            searcher(
+                :items='variants'
+                :keys="['name', 'displayName', 'ean13']"
+                @onSearch='filterProducts'
+            )
+            card-grid(
+                :items='visibleProducts'
+                :details="['price:c']"
+                :options='selectedCurrency'
+                @onSelect='selectProduct'
+            )
+            variant-modal(
+                :items='productWithVariant && productWithVariant.variants'
+                :show='!!productWithVariant'
+                @onSelect='selectProduct'
+                @onClose='selectProduct'
+            )
+            price-modal(
+                :item='itemPriced'
+                :options='selectedCurrency'
+                :show='!!itemPriced'
+                @onAccept='changePrice'
+                @onCancel='changePrice'
+            )
+        cart(
+            :items='cartItems'
+            @onIncrementQty='addToCart'
+            @onChangePrice='changePrice'
+            @onUndoPrice='undoPrice'
+            @onDecrementQty='decreaseFromCart'
+            @onDeleteItem='removeFromCart'
+            @onTotalComputed='updateCartTotal'
+            :options='selectedCurrency'
+        )
 </template>
 
 <script>

+ 9 - 2
src/components/steps/SupplierStep.vue

@@ -2,8 +2,15 @@
     .purchase-step
         .supplier-selection-step
             .supplier-selector
-                searcher(:items='suppliers' :keys="['name', 'displayName', 'phone', 'mobile', 'email']" @onSearch='filterSuppliers')
-                card-grid(:items='visibleSuppliers' @onSelect='selectSupplier')
+                searcher(
+                    :items='suppliers'
+                    :keys="['name', 'displayName', 'phone', 'mobile', 'email']"
+                    @onSearch='filterSuppliers'
+                )
+                card-grid(
+                    :items='visibleSuppliers'
+                    @onSelect='selectSupplier'
+                )
             transition(name='slide-fade')
                 customer-form
 </template>