Debian Codegraph @

addons/point_of_sale/tests/test_pos_simple_orders.py

raw
1 # -*- coding: utf-8 -*-
2 # Part of Odoo. See LICENSE file for full copyright and licensing details.
3
4 import odoo
5
6 from odoo.addons.point_of_sale.tests.common import TestPoSCommon
7
8
9 @odoo.tests.tagged('post_install', '-at_install')
10 class TestPosSimpleOrders(TestPoSCommon):
11 """
12 Each test case only make a single order.
13 Name of each test corresponds to a sheet in: https://docs.google.com/spreadsheets/d/1mt2jRSDU7OONPBFjwyTcnhRjITQI8rGMLLQA5K3fAjo/edit?usp=sharing
14 """
15
16 def setUp(self):
17 super(TestPosSimpleOrders, self).setUp()
18 self.config = self.basic_config
19 self.product100 = self.create_product('Product_100', self.categ_basic, 100, 50)
20
21 def test_01(self):
22 self._run_test({
23 'payment_methods': self.cash_pm1,
24 'orders': [
25 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
26 ],
27 'journal_entries_before_closing': {},
28 'journal_entries_after_closing': {
29 'session_journal_entry': {
30 'line_ids': [
31 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
32 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
33 ],
34 },
35 'cash_statement': [
36 ((100, ), {
37 'line_ids': [
38 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
39 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
40 ]
41 })
42 ],
43 'bank_payments': [],
44 },
45 })
46
47 def test_02(self):
48 self._run_test({
49 'payment_methods': self.cash_pm1 | self.bank_pm1,
50 'orders': [
51 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
52 ],
53 'journal_entries_before_closing': {},
54 'journal_entries_after_closing': {
55 'session_journal_entry': {
56 'line_ids': [
57 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
58 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
59 ],
60 },
61 'cash_statement': [],
62 'bank_payments': [
63 ((100, ), {
64 'line_ids': [
65 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
66 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
67 ]
68 })
69 ],
70 },
71 })
72
73 def test_03(self):
74 self._run_test({
75 'payment_methods': self.cash_pm1 | self.pay_later_pm,
76 'orders': [
77 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
78 ],
79 'journal_entries_before_closing': {},
80 'journal_entries_after_closing': {
81 'session_journal_entry': {
82 'line_ids': [
83 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
84 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
85 ],
86 },
87 'cash_statement': [],
88 'bank_payments': [],
89 },
90 })
91
92 def test_04(self):
93 self._run_test({
94 'payment_methods': self.cash_pm1 | self.bank_split_pm1,
95 'orders': [
96 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
97 ],
98 'journal_entries_before_closing': {},
99 'journal_entries_after_closing': {
100 'session_journal_entry': {
101 'line_ids': [
102 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
103 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
104 ],
105 },
106 'cash_statement': [],
107 'bank_payments': [
108 ((100, ), {
109 'line_ids': [
110 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
111 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
112 ]
113 })
114 ],
115 },
116 })
117
118 def test_05(self):
119 self._run_test({
120 'payment_methods': self.cash_split_pm1,
121 'orders': [
122 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
123 ],
124 'journal_entries_before_closing': {},
125 'journal_entries_after_closing': {
126 'session_journal_entry': {
127 'line_ids': [
128 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
129 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
130 ],
131 },
132 'cash_statement': [
133 ((100, ), {
134 'line_ids': [
135 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
136 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
137 ]
138 })
139 ],
140 'bank_payments': [],
141 },
142 })
143
144 def test_06(self):
145 self._run_test({
146 'payment_methods': self.cash_pm1 | self.pay_later_pm,
147 'orders': [
148 {'pos_order_lines_ui_args': [], 'payments': [(self.cash_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
149 ],
150 'journal_entries_before_closing': {},
151 'journal_entries_after_closing': {
152 'session_journal_entry': {
153 'line_ids': [
154 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
155 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
156 ],
157 },
158 'cash_statement': [
159 ((100, ), {
160 'line_ids': [
161 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
162 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
163 ]
164 })
165 ],
166 'bank_payments': [],
167 },
168 })
169
170 def test_07(self):
171 self._run_test({
172 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
173 'orders': [
174 {'pos_order_lines_ui_args': [], 'payments': [(self.bank_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
175 ],
176 'journal_entries_before_closing': {},
177 'journal_entries_after_closing': {
178 'session_journal_entry': {
179 'line_ids': [
180 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
181 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
182 ],
183 },
184 'cash_statement': [],
185 'bank_payments': [
186 ((100, ), {
187 'line_ids': [
188 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
189 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
190 ]
191 })
192 ],
193 },
194 })
195
196 def test_08(self):
197 self._run_test({
198 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
199 'orders': [
200 {'pos_order_lines_ui_args': [], 'payments': [(self.bank_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
201 ],
202 'journal_entries_before_closing': {},
203 'journal_entries_after_closing': {
204 'session_journal_entry': {
205 'line_ids': [
206 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
207 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
208 ],
209 },
210 'cash_statement': [],
211 'bank_payments': [
212 ((100, ), {
213 'line_ids': [
214 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
215 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
216 ]
217 })
218 ],
219 },
220 })
221
222 def test_09(self):
223 self._run_test({
224 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
225 'orders': [
226 {'pos_order_lines_ui_args': [], 'payments': [(self.cash_split_pm1, 100), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
227 ],
228 'journal_entries_before_closing': {},
229 'journal_entries_after_closing': {
230 'session_journal_entry': {
231 'line_ids': [
232 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
233 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
234 ],
235 },
236 'cash_statement': [
237 ((100, ), {
238 'line_ids': [
239 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},
240 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
241 ]
242 })
243 ],
244 'bank_payments': [],
245 },
246 })
247
248 def test_10(self):
249 self._run_test({
250 'payment_methods': self.cash_pm1 | self.pay_later_pm,
251 'orders': [
252 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
253 ],
254 'journal_entries_before_closing': {},
255 'journal_entries_after_closing': {
256 'session_journal_entry': {
257 'line_ids': [
258 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
259 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
260 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
261 ],
262 },
263 'cash_statement': [
264 ((200, ), {
265 'line_ids': [
266 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
267 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
268 ]
269 })
270 ],
271 'bank_payments': [],
272 },
273 })
274
275 def test_11(self):
276 self._run_test({
277 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
278 'orders': [
279 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.pay_later_pm, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
280 ],
281 'journal_entries_before_closing': {},
282 'journal_entries_after_closing': {
283 'session_journal_entry': {
284 'line_ids': [
285 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
286 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
287 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
288 ],
289 },
290 'cash_statement': [],
291 'bank_payments': [
292 ((200, ), {
293 'line_ids': [
294 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
295 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
296 ]
297 })
298 ],
299 },
300 })
301
302 def test_12(self):
303 self._run_test({
304 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
305 'orders': [
306 {'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, 'uuid': '00100-010-0001'},
307 ],
308 'journal_entries_before_closing': {},
309 'journal_entries_after_closing': {
310 'session_journal_entry': {
311 'line_ids': [
312 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
313 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
314 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
315 ],
316 },
317 'cash_statement': [
318 ((200, ), {
319 'line_ids': [
320 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
321 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
322 ]
323 })
324 ],
325 'bank_payments': [],
326 },
327 })
328
329 def test_13(self):
330 self._run_test({
331 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
332 'orders': [
333 {'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, 'uuid': '00100-010-0001'},
334 ],
335 'journal_entries_before_closing': {},
336 'journal_entries_after_closing': {
337 'session_journal_entry': {
338 'line_ids': [
339 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
340 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
341 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
342 ],
343 },
344 'cash_statement': [],
345 'bank_payments': [
346 ((200, ), {
347 'line_ids': [
348 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
349 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
350 ]
351 })
352 ],
353 },
354 })
355
356 def test_14(self):
357 self._run_test({
358 'payment_methods': self.cash_pm1,
359 'orders': [
360 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
361 ],
362 'journal_entries_before_closing': {},
363 'journal_entries_after_closing': {
364 'session_journal_entry': {
365 'line_ids': [
366 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
367 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
368 ],
369 },
370 'cash_statement': [
371 ((100, ), {
372 'line_ids': [
373 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},
374 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
375 ]
376 })
377 ],
378 'bank_payments': [],
379 },
380 })
381
382 def test_15(self):
383 self._run_test({
384 'payment_methods': self.cash_pm1 | self.bank_pm1,
385 'orders': [
386 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
387 ],
388 'journal_entries_before_closing': {},
389 'journal_entries_after_closing': {
390 'session_journal_entry': {
391 'line_ids': [
392 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
393 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},
394 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
395 ],
396 },
397 'cash_statement': [
398 ((-100, ), {
399 'line_ids': [
400 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
401 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
402 ]
403 })
404 ],
405 'bank_payments': [
406 ((200, ), {
407 'line_ids': [
408 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},
409 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},
410 ]
411 })
412 ],
413 },
414 })
415
416 def test_16(self):
417 self._run_test({
418 'payment_methods': self.cash_pm1 | self.bank_split_pm1,
419 'orders': [
420 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 200), (self.cash_pm1, -100)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
421 ],
422 'journal_entries_before_closing': {},
423 'journal_entries_after_closing': {
424 'session_journal_entry': {
425 'line_ids': [
426 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
427 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
428 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},
429 ],
430 },
431 'cash_statement': [
432 ((-100, ), {
433 'line_ids': [
434 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
435 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},
436 ]
437 })
438 ],
439 'bank_payments': [
440 ((200, ), {
441 'line_ids': [
442 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
443 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
444 ]
445 })
446 ],
447 },
448 })
449
450 def test_17(self):
451 self._run_test({
452 'payment_methods': self.cash_split_pm1,
453 'orders': [
454 {'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, 'uuid': '00100-010-0001'},
455 ],
456 'journal_entries_before_closing': {},
457 'journal_entries_after_closing': {
458 'session_journal_entry': {
459 'line_ids': [
460 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
461 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},
462 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},
463 ],
464 },
465 'cash_statement': [
466 ((200, ), {
467 'line_ids': [
468 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},
469 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},
470 ]
471 }),
472 ((-100, ), {
473 'line_ids': [
474 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},
475 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},
476 ]
477 })
478 ],
479 'bank_payments': [],
480 },
481 })
482
483 def test_18(self):
484 self._run_test({
485 'payment_methods': self.cash_pm1 | self.pay_later_pm,
486 'orders': [
487 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
488 ],
489 'journal_entries_before_closing': {},
490 'journal_entries_after_closing': {
491 'session_journal_entry': {
492 'line_ids': [
493 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
494 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
495 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},
496 ],
497 },
498 'cash_statement': [
499 ((50, ), {
500 'line_ids': [
501 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},
502 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},
503 ]
504 })
505 ],
506 'bank_payments': [],
507 },
508 })
509
510 def test_19(self):
511 self._run_test({
512 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,
513 'orders': [
514 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 50), (self.pay_later_pm, 50)], 'customer': self.customer, 'is_invoiced': False, 'uuid': '00100-010-0001'},
515 ],
516 'journal_entries_before_closing': {},
517 'journal_entries_after_closing': {
518 'session_journal_entry': {
519 'line_ids': [
520 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
521 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},
522 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
523 ],
524 },
525 'cash_statement': [],
526 'bank_payments': [
527 ((50, ), {
528 'line_ids': [
529 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},
530 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},
531 ]
532 })
533 ],
534 },
535 })
536
537 def test_20(self):
538 self._run_test({
539 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,
540 'orders': [
541 {'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, 'uuid': '00100-010-0001'},
542 ],
543 'journal_entries_before_closing': {},
544 'journal_entries_after_closing': {
545 'session_journal_entry': {
546 'line_ids': [
547 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
548 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},
549 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
550 ],
551 },
552 'cash_statement': [],
553 'bank_payments': [
554 ((50, ), {
555 'line_ids': [
556 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
557 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},
558 ]
559 })
560 ],
561 },
562 })
563
564 def test_21(self):
565 self._run_test({
566 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,
567 'orders': [
568 {'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, 'uuid': '00100-010-0001'},
569 ],
570 'journal_entries_before_closing': {},
571 'journal_entries_after_closing': {
572 'session_journal_entry': {
573 'line_ids': [
574 {'account_id': self.sales_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},
575 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
576 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},
577 ],
578 },
579 'cash_statement': [
580 ((50, ), {
581 'line_ids': [
582 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},
583 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},
584 ]
585 })
586 ],
587 'bank_payments': [],
588 },
589 })