Prechádzať zdrojové kódy

[FIX] method signature

robert 6 rokov pred
rodič
commit
81531d4ba2
1 zmenil súbory, kde vykonal 11 pridanie a 40 odobranie
  1. 11 40
      controllers/main.py

+ 11 - 40
controllers/main.py

@@ -86,8 +86,11 @@ class PosSales(http.Controller):
                 'date': get_datetime(),
                 'user': get_current_user(),
                 'currencies': currencies,
+                'journals': get_journals(),
                 'customers': get_customers(image_type=image_type),
-                'products': get_products(image_type, map(lambda x: x.get('locationStock').get('id'), warehouses))
+                'products': get_products(image_type, map(lambda x: x.get('locationStock').get('id'), warehouses)),
+                'paymentTerms': get_payment_terms(),
+                'warehouses': warehouses
             }
 
         # Take data for payment
@@ -183,21 +186,13 @@ class PosSales(http.Controller):
 
         # Imports
         from server_datetime import get_date, get_datetime
-        from account_journal import get_currency
         
         '''
         ╔═╗╦╔╗╔╦╔═╗╦ ╦  ╔╗ ╦ ╦╔╦╗╔═╗╔═╗╔╦╗  ╔═╗╔═╗╔═╗  ╔═╗╦═╗╔═╗╔═╗╔═╗╔╦╗╦ ╦╦═╗╔═╗
         ╠╣ ║║║║║╚═╗╠═╣  ╠╩╗║ ║ ║║║ ╦║╣  ║   ╠═╝║ ║╚═╗  ╠═╝╠╦╝║ ║║  ║╣  ║║║ ║╠╦╝║╣ 
         ╚  ╩╝╚╝╩╚═╝╩ ╩  ╚═╝╚═╝═╩╝╚═╝╚═╝ ╩   ╩  ╚═╝╚═╝  ╩  ╩╚═╚═╝╚═╝╚═╝═╩╝╚═╝╩╚═╚═╝
         '''
-        def finish_budget_pos(
-            journal_id,
-            customer_id,
-            cart_items,
-            date_now,
-            payment_term_id,
-            warehouse_id
-        ):
+        def finish_budget_pos(journal_id, customer_id, cart_items, date_now, payment_term_id, warehouse_id):
             # Imports
             from account_journal import get_currency
             from sale_order import create_sale_from_cart
@@ -221,17 +216,7 @@ class PosSales(http.Controller):
         ╠╣ ║║║║║╚═╗╠═╣  ╚═╗╠═╣║  ║╣   ╠═╝║ ║╚═╗  ╠═╝╠╦╝║ ║║  ║╣  ║║║ ║╠╦╝║╣ 
         ╚  ╩╝╚╝╩╚═╝╩ ╩  ╚═╝╩ ╩╩═╝╚═╝  ╩  ╚═╝╚═╝  ╩  ╩╚═╚═╝╚═╝╚═╝═╩╝╚═╝╩╚═╚═╝
         '''
-        def finish_sale_pos(
-            journal_id, 
-            customer_id, 
-            cart_items, 
-            date_now, 
-            payment_term_id, 
-            payment, 
-            payment_method, 
-            bank_payment_data, 
-            warehouse_id
-        ):
+        def finish_sale_pos(journal_id, customer_id, cart_items, date_now, payment_term_id, payment, payment_method, bank_payment_data, warehouse_id):
             # Create budget
             sale_order_id, currency_id = finish_budget_pos(journal_id, customer_id, cart_items, date_now, payment_term_id, warehouse_id)
 
@@ -290,14 +275,8 @@ class PosSales(http.Controller):
         ╠╣ ║║║║║╚═╗╠═╣  ╠═╝╠╦╝║ ║ ║║║ ║║   ║   ╠═╝║║  ╠╩╗║║║║║ ╦
         ╚  ╩╝╚╝╩╚═╝╩ ╩  ╩  ╩╚═╚═╝═╩╝╚═╝╚═╝ ╩   ╩  ╩╚═╝╩ ╩╩╝╚╝╚═╝
         '''
-        def finish_process_picking(
-            journal_id,
-            customer_id,
-            cart_items,
-            date_now,
-            payment_term_id
-        ):
-            sale_order_id, _ = finish_budget_pos(journal_id, customer_id, cart_items, date_now, payment_term_id)
+        def finish_process_picking(journal_id, customer_id, cart_items, date_now, payment_term_id, warehouse_id):
+            sale_order_id, _ = finish_budget_pos(journal_id, customer_id, cart_items, date_now, payment_term_id, warehouse_id)
             
             # Imports
             from sale_order import confirm_sale_order, force_assign_picking
@@ -315,18 +294,10 @@ class PosSales(http.Controller):
         ╠╣ ║║║║║╚═╗╠═╣  ╠═╝╠═╣╚╦╝║║║║╣ ║║║ ║ 
         ╚  ╩╝╚╝╩╚═╝╩ ╩  ╩  ╩ ╩ ╩ ╩ ╩╚═╝╝╚╝ ╩ 
         '''
-        def finish_payment(
-            sale_order_id,
-            currency_id,
-            date_now,
-            payment_term_id,
-            payment,
-            payment_method,
-            bank_payment_data
-        ):
+        def finish_payment(sale_order_id, currency_id, date_now, payment_term_id, payment, payment_method, bank_payment_data):
             # Imports
             from account_invoice import (
-                create_invoice, 
+                create_invoice,
                 create_invoice_move_lines,
                 number_invoice,
                 close_invoice
@@ -412,7 +383,7 @@ class PosSales(http.Controller):
                 finish_sale_pos(journal_id, customer_id, cart_items, date_now, payment_term_id, payment, payment_method, bank_payment_data, warehouse_id)
 
             if mode == 'product_picking':
-                finish_process_picking(journal_id, customer_id, cart_items, date_now, payment_term_id)
+                finish_process_picking(journal_id, customer_id, cart_items, date_now, payment_term_id, warehouse_id)
 
             if mode == 'payment':
                 sale_order_id = row.get('saleOrderId', None)