-
Notifications
You must be signed in to change notification settings - Fork 30.4k
[FW][FIX] {purchase_,}stock: recompute orderpoints on SM's date change #94300
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
Closed
fw-bot
wants to merge
1
commit into
odoo:saas-15.2
from
odoo-dev:saas-15.2-14.0-OPW-2868167-purchase_stock_date_and_replenishment-awt-Amfh-fw
Closed
[FW][FIX] {purchase_,}stock: recompute orderpoints on SM's date change #94300
fw-bot
wants to merge
1
commit into
odoo:saas-15.2
from
odoo-dev:saas-15.2-14.0-OPW-2868167-purchase_stock_date_and_replenishment-awt-Amfh-fw
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Contributor
Author
|
Ping @adwid, @Whenrow cherrypicking of pull request #93889 failed. stderr: 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. |
Updating the scheduled date of a delivery doesn't update the quantity to
order of an orderpoint
To reproduce the issue:
(Need purchase)
1. Create a storable product P with a seller
2. Create and confirm a planned delivery D with 1 x P
3. Open the replenishment page
- There should be a line for P (Forecast: -1, To Order: 1)
4. Edit D and postpone the scheduled date
5. Go back to replenishment page
Error: The line is still present, its forecast qty is correct (0) but
the quantity to order is still 1 (instead of 0)
`qty_to_order` is a stored field, so when loading the replenishment
page, its compute method is not called. Moreover, even though
`qty_to_order` depends on `qty_forecast` and the compute method of
`qty_forecast` is called, it still won't trigger the compute:
when setting the value of `qty_forecast` from its compute method, it
will lead to:
https://github.com/odoo/odoo/blob/b54f78de307543efcea934206806f361eaac811a/odoo/fields.py#L1106-L1109
So, as shown and explained, we bypass the `write` of `BaseModel` and
skip the business logic and the recomputations
The compute of `qty_to_order` should actually be triggered earlier: when
we edit the scheduled date (step 4). That's the reason why this commit
adds a dependency to the compute of `qty_forecast`: it makes more sense
and becomes an implicit dependency of `qty_to_order` -> update the
scheduled date will trigger the compute of `qty_to_order`
OPW-2868167
X-original-commit: 1262120
b1599f1 to
4208597
Compare
Contributor
|
robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
Jun 22, 2022
Updating the scheduled date of a delivery doesn't update the quantity to
order of an orderpoint
To reproduce the issue:
(Need purchase)
1. Create a storable product P with a seller
2. Create and confirm a planned delivery D with 1 x P
3. Open the replenishment page
- There should be a line for P (Forecast: -1, To Order: 1)
4. Edit D and postpone the scheduled date
5. Go back to replenishment page
Error: The line is still present, its forecast qty is correct (0) but
the quantity to order is still 1 (instead of 0)
`qty_to_order` is a stored field, so when loading the replenishment
page, its compute method is not called. Moreover, even though
`qty_to_order` depends on `qty_forecast` and the compute method of
`qty_forecast` is called, it still won't trigger the compute:
when setting the value of `qty_forecast` from its compute method, it
will lead to:
https://github.com/odoo/odoo/blob/b54f78de307543efcea934206806f361eaac811a/odoo/fields.py#L1106-L1109
So, as shown and explained, we bypass the `write` of `BaseModel` and
skip the business logic and the recomputations
The compute of `qty_to_order` should actually be triggered earlier: when
we edit the scheduled date (step 4). That's the reason why this commit
adds a dependency to the compute of `qty_forecast`: it makes more sense
and becomes an implicit dependency of `qty_to_order` -> update the
scheduled date will trigger the compute of `qty_to_order`
OPW-2868167
closes #94300
X-original-commit: 1262120
Signed-off-by: William Henrotin (whe) <[email protected]>
Signed-off-by: Adrien Widart <[email protected]>
This was referenced Jun 22, 2022
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-...)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Updating the scheduled date of a delivery doesn't update the quantity to
order of an orderpoint
To reproduce the issue:
(Need purchase)
Error: The line is still present, its forecast qty is correct (0) but
the quantity to order is still 1 (instead of 0)
qty_to_orderis a stored field, so when loading the replenishmentpage, its compute method is not called. Moreover, even though
qty_to_orderdepends onqty_forecastand the compute method ofqty_forecastis called, it still won't trigger the compute:when setting the value of
qty_forecastfrom its compute method, itwill lead to:
odoo/odoo/fields.py
Lines 1106 to 1109 in b54f78d
So, as shown and explained, we bypass the
writeofBaseModelandskip the business logic and the recomputations
The compute of
qty_to_ordershould actually be triggered earlier: whenwe edit the scheduled date (step 4). That's the reason why this commit
adds a dependency to the compute of
qty_forecast: it makes more senseand becomes an implicit dependency of
qty_to_order-> update thescheduled date will trigger the compute of
qty_to_orderOPW-2868167
Forward-Port-Of: #94196
Forward-Port-Of: #93889