From daf6db970d62103510125cceea40cfbce70929ca Mon Sep 17 00:00:00 2001 From: Robin Heinz Date: Tue, 30 Jul 2019 08:27:58 +0000 Subject: [PATCH] [IMP] point_of_sale: cash closing difference visible When a pos session is closed, the difference and transactions of cash control are not good anymore, because it is based on the statement linked to the cash payment method, and it is modified during the validation of the session to create a balanced account move. So we are now storing the values in fields, to keep history of the closing control closes odoo/odoo#35286 Task-id: 2032173 Signed-off-by: pimodoo --- addons/point_of_sale/models/pos_session.py | 8 +++++++- .../point_of_sale/views/pos_session_view.xml | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 64d50ef236b..7b8bc3b1c6e 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -77,9 +77,12 @@ class PosSession(models.Model): readonly=True) cash_register_difference = fields.Monetary( compute='_compute_cash_balance', - string='Difference', + string='Before Closing Difference', help="Difference between the theoretical closing balance and the real closing balance.", readonly=True) + cash_real_difference = fields.Monetary(string='Difference', readonly=True) + cash_real_transaction = fields.Monetary(string='Transaction', readonly=True) + cash_real_expected = fields.Monetary(string="Expected", readonly=True) order_ids = fields.One2many('pos.order', 'session_id', string='Orders') order_count = fields.Integer(compute='_compute_order_count') @@ -289,6 +292,9 @@ class PosSession(models.Model): def _validate_session(self): self.ensure_one() + self.cash_real_transaction = self.cash_register_total_entry_encoding + self.cash_real_expected = self.cash_register_balance_end + self.cash_real_difference = self.cash_register_difference self._check_if_no_draft_orders() if self.update_stock_at_closing: self._create_picking_at_end_of_session() diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml index c673449663a..a0f90d1439e 100644 --- a/addons/point_of_sale/views/pos_session_view.xml +++ b/addons/point_of_sale/views/pos_session_view.xml @@ -77,12 +77,18 @@ - + - + + + + + + + @@ -97,17 +103,22 @@ - + -
+
+
+ + + +