From 4e679ab943a9e4a67c36ff56a187a0d00c8553d6 Mon Sep 17 00:00:00 2001 From: Brice bib Bartoletti Date: Fri, 25 Feb 2022 15:42:04 +0000 Subject: [PATCH] [IMP] PoS: test create_ui_order_data add discount This commit gives the possibility to create pos_order_line with discount This is needed in order to reproduce real usecase. X-original-commit: 49bfb576a76e2ad4449326c4b12ebf57bece7069 Part-of: odoo/odoo#85461 --- addons/point_of_sale/tests/common.py | 18 +++++--- .../tests/test_pos_basic_config.py | 46 +++++++++---------- .../test_pos_multiple_receivable_accounts.py | 12 ++--- .../tests/test_pos_other_currency_config.py | 22 ++++----- .../tests/test_pos_products_with_tax.py | 14 +++--- .../tests/test_pos_simple_invoiced_orders.py | 34 +++++++------- .../tests/test_pos_simple_orders.py | 42 ++++++++--------- .../tests/test_pos_stock_account.py | 12 ++--- .../tests/test_pos_with_fiscal_position.py | 18 ++++---- 9 files changed, 112 insertions(+), 106 deletions(-) diff --git a/addons/point_of_sale/tests/common.py b/addons/point_of_sale/tests/common.py index 2c16284419f..bebdc742576 100644 --- a/addons/point_of_sale/tests/common.py +++ b/addons/point_of_sale/tests/common.py @@ -384,7 +384,7 @@ class TestPoSCommon(ValuationReconciliationTestCommon): def create_random_uid(self): return ('%05d-%03d-%04d' % (randint(1, 99999), randint(1, 999), randint(1, 9999))) - def create_ui_order_data(self, product_quantity_pairs, customer=False, is_invoiced=False, payments=None, uid=None): + def create_ui_order_data(self, pos_order_lines_ui_args, customer=False, is_invoiced=False, payments=None, uid=None): """ Mocks the order_data generated by the pos ui. This is useful in making orders in an open pos session without making tours. @@ -399,17 +399,19 @@ class TestPoSCommon(ValuationReconciliationTestCommon): The above values should be set when `self.open_new_session` is called. - :param list(tuple) product_quantity_pairs: pair of `ordered product` and `quantity` + :param list(tuple) pos_order_lines_ui_args: pairs of `ordered product` and `quantity` + or triplet of `ordered product`, `quantity` and discount :param list(tuple) payments: pair of `payment_method` and `amount` """ default_fiscal_position = self.config.default_fiscal_position_id fiscal_position = customer.property_account_position_id if customer else default_fiscal_position - def create_order_line(product, quantity): + def create_order_line(product, quantity, discount=0.0): price_unit = self.pricelist._get_product_price(product, quantity) tax_ids = fiscal_position.map_tax(product.taxes_id) + price_unit_after_discount = price_unit * (1 - discount / 100.0) tax_values = ( - tax_ids.compute_all(price_unit, self.currency, quantity) + tax_ids.compute_all(price_unit_after_discount, self.currency, quantity) if tax_ids else { 'total_excluded': price_unit * quantity, @@ -417,7 +419,7 @@ class TestPoSCommon(ValuationReconciliationTestCommon): } ) return (0, 0, { - 'discount': 0, + 'discount': discount, 'id': randint(1, 1000000), 'pack_lot_ids': [], 'price_unit': price_unit, @@ -438,7 +440,11 @@ class TestPoSCommon(ValuationReconciliationTestCommon): uid = uid or self.create_random_uid() # 1. generate the order lines - order_lines = [create_order_line(product, quantity) for product, quantity in product_quantity_pairs] + order_lines = [ + create_order_line(product, quantity, discount and discount[0] or 0.0) + for product, quantity, *discount + in pos_order_lines_ui_args + ] # 2. generate the payments total_amount_incl = sum(line[2]['price_subtotal_incl'] for line in order_lines) diff --git a/addons/point_of_sale/tests/test_pos_basic_config.py b/addons/point_of_sale/tests/test_pos_basic_config.py index 9cec21a0768..006a49a3f97 100644 --- a/addons/point_of_sale/tests/test_pos_basic_config.py +++ b/addons/point_of_sale/tests/test_pos_basic_config.py @@ -104,9 +104,9 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 5)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 7), (self.product3, 1)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.bank_pm1, 220)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 5)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 7), (self.product3, 1)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.bank_pm1, 220)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -238,9 +238,9 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 6), (self.product2, 3), (self.product3, 1), ], 'payments': [(self.cash_pm1, 150)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 1), (self.product2, 20), ], 'payments': [(self.bank_pm1, 410)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 10), (self.product3, 1), ], 'payments': [(self.bank_pm1, 130)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 6), (self.product2, 3), (self.product3, 1), ], 'payments': [(self.cash_pm1, 150)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 1), (self.product2, 20), ], 'payments': [(self.bank_pm1, 410)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product3, 1), ], 'payments': [(self.bank_pm1, 130)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { @@ -296,7 +296,7 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product0, 1)], 'payments': [(self.bank_pm1, 0)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product0, 1)], 'payments': [(self.bank_pm1, 0)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -415,8 +415,8 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 1), (self.product2, 5)], 'payments': [(self.bank_pm1, 110)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 3), (self.product2, 2), (self.product3, 1)], 'payments': [(self.cash_pm1, 100)], 'uid': '12345-123-1234'}, + {'pos_order_lines_ui_args': [(self.product1, 1), (self.product2, 5)], 'payments': [(self.bank_pm1, 110)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 3), (self.product2, 2), (self.product3, 1)], 'payments': [(self.cash_pm1, 100)], 'uid': '12345-123-1234'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -444,9 +444,9 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 5)], 'payments': [(self.cash_split_pm1, 100), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 7), (self.product3, 1)], 'payments': [(self.cash_split_pm1, 70), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.cash_split_pm1, 120), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 5)], 'payments': [(self.cash_split_pm1, 100), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 7), (self.product3, 1)], 'payments': [(self.cash_split_pm1, 70), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.cash_split_pm1, 120), (self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0003'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -570,17 +570,17 @@ class TestPoSBasicConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.cash_split_pm1 | self.bank_pm1 | self.bank_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0003'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0004'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0005'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0006'}, - {'product_quantity_pairs': [(self.product99, 1)], 'payments':[(self.cash_split_pm1, 99)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0007'}, - {'product_quantity_pairs': [(self.product99, 1)], 'payments':[(self.bank_split_pm1, 99)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0008'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0009'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0010'}, - {'product_quantity_pairs': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0011'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0004'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0005'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0006'}, + {'pos_order_lines_ui_args': [(self.product99, 1)], 'payments':[(self.cash_split_pm1, 99)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0007'}, + {'pos_order_lines_ui_args': [(self.product99, 1)], 'payments':[(self.bank_split_pm1, 99)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0008'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0009'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0010'}, + {'pos_order_lines_ui_args': [(self.product1, 10)], 'payments':[(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0011'}, ], 'journal_entries_before_closing': { '00100-010-0001': { diff --git a/addons/point_of_sale/tests/test_pos_multiple_receivable_accounts.py b/addons/point_of_sale/tests/test_pos_multiple_receivable_accounts.py index be0994bfb94..c5c93092b24 100644 --- a/addons/point_of_sale/tests/test_pos_multiple_receivable_accounts.py +++ b/addons/point_of_sale/tests/test_pos_multiple_receivable_accounts.py @@ -95,9 +95,9 @@ class TestPoSMultipleReceivableAccounts(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'payments': [(self.bank_pm1, 158.75)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 264.76)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0987'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'payments': [(self.bank_pm1, 158.75)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 264.76)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0987'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { @@ -197,9 +197,9 @@ class TestPoSMultipleReceivableAccounts(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0987'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'payments': [(self.bank_pm1, 158.75)], 'is_invoiced': True, 'customer': self.customer, 'uid': '09876-098-0988'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 264.76)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0989'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0987'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'payments': [(self.bank_pm1, 158.75)], 'is_invoiced': True, 'customer': self.customer, 'uid': '09876-098-0988'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 264.76)], 'is_invoiced': True, 'customer': self.other_customer, 'uid': '09876-098-0989'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { diff --git a/addons/point_of_sale/tests/test_pos_other_currency_config.py b/addons/point_of_sale/tests/test_pos_other_currency_config.py index 4c0765427dd..b3613ac85d2 100644 --- a/addons/point_of_sale/tests/test_pos_other_currency_config.py +++ b/addons/point_of_sale/tests/test_pos_other_currency_config.py @@ -91,9 +91,9 @@ class TestPoSOtherCurrencyConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm2 | self.bank_pm2, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm2, 139.95)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm2, 139.95)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -167,9 +167,9 @@ class TestPoSOtherCurrencyConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm2 | self.bank_pm2, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm2, 139.95)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm2, 139.95)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { @@ -263,10 +263,10 @@ class TestPoSOtherCurrencyConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm2, 'orders': [ - {'product_quantity_pairs': [(self.product4, 7), (self.product5, 7)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product5, 6), (self.product4, 6), (self.product6, 49)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product5, 2), (self.product6, 13)], 'uid': '00100-010-0003'}, - {'product_quantity_pairs': [(self.product6, 1)], 'uid': '00100-010-0004'}, + {'pos_order_lines_ui_args': [(self.product4, 7), (self.product5, 7)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product5, 6), (self.product4, 6), (self.product6, 49)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product5, 2), (self.product6, 13)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product6, 1)], 'uid': '00100-010-0004'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -294,7 +294,7 @@ class TestPoSOtherCurrencyConfig(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm2, 'orders': [ - {'product_quantity_pairs': [(self.product7, 7)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product7, 7)], 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { diff --git a/addons/point_of_sale/tests/test_pos_products_with_tax.py b/addons/point_of_sale/tests/test_pos_products_with_tax.py index aba391c12aa..d86931d745e 100644 --- a/addons/point_of_sale/tests/test_pos_products_with_tax.py +++ b/addons/point_of_sale/tests/test_pos_products_with_tax.py @@ -76,9 +76,9 @@ class TestPoSProductsWithTax(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 5)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 7), (self.product3, 4)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.bank_pm1, 230.25)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 5)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 7), (self.product3, 4)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 1), (self.product3, 5), (self.product2, 3)], 'payments': [(self.bank_pm1, 230.25)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -169,9 +169,9 @@ class TestPoSProductsWithTax(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product3, 1), (self.product1, 6), (self.product2, 3)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 20), (self.product1, 1)], 'payments': [(self.bank_pm1, 410.7)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 426.09)], 'customer': self.customer, 'is_invoiced': True, 'uid': '09876-098-0987'}, + {'pos_order_lines_ui_args': [(self.product3, 1), (self.product1, 6), (self.product2, 3)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 20), (self.product1, 1)], 'payments': [(self.bank_pm1, 410.7)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 426.09)], 'customer': self.customer, 'is_invoiced': True, 'uid': '09876-098-0987'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { @@ -269,7 +269,7 @@ class TestPoSProductsWithTax(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 3), (self.product2, 2), (self.product3, 1)], 'payments': [(self.cash_pm1, 104.01)], 'customer': self.customer, 'is_invoiced': True, 'uid': '12345-123-1234'}, + {'pos_order_lines_ui_args': [(self.product1, 3), (self.product2, 2), (self.product3, 1)], 'payments': [(self.cash_pm1, 104.01)], 'customer': self.customer, 'is_invoiced': True, 'uid': '12345-123-1234'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { diff --git a/addons/point_of_sale/tests/test_pos_simple_invoiced_orders.py b/addons/point_of_sale/tests/test_pos_simple_invoiced_orders.py index 161f39c38ef..b766b778989 100644 --- a/addons/point_of_sale/tests/test_pos_simple_invoiced_orders.py +++ b/addons/point_of_sale/tests/test_pos_simple_invoiced_orders.py @@ -22,7 +22,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -65,7 +65,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -112,7 +112,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -137,7 +137,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -184,7 +184,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -227,7 +227,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -271,7 +271,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -315,7 +315,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -359,7 +359,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -403,7 +403,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -452,7 +452,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -510,7 +510,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -568,7 +568,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.cash_split_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.cash_split_pm1, -100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -625,7 +625,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -669,7 +669,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -713,7 +713,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { @@ -757,7 +757,7 @@ class TestPosSimpleInvoicedOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': { '00100-010-0001': { diff --git a/addons/point_of_sale/tests/test_pos_simple_orders.py b/addons/point_of_sale/tests/test_pos_simple_orders.py index 9794f21f0e0..6593789fd8b 100644 --- a/addons/point_of_sale/tests/test_pos_simple_orders.py +++ b/addons/point_of_sale/tests/test_pos_simple_orders.py @@ -22,7 +22,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -48,7 +48,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -74,7 +74,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -93,7 +93,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -119,7 +119,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -145,7 +145,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [], 'payments': [(self.cash_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [], 'payments': [(self.cash_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -171,7 +171,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [], 'payments': [(self.bank_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [], 'payments': [(self.bank_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -197,7 +197,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [], 'payments': [(self.bank_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [], 'payments': [(self.bank_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -223,7 +223,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [], 'payments': [(self.cash_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [], 'payments': [(self.cash_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -249,7 +249,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -276,7 +276,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -303,7 +303,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -330,7 +330,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -357,7 +357,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -383,7 +383,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -417,7 +417,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -451,7 +451,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.cash_split_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 200), (self.cash_split_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -484,7 +484,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -511,7 +511,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -538,7 +538,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { @@ -565,7 +565,7 @@ class TestPosSimpleOrders(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_split_pm1 | self.pay_later_pm, 'orders': [ - {'product_quantity_pairs': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uid': '00100-010-0001'}, ], 'journal_entries_before_closing': {}, 'journal_entries_after_closing': { diff --git a/addons/point_of_sale/tests/test_pos_stock_account.py b/addons/point_of_sale/tests/test_pos_stock_account.py index c331f1e7798..bffd7466bab 100644 --- a/addons/point_of_sale/tests/test_pos_stock_account.py +++ b/addons/point_of_sale/tests/test_pos_stock_account.py @@ -88,9 +88,9 @@ class TestPoSStock(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 7), (self.product3, 7)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 6), (self.product2, 6), (self.product3, 6)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 7), (self.product3, 7)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 6), (self.product2, 6), (self.product3, 6)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -157,9 +157,9 @@ class TestPoSStock(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10)], 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product2, 7), (self.product3, 7)], 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product1, 6), (self.product2, 6), (self.product3, 6)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10)], 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product2, 7), (self.product3, 7)], 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product1, 6), (self.product2, 6), (self.product3, 6)], 'is_invoiced': True, 'customer': self.customer, 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': { diff --git a/addons/point_of_sale/tests/test_pos_with_fiscal_position.py b/addons/point_of_sale/tests/test_pos_with_fiscal_position.py index bbec25eb955..8165ab4f63c 100644 --- a/addons/point_of_sale/tests/test_pos_with_fiscal_position.py +++ b/addons/point_of_sale/tests/test_pos_with_fiscal_position.py @@ -134,9 +134,9 @@ class TestPoSWithFiscalPosition(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'customer': self.customer, 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 265.75)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'customer': self.customer, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 265.75)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -221,9 +221,9 @@ class TestPoSWithFiscalPosition(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 619.7)], 'customer': self.customer, 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 265.75)], 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 619.7)], 'customer': self.customer, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'payments': [(self.bank_pm1, 265.75)], 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {}, @@ -315,9 +315,9 @@ class TestPoSWithFiscalPosition(TestPoSCommon): self._run_test({ 'payment_methods': self.cash_pm1 | self.bank_pm1, 'orders': [ - {'product_quantity_pairs': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 691.06)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, - {'product_quantity_pairs': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, - {'product_quantity_pairs': [(self.product2, 5), (self.product3, 5)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0003'}, + {'pos_order_lines_ui_args': [(self.product1, 10), (self.product2, 10), (self.product3, 10)], 'payments': [(self.bank_pm1, 691.06)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'}, + {'pos_order_lines_ui_args': [(self.product1, 5), (self.product2, 5)], 'customer': self.customer, 'uid': '00100-010-0002'}, + {'pos_order_lines_ui_args': [(self.product2, 5), (self.product3, 5)], 'customer': self.other_customer, 'is_invoiced': True, 'uid': '00100-010-0003'}, ], 'before_closing_cb': _before_closing_cb, 'journal_entries_before_closing': {