Thomas Lefebvre (thle) 16219df38e [FIX] account: overwrite journal accounts of a payment
Steps to reproduce:
	- create two journals, A and B, which have the default accounts defined in the payment method manual in "outstanding receipts accounts".
    - create a payment with a journal A;
    - duplicate the draft of the payment (because it is not possible to change a journal if it was posted before);
    - select the journal B and save (or confirm)
    - The journal is changed, but the default journal B accounts are not applied.

Issue:
   Despite the payment is in draft and has not been posted before, move_line accounts do not change with the journal selected for the move.

Cause:
   When a payment is duplicate, records are save in the database.
   Modify the journal en then save will trigger the write method of the payment model (and not the create).
   During this method, we begin to find the move lines which correspond to liquidity, counterpart and writeoff lines.
   Unfortunately, the line corresponding to the old journal will be detected as a writeoff and not as a liquidity line (because the journal has changed).
   This fault will cause a balance error in the rest of the procedure.

Solution:
	Take into account the case where writeoffs are detected when there is no liquidity line (and no counterpart line).
	In this case, force the no writeoff line.
	Generate the correct ORM commands taking in consideration if the line exist (1: update) or not (0: create).

opw-2998031

closes odoo/odoo#103496

X-original-commit: cf277b2685a72e0a8ca44c4a59331136a722fbed
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2022-10-19 13:11:50 +02:00
2022-10-06 14:56:52 +02:00
2022-10-14 17:32:40 +02:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%