test_pos_simple_orders.py 32 KB

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