Skip to content

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Mar 15, 2025

There are currently 2 issues with the "Gaps in the sequence" warning on journals in the accounting dashboard.

(1)
Sequence check per company issue:
We query and thus do the the sequence check only on the moves of a single company. This e.g. fails though in the following case (all moves in the same journal)

move0: company_A
move1: company_B
move2: company_A

The query for company_A will find a gap between move0 and move2. But there is no gap (it just belongs to a different company).

(2)
Lockdate per company issue:
Consider the case that the child company is already locked but the parent is not.
E.g

move0: parent company
move1: child company (move is locked)
move2: parent company

We would find a gap for the parent company.

The "right" lock date to use for a journal is the lock date of the journal company:

  • A branch company is locked when the parent is locked.
  • Parent companies of the journal company can not add moves to the journal. So we will find all holes that can still be corrected.

After this commit we query per lock date (instead of per company). In each query we check all the journals restricted by the same lock date.

This solves both issues:
(1) is solved since query all moves independent of the company
(2) is not an issue since we use the "right" lock date (see reasoning above)

opw-4548453

Forward-Port-Of: #201931
Forward-Port-Of: #201732

@robodoo
Copy link
Contributor

robodoo commented Mar 15, 2025

Pull request status dashboard

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Mar 15, 2025
@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 15, 2025

@svfu-odoo @william-andre cherrypicking of pull request #201732 failed.

stdout:

Auto-merging addons/account/models/account_journal_dashboard.py
CONFLICT (content): Merge conflict in addons/account/models/account_journal_dashboard.py

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 15, 2025
@svfu-odoo svfu-odoo force-pushed the 18.0-17.0-bugfix_branch_sequence_gap-svfu-423186-fw branch from 308b19f to 9651932 Compare March 17, 2025 08:15
There are currently 2 issues with the "Gaps in the sequence" warning
on journals in the accounting dashboard.

(1)
Sequence check per company issue:
We query and thus do the the sequence check only on the moves of a single company.
This e.g. fails though in the following case (all moves in the same journal)
```
move0: company_A
move1: company_B
move2: company_A
```
The query for company_A will find a gap between move0 and move2.
But there is no gap (it just belongs to a different company).

(2)
Lockdate per company issue:
 Consider the case that the child company is already locked but the parent is not.
E.g
```
move0: parent company
move1: child company (move is locked)
move2: parent company
```
We would find a gap for the parent company.

The "right" lock date to use for a journal is the lock date of the
journal company:
  * A branch company is locked when the parent is locked.
  * Parent companies of the journal company can not add moves to the journal.
So we will find all holes that can still be corrected.

After this commit we query per lock date (instead of per company).
In each query we check all the journals restricted by the same lock date.
We include all the companies that can create moves in the queried journals
(All child companies of the journal company)

This solves both issues:
(1) is solved since we include all companies that can create moves in the queried journals
(2) is not an issue since we use the "right" lock date (see reasoning above)

opw-4548453

X-original-commit: af0864a
@svfu-odoo svfu-odoo force-pushed the 18.0-17.0-bugfix_branch_sequence_gap-svfu-423186-fw branch from 9651932 to e076163 Compare March 17, 2025 08:27
Copy link
Contributor

@william-andre william-andre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines -158 to -159
AND (journal.type <> 'sale' OR move.date > %(sale_lock_date)s)
AND (journal.type <> 'purchase' OR move.date > %(purchase_lock_date)s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that we're getting rid of this

@robodoo robodoo closed this in 4b3aad1 Mar 17, 2025
gamarino pushed a commit to numaes/numa-public-odoo that referenced this pull request Mar 17, 2025
There are currently 2 issues with the "Gaps in the sequence" warning
on journals in the accounting dashboard.

(1)
Sequence check per company issue:
We query and thus do the the sequence check only on the moves of a single company.
This e.g. fails though in the following case (all moves in the same journal)
```
move0: company_A
move1: company_B
move2: company_A
```
The query for company_A will find a gap between move0 and move2.
But there is no gap (it just belongs to a different company).

(2)
Lockdate per company issue:
 Consider the case that the child company is already locked but the parent is not.
E.g
```
move0: parent company
move1: child company (move is locked)
move2: parent company
```
We would find a gap for the parent company.

The "right" lock date to use for a journal is the lock date of the
journal company:
  * A branch company is locked when the parent is locked.
  * Parent companies of the journal company can not add moves to the journal.
So we will find all holes that can still be corrected.

After this commit we query per lock date (instead of per company).
In each query we check all the journals restricted by the same lock date.
We include all the companies that can create moves in the queried journals
(All child companies of the journal company)

This solves both issues:
(1) is solved since we include all companies that can create moves in the queried journals
(2) is not an issue since we use the "right" lock date (see reasoning above)

opw-4548453

closes odoo/odoo#201963

X-original-commit: af0864a3d40e9a5360da53e2195d8140f2ace103
Signed-off-by: William André (wan) <wan@odoo.com>
@fw-bot fw-bot deleted the 18.0-17.0-bugfix_branch_sequence_gap-svfu-423186-fw branch March 24, 2025 15:30
omar-sherif9992 pushed a commit to odoo-dev/odoo that referenced this pull request Mar 26, 2025
There are currently 2 issues with the "Gaps in the sequence" warning
on journals in the accounting dashboard.

(1)
Sequence check per company issue:
We query and thus do the the sequence check only on the moves of a single company.
This e.g. fails though in the following case (all moves in the same journal)
```
move0: company_A
move1: company_B
move2: company_A
```
The query for company_A will find a gap between move0 and move2.
But there is no gap (it just belongs to a different company).

(2)
Lockdate per company issue:
 Consider the case that the child company is already locked but the parent is not.
E.g
```
move0: parent company
move1: child company (move is locked)
move2: parent company
```
We would find a gap for the parent company.

The "right" lock date to use for a journal is the lock date of the
journal company:
  * A branch company is locked when the parent is locked.
  * Parent companies of the journal company can not add moves to the journal.
So we will find all holes that can still be corrected.

After this commit we query per lock date (instead of per company).
In each query we check all the journals restricted by the same lock date.
We include all the companies that can create moves in the queried journals
(All child companies of the journal company)

This solves both issues:
(1) is solved since we include all companies that can create moves in the queried journals
(2) is not an issue since we use the "right" lock date (see reasoning above)

opw-4548453

closes odoo#201963

X-original-commit: af0864a
Signed-off-by: William André (wan) <wan@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants