[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) <lpe@odoo.com>
This commit is contained in:
jev-odoo
2019-08-02 12:02:02 +00:00
parent 6d9dabd5d9
commit 52d6898445
+12 -1
View File
@@ -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: