[FIX] point_of_sale: skip synchronize journal entries in PoS

The problem happens when the company is Angelo Saxon, and
`l10n_eg_edi_eta` is installed. Also, the product should have a cost and
automatic inventory valuation.
https://github.com/odoo/odoo/commit/4b430f8e30efb15f06982e4673cd73531a2119b3
The problem is that with this commit, after calling the
`_set_next_sequence` function, it calls `flush_recordset`. It would cause
a write to be triggered and add an Automatic Balancing Line. While in
`_create_account_move` of PoS the stock output line will add later to it,
and make it unbalanced. The first Automatic Balancing Line is incorrect as
it will call `_create_stock_output_lines` later and it adds a line which
makes it balance. But with that Automatic Balancing Line as it's
unbalanced at the end it will call `_close_session_action` in PoS and
shows a pop-up to add another line to make it balance.

The solution is skip synchronize of journal entries.

opw-3137723

closes odoo/odoo#112238

X-original-commit: 890b685e94383491579258093f934b7143612b80
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
pedrambiria
2023-02-09 08:46:51 +01:00
parent 014590a005
commit eb72686c8f
+2 -2
View File
@@ -294,10 +294,10 @@ class PosSession(models.Model):
self._create_picking_at_end_of_session()
self.order_ids.filtered(lambda o: not o.is_total_cost_computed)._compute_total_cost_at_session_closing(self.picking_ids.move_ids)
try:
data = self.with_company(self.company_id)._create_account_move(balancing_account, amount_to_balance, bank_payment_method_diffs)
data = self.with_company(self.company_id).with_context(check_move_validity=False, skip_invoice_sync=True)._create_account_move(balancing_account, amount_to_balance, bank_payment_method_diffs)
except AccessError as e:
if sudo:
data = self.sudo().with_company(self.company_id)._create_account_move(balancing_account, amount_to_balance, bank_payment_method_diffs)
data = self.sudo().with_company(self.company_id).with_context(check_move_validity=False, skip_invoice_sync=True)._create_account_move(balancing_account, amount_to_balance, bank_payment_method_diffs)
else:
raise e