-
Notifications
You must be signed in to change notification settings - Fork 30k
[FW][FIX] account: fix gap in sequence warning for branches #201963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FW][FIX] account: fix gap in sequence warning for branches #201963
Conversation
@svfu-odoo @william-andre cherrypicking of pull request #201732 failed. stdout:
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. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
308b19f
to
9651932
Compare
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
9651932
to
e076163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robodoo r+
AND (journal.type <> 'sale' OR move.date > %(sale_lock_date)s) | ||
AND (journal.type <> 'purchase' OR move.date > %(purchase_lock_date)s) |
There was a problem hiding this comment.
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
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>
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>
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)
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
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:
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