123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590 |
- # -*- coding: utf-8 -*-
- # Part of Odoo. See LICENSE file for full copyright and licensing details.
- import odoo
- from odoo.addons.point_of_sale.tests.common import TestPoSCommon
- @odoo.tests.tagged('post_install', '-at_install')
- class TestPosSimpleOrders(TestPoSCommon):
- """
- Each test case only make a single order.
- Name of each test corresponds to a sheet in: https://docs.google.com/spreadsheets/d/1mt2jRSDU7OONPBFjwyTcnhRjITQI8rGMLLQA5K3fAjo/edit?usp=sharing
- """
- def setUp(self):
- super(TestPosSimpleOrders, self).setUp()
- self.config = self.basic_config
- self.product100 = self.create_product('Product_100', self.categ_basic, 100, 50)
- def test_01(self):
- self._run_test({
- 'payment_methods': self.cash_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_02(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_03(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [],
- },
- })
- def test_04(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_split_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_05(self):
- self._run_test({
- 'payment_methods': self.cash_split_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_06(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_07(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_08(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_09(self):
- self._run_test({
- 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_10(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_11(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_12(self):
- self._run_test({
- 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_13(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_14(self):
- self._run_test({
- 'payment_methods': self.cash_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((100, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_15(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((-100, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_16(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_split_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((-100, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_17(self):
- self._run_test({
- 'payment_methods': self.cash_split_pm1,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((200, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
- ]
- }),
- ((-100, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_18(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((50, ), {
- 'line_ids': [
- {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
- def test_19(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((50, ), {
- 'line_ids': [
- {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_20(self):
- self._run_test({
- 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- ],
- },
- 'cash_statement': [],
- 'bank_payments': [
- ((50, ), {
- 'line_ids': [
- {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},
- ]
- })
- ],
- },
- })
- def test_21(self):
- self._run_test({
- 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
- 'orders': [
- {'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': {
- 'session_journal_entry': {
- 'line_ids': [
- {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},
- ],
- },
- 'cash_statement': [
- ((50, ), {
- 'line_ids': [
- {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
- {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},
- ]
- })
- ],
- 'bank_payments': [],
- },
- })
|