summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/tests
diff options
context:
space:
mode:
authorJoseph Caburnay <jcb@odoo.com>2020-03-30 08:06:24 +0000
committerJoseph Caburnay <jcb@odoo.com>2020-03-30 10:03:31 +0000
commit0de552c7c50d9c6cc90e7d95724fb87aca1ce455 (patch)
tree3b03b831ffcb750fa80b925f1060b98863c2c928 /addons/point_of_sale/tests
parente711dc08d462fdc635b1f803b792e52c2fb9b545 (diff)
[FIX] point_of_sale: closing session with zero-valued invoice
The problem is described in https://github.com/odoo/odoo/issues/48550. This is caused by reconciled receivable line in the invoice being reconciled with another reconciled receivable line in pos_session's move_id. The lines are already reconciled because their balance is zero. So to avoid trying to reconcile those reconciled lines, we do not include them in the list of lines to be reconciled. closes odoo/odoo#48587 X-original-commit: f24677098bec9b96108a901dde08bf75dc7d4c5f Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/tests')
-rw-r--r--addons/point_of_sale/tests/test_pos_basic_config.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/point_of_sale/tests/test_pos_basic_config.py b/addons/point_of_sale/tests/test_pos_basic_config.py
index 77365383caf..119d4c396ba 100644
--- a/addons/point_of_sale/tests/test_pos_basic_config.py
+++ b/addons/point_of_sale/tests/test_pos_basic_config.py
@@ -18,6 +18,7 @@ class TestPoSBasicConfig(TestPoSCommon):
def setUp(self):
super(TestPoSBasicConfig, self).setUp()
self.config = self.basic_config
+ self.product0 = self.create_product('Product 0', self.categ_basic, 0.0, 0.0)
self.product1 = self.create_product('Product 1', self.categ_basic, 10.0, 5)
self.product2 = self.create_product('Product 2', self.categ_basic, 20.0, 10)
self.product3 = self.create_product('Product 3', self.categ_basic, 30.0, 15)
@@ -278,6 +279,21 @@ class TestPoSBasicConfig(TestPoSCommon):
# matching number of the receivable lines should be the same
self.assertEqual(receivable_line.full_reconcile_id, invoice_receivable_line.full_reconcile_id)
+ def test_orders_with_zero_valued_invoiced(self):
+ """One invoiced order but with zero receivable line balance."""
+
+ self.open_new_session()
+ orders = [self.create_ui_order_data([(self.product0, 1)], payments=[(self.bank_pm, 0)], customer=self.customer, is_invoiced=True)]
+ self.env['pos.order'].create_from_ui(orders)
+ self.pos_session.action_pos_session_validate()
+
+ invoice = self.pos_session.order_ids.account_move
+ invoice_receivable_line = invoice.line_ids.filtered(lambda line: line.account_id == self.receivable_account)
+ receivable_line = self.pos_session.move_id.line_ids.filtered(lambda line: line.account_id == self.receivable_account)
+
+ self.assertTrue(invoice_receivable_line.reconciled)
+ self.assertTrue(receivable_line.reconciled)
+
def test_return_order(self):
""" Test return order