From 52d68984459210cc1a1da039707eb47ae937da07 Mon Sep 17 00:00:00 2001 From: jev-odoo Date: Wed, 31 Jul 2019 14:36:36 +0000 Subject: [PATCH] [FIX]point_of_sale: adapt _create_account_move_line for inheritance This commit intend to allow better inheritance in the account_move_line_creation_process The new _prepare_account_move_and_lines method only prepare the move and the lines but does not write and post them. This is done by the former _create_account_move_line method. Needed to fix pos_sessions with unbalanced journal entries caused by round globally option with taxes included in price I.E. opw-2038814 closes odoo/odoo#35351 Signed-off-by: Lucas Perais (lpe) --- addons/point_of_sale/models/pos_order.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 29f4de05dd4..451a33ef0f4 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -239,7 +239,7 @@ class PosOrder(models.Model): inv_line.update(price_unit=line.price_unit, discount=line.discount) return InvoiceLine.sudo().create(inv_line) - def _create_account_move_line(self, session=None, move=None): + def _prepare_account_move_and_lines(self, session=None, move=None): def _flatten_tax_and_children(taxes, group_done=None): children = self.env['account.tax'] if group_done is None: @@ -461,6 +461,17 @@ class PosOrder(models.Model): if self and order.company_id.anglo_saxon_accounting: add_anglosaxon_lines(grouped_data) + return { + 'grouped_data': grouped_data, + 'move': move, + } + + def _create_account_move_line(self, session=None, move=None): + vals = self._prepare_account_move_and_lines(session, move) + + grouped_data = vals['grouped_data'] + move = vals['move'] + all_lines = [] for group_key, group_data in grouped_data.items(): for value in group_data: