Best Python code snippet using localstack_python
test_pos_simple_invoiced_orders.py
Source:test_pos_simple_invoiced_orders.py
1# -*- coding: utf-8 -*-2# Part of Odoo. See LICENSE file for full copyright and licensing details.3import odoo4from odoo.addons.point_of_sale.tests.common import TestPoSCommon5@odoo.tests.tagged('post_install', '-at_install')6class TestPosSimpleInvoicedOrders(TestPoSCommon):7 """8 Each test case only make a single **invoiced** order.9 Name of each test corresponds to a sheet in: https://docs.google.com/spreadsheets/d/1mt2jRSDU7OONPBFjwyTcnhRjITQI8rGMLLQA5K3fAjo/edit?usp=sharing10 """11 def setUp(self):12 super(TestPosSimpleInvoicedOrders, self).setUp()13 self.config = self.basic_config14 self.product100 = self.create_product('Product_100', self.categ_basic, 100, 50)15 def test_01b(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': True, 'uid': '00100-010-0001'},20 ],21 'journal_entries_before_closing': {22 '00100-010-0001': {23 'invoice': {24 'line_ids': [25 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},26 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},27 ]28 },29 'payments': [30 ((self.cash_pm1, 100), {31 'line_ids': [32 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},33 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},34 ]35 }),36 ],37 }38 },39 'journal_entries_after_closing': {40 'session_journal_entry': {41 'line_ids': [42 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},43 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},44 ],45 },46 'cash_statement': [47 ((100, ), {48 'line_ids': [49 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},50 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},51 ]52 })53 ],54 'bank_payments': [],55 },56 })57 def test_02b(self):58 self._run_test({59 'payment_methods': self.cash_pm1 | self.bank_pm1,60 'orders': [61 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'},62 ],63 'journal_entries_before_closing': {64 '00100-010-0001': {65 'invoice': {66 'journal_id': self.config.invoice_journal_id.id,67 'line_ids': [68 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},69 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},70 ]71 },72 'payments': [73 ((self.bank_pm1, 100), {74 'journal_id': self.config.journal_id.id,75 'line_ids': [76 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},77 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},78 ]79 }),80 ],81 }82 },83 'journal_entries_after_closing': {84 'session_journal_entry': {85 'journal_id': self.config.journal_id.id,86 'line_ids': [87 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},88 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},89 ],90 },91 'cash_statement': [],92 'bank_payments': [93 ((100, ), {94 'journal_id': self.bank_pm1.journal_id.id,95 'line_ids': [96 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},97 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},98 ]99 })100 ],101 },102 })103 def test_03b(self):104 self._run_test({105 'payment_methods': self.cash_pm1 | self.pay_later_pm,106 'orders': [107 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.pay_later_pm, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'},108 ],109 'journal_entries_before_closing': {110 '00100-010-0001': {111 'invoice': {112 'journal_id': self.config.invoice_journal_id.id,113 'line_ids': [114 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},115 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},116 ]117 },118 'payments': [],119 }120 },121 'journal_entries_after_closing': {122 'session_journal_entry': False,123 'cash_statement': [],124 'bank_payments': [],125 },126 })127 def test_04b(self):128 self._run_test({129 'payment_methods': self.cash_pm1 | self.bank_split_pm1,130 'orders': [131 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.bank_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'},132 ],133 'journal_entries_before_closing': {134 '00100-010-0001': {135 'invoice': {136 'journal_id': self.config.invoice_journal_id.id,137 'line_ids': [138 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},139 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},140 ]141 },142 'payments': [143 ((self.bank_split_pm1, 100), {144 'journal_id': self.config.journal_id.id,145 'line_ids': [146 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},147 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},148 ]149 }),150 ],151 }152 },153 'journal_entries_after_closing': {154 'session_journal_entry': {155 'journal_id': self.config.journal_id.id,156 'line_ids': [157 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},158 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},159 ],160 },161 'cash_statement': [],162 'bank_payments': [163 ((100, ), {164 'journal_id': self.bank_split_pm1.journal_id.id,165 'line_ids': [166 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},167 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},168 ]169 })170 ],171 },172 })173 def test_05b(self):174 self._run_test({175 'payment_methods': self.cash_split_pm1,176 'orders': [177 {'pos_order_lines_ui_args': [(self.product100, 1)], 'payments': [(self.cash_split_pm1, 100)], 'customer': self.customer, 'is_invoiced': True, 'uid': '00100-010-0001'},178 ],179 'journal_entries_before_closing': {180 '00100-010-0001': {181 'invoice': {182 'line_ids': [183 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},184 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},185 ]186 },187 'payments': [188 ((self.cash_split_pm1, 100), {189 'line_ids': [190 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},191 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},192 ]193 }),194 ],195 }196 },197 'journal_entries_after_closing': {198 'session_journal_entry': {199 'line_ids': [200 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},201 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},202 ],203 },204 'cash_statement': [205 ((100, ), {206 'line_ids': [207 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False},208 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},209 ]210 })211 ],212 'bank_payments': [],213 },214 })215 def test_10b(self):216 self._run_test({217 'payment_methods': self.cash_pm1 | self.pay_later_pm,218 'orders': [219 {'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'},220 ],221 'journal_entries_before_closing': {222 '00100-010-0001': {223 'invoice': {224 'line_ids': [225 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},226 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},227 ]228 },229 'payments': [230 ((self.cash_pm1, 200), {231 'line_ids': [232 # needs to check the residual because it's supposed to be partial reconciled233 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': False, 'amount_residual': -100},234 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False, 'amount_residual': 200},235 ]236 }),237 ],238 }239 },240 'journal_entries_after_closing': {241 'session_journal_entry': {242 'line_ids': [243 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},244 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},245 ],246 },247 'cash_statement': [248 ((200, ), {249 'line_ids': [250 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},251 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},252 ]253 })254 ],255 'bank_payments': [],256 },257 })258 def test_11b(self):259 self._run_test({260 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,261 'orders': [262 {'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'},263 ],264 'journal_entries_before_closing': {265 '00100-010-0001': {266 'invoice': {267 'line_ids': [268 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},269 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},270 ]271 },272 'payments': [273 ((self.bank_pm1, 200), {274 'line_ids': [275 # needs to check the residual because it's supposed to be partial reconciled276 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': False, 'amount_residual': -100},277 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False, 'amount_residual': 200},278 ]279 }),280 ],281 }282 },283 'journal_entries_after_closing': {284 'session_journal_entry': {285 'line_ids': [286 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},287 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},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 def test_12b(self):302 self._run_test({303 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,304 'orders': [305 {'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'},306 ],307 'journal_entries_before_closing': {308 '00100-010-0001': {309 'invoice': {310 'line_ids': [311 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},312 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},313 ]314 },315 'payments': [316 ((self.cash_split_pm1, 200), {317 'line_ids': [318 # needs to check the residual because it's supposed to be partial reconciled319 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': False, 'amount_residual': -100},320 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False, 'amount_residual': 200},321 ]322 }),323 ],324 }325 },326 'journal_entries_after_closing': {327 'session_journal_entry': {328 'line_ids': [329 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},330 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},331 ],332 },333 'cash_statement': [334 ((200, ), {335 'line_ids': [336 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},337 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},338 ]339 })340 ],341 'bank_payments': [],342 },343 })344 def test_13b(self):345 self._run_test({346 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,347 'orders': [348 {'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'},349 ],350 'journal_entries_before_closing': {351 '00100-010-0001': {352 'invoice': {353 'line_ids': [354 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},355 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},356 ]357 },358 'payments': [359 ((self.bank_split_pm1, 200), {360 'line_ids': [361 # needs to check the residual because it's supposed to be partial reconciled362 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': False, 'amount_residual': -100},363 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False, 'amount_residual': 200},364 ]365 }),366 ],367 }368 },369 'journal_entries_after_closing': {370 'session_journal_entry': {371 'line_ids': [372 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},373 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},374 ],375 },376 'cash_statement': [],377 'bank_payments': [378 ((200, ), {379 'line_ids': [380 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},381 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},382 ]383 })384 ],385 },386 })387 def test_14b(self):388 self._run_test({389 'payment_methods': self.cash_pm1,390 'orders': [391 {'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'},392 ],393 'journal_entries_before_closing': {394 '00100-010-0001': {395 'invoice': {396 'line_ids': [397 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},398 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},399 ]400 },401 'payments': [402 ((self.cash_pm1, 200), {403 'line_ids': [404 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},405 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},406 ]407 }),408 ((self.cash_pm1, -100), {409 'line_ids': [410 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},411 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},412 ]413 }),414 ],415 }416 },417 'journal_entries_after_closing': {418 'session_journal_entry': {419 'line_ids': [420 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},421 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},422 ],423 },424 'cash_statement': [425 ((100, ), {426 'line_ids': [427 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': False},428 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},429 ]430 })431 ],432 'bank_payments': [],433 },434 })435 def test_15b(self):436 self._run_test({437 'payment_methods': self.cash_pm1 | self.bank_pm1,438 'orders': [439 {'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'},440 ],441 'journal_entries_before_closing': {442 '00100-010-0001': {443 'invoice': {444 'line_ids': [445 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},446 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},447 ]448 },449 'payments': [450 ((self.bank_pm1, 200), {451 'line_ids': [452 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},453 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},454 ]455 }),456 ((self.cash_pm1, -100), {457 'line_ids': [458 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},459 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},460 ]461 }),462 ],463 }464 },465 'journal_entries_after_closing': {466 'session_journal_entry': {467 'line_ids': [468 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': True},469 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},470 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},471 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},472 ],473 },474 'cash_statement': [475 ((-100, ), {476 'line_ids': [477 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},478 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},479 ]480 })481 ],482 'bank_payments': [483 ((200, ), {484 'line_ids': [485 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},486 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},487 ]488 })489 ],490 },491 })492 def test_16b(self):493 self._run_test({494 'payment_methods': self.cash_pm1 | self.bank_split_pm1,495 'orders': [496 {'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'},497 ],498 'journal_entries_before_closing': {499 '00100-010-0001': {500 'invoice': {501 'line_ids': [502 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},503 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},504 ]505 },506 'payments': [507 ((self.bank_split_pm1, 200), {508 'line_ids': [509 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},510 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},511 ]512 }),513 ((self.cash_pm1, -100), {514 'line_ids': [515 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},516 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},517 ]518 }),519 ],520 }521 },522 'journal_entries_after_closing': {523 'session_journal_entry': {524 'line_ids': [525 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},526 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': True},527 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},528 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},529 ],530 },531 'cash_statement': [532 ((-100, ), {533 'line_ids': [534 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},535 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},536 ]537 })538 ],539 'bank_payments': [540 ((200, ), {541 'line_ids': [542 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},543 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},544 ]545 })546 ],547 },548 })549 def test_17b(self):550 self._run_test({551 'payment_methods': self.cash_split_pm1,552 'orders': [553 {'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'},554 ],555 'journal_entries_before_closing': {556 '00100-010-0001': {557 'invoice': {558 'line_ids': [559 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},560 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},561 ]562 },563 'payments': [564 ((self.cash_split_pm1, 200), {565 'line_ids': [566 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},567 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 200, 'credit': 0, 'reconciled': False},568 ]569 }),570 ((self.cash_split_pm1, -100), {571 'line_ids': [572 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},573 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 100, 'reconciled': False},574 ]575 }),576 ],577 }578 },579 'journal_entries_after_closing': {580 'session_journal_entry': {581 'line_ids': [582 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': True},583 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': True},584 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 200, 'reconciled': True},585 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 100, 'credit': 0, 'reconciled': True},586 ],587 },588 'cash_statement': [589 ((200, ), {590 'line_ids': [591 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 200, 'credit': 0, 'reconciled': False},592 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 200, 'reconciled': True},593 ]594 }),595 ((-100, ), {596 'line_ids': [597 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False},598 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': True},599 ]600 })601 ],602 'bank_payments': [],603 },604 })605 def test_18b(self):606 self._run_test({607 'payment_methods': self.cash_pm1 | self.pay_later_pm,608 'orders': [609 {'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'},610 ],611 'journal_entries_before_closing': {612 '00100-010-0001': {613 'invoice': {614 'line_ids': [615 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False, 'amount_residual': 0},616 # needs to check the residual because it's supposed to be partial reconciled617 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False, 'amount_residual': 50},618 ]619 },620 'payments': [621 ((self.cash_pm1, 50), {622 'line_ids': [623 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},624 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},625 ]626 }),627 ],628 }629 },630 'journal_entries_after_closing': {631 'session_journal_entry': {632 'line_ids': [633 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},634 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},635 ],636 },637 'cash_statement': [638 ((50, ), {639 'line_ids': [640 {'account_id': self.cash_pm1.journal_id.default_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},641 {'account_id': self.cash_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},642 ]643 })644 ],645 'bank_payments': [],646 },647 })648 def test_19b(self):649 self._run_test({650 'payment_methods': self.cash_pm1 | self.bank_pm1 | self.pay_later_pm,651 'orders': [652 {'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'},653 ],654 'journal_entries_before_closing': {655 '00100-010-0001': {656 'invoice': {657 'line_ids': [658 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False, 'amount_residual': 0},659 # needs to check the residual because it's supposed to be partial reconciled660 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False, 'amount_residual': 50},661 ]662 },663 'payments': [664 ((self.bank_pm1, 50), {665 'line_ids': [666 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},667 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},668 ]669 }),670 ],671 }672 },673 'journal_entries_after_closing': {674 'session_journal_entry': {675 'line_ids': [676 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': True},677 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},678 ],679 },680 'cash_statement': [],681 'bank_payments': [682 ((50, ), {683 'line_ids': [684 {'account_id': self.bank_pm1.outstanding_account_id.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},685 {'account_id': self.bank_pm1.receivable_account_id.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},686 ]687 })688 ],689 },690 })691 def test_20b(self):692 self._run_test({693 'payment_methods': self.cash_pm1 | self.bank_split_pm1 | self.pay_later_pm,694 'orders': [695 {'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'},696 ],697 'journal_entries_before_closing': {698 '00100-010-0001': {699 'invoice': {700 'line_ids': [701 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False, 'amount_residual': 0},702 # needs to check the residual because it's supposed to be partial reconciled703 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False, 'amount_residual': 50},704 ]705 },706 'payments': [707 ((self.bank_split_pm1, 50), {708 'line_ids': [709 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},710 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},711 ]712 }),713 ],714 }715 },716 'journal_entries_after_closing': {717 'session_journal_entry': {718 'line_ids': [719 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},720 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},721 ],722 },723 'cash_statement': [],724 'bank_payments': [725 ((50, ), {726 'line_ids': [727 {'account_id': self.bank_split_pm1.outstanding_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},728 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},729 ]730 })731 ],732 },733 })734 def test_21b(self):735 self._run_test({736 'payment_methods': self.cash_split_pm1 | self.pay_later_pm,737 'orders': [738 {'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'},739 ],740 'journal_entries_before_closing': {741 '00100-010-0001': {742 'invoice': {743 'line_ids': [744 {'account_id': self.sales_account.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 100, 'reconciled': False, 'amount_residual': 0},745 # needs to check the residual because it's supposed to be partial reconciled746 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 100, 'credit': 0, 'reconciled': False, 'amount_residual': 50},747 ]748 },749 'payments': [750 ((self.cash_split_pm1, 50), {751 'line_ids': [752 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},753 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 50, 'credit': 0, 'reconciled': False},754 ]755 }),756 ],757 }758 },759 'journal_entries_after_closing': {760 'session_journal_entry': {761 'line_ids': [762 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': True},763 {'account_id': self.pos_receivable_account.id, 'partner_id': False, 'debit': 0, 'credit': 50, 'reconciled': True},764 ],765 },766 'cash_statement': [767 ((50, ), {768 'line_ids': [769 {'account_id': self.cash_split_pm1.journal_id.default_account_id.id, 'partner_id': self.customer.id, 'debit': 50, 'credit': 0, 'reconciled': False},770 {'account_id': self.c1_receivable.id, 'partner_id': self.customer.id, 'debit': 0, 'credit': 50, 'reconciled': True},771 ]772 })773 ],774 'bank_payments': [],775 },...
test_pos_simple_orders.py
Source:test_pos_simple_orders.py
1# -*- coding: utf-8 -*-2# Part of Odoo. See LICENSE file for full copyright and licensing details.3import odoo4from odoo.addons.point_of_sale.tests.common import TestPoSCommon5@odoo.tests.tagged('post_install', '-at_install')6class 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=sharing10 """11 def setUp(self):12 super(TestPosSimpleOrders, self).setUp()13 self.config = self.basic_config14 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 },...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!