[18.0][FIX] project_task_stock: Set picked = True for pending moves - #1787
[18.0][FIX] project_task_stock: Set picked = True for pending moves#1787victoralmau wants to merge 1 commit into
Conversation
pedrobaeza
left a comment
There was a problem hiding this comment.
Shouldn't be all put to picked=True instead if they are going to be validated?
I decided to leave False as is and let the validation process handle it accordingly (set it to True); besides, it's a compute. But if you'd prefer, I can change it. |
|
It's a compute with an inverse, and what makes it is to set that value for the |
bb1072d to
947bb5b
Compare
You must set picked = True for pending moves to prevent the picking process from failing if there are moves with both picked = True and picked = False Example use case: - Add a line item for Product A, for which demand exceeds current stock - Click the "Check Material Availability" button - Click "Transfer Materials" - Add more stock of Product A to meet demand - Add a line item for Product B - Click the "Check Material Availability" button - Click "Transfer Materials" - All line items will be completed TT64069
947bb5b to
f9d3523
Compare
carlos-lopez-tecnativa
left a comment
There was a problem hiding this comment.
I tested it by following the steps, but it doesn't work as expected for me. The moves are not validated.
Could you please check this record: http://oca-project-18-0-pr1787-f9d3523de1c5.runboat.odoo-community.org/odoo/project/6/tasks/55, or let me know if I'm missing something?
I think you need to handle the response from button_validate when it needs to ask for a backorder, or call _action_done directly instead of button_validate.

We don't want to create backorders. If there isn't enough stock for what you're requesting, you'll need to increase the stock for that product in order to complete the transfer, cancel that line ( |
There are too many steps for the user, and this limitation is not mentioned in the If you call |
|
Additionally, when you create the task directly from the form view and add the moves, you cannot save it because the locations and operation types are not set. You need to save the task first before you can edit the moves. Could you please check this as well? project_task_stock.mp4 |
It doesn't currently behave that way, and users who follow these steps do NOT expect it to behave that way (in my opinion): creating extra lines to account for the difference will just make things more confusing. |
…not been created Related to OCA#1787 (comment)
|
For clarification, |
The issue regarding #1787 (review) was explained at #1787 (comment) (you should not create a backorder). The issue regarding #1787 (comment) was fixed at #1789 |
|
But please clarify me one thing: right now, if you have at hand 2 units of a product, and you put to consume 3 in a task, when doing the transfer, the stock at hand becomes -1, isn't it? |
If there isn't enough stock, the move will not be done; therefore, you'll need to increase the stock to 3 or change the line item to 2 in order to complete it. |
|
But is there any message saying that there isn't enough stock to fulfill the requirements? |
No, there is currently no message about this, nor is the line displayed differently; in any case, this could be addressed in another PR. |
|
Then you click on the button... and nothing happens? |
Without this PR:
Regardless of that, if there is a line item that does not have sufficient stock, a feature should be implemented in another PR to indicate this (a warning at the top, for example). |
carlos-lopez-tecnativa
left a comment
There was a problem hiding this comment.
If you plan to improve this in another PR, that's OK; I won't block this PR on it.
Please take two things into account:
Once the stock.move is confirmed, you cannot edit the quantities. For example, if I have 2 units available in stock and set the required quantity to 3, I cannot change it back to 2. This means there are too many steps for the user: they have to cancel the line and create a new one.
My suggestion is not to create backorders. If 3 units are requested but only 2 are available, instead of calling button_validate(), which returns an action in the backend to display the backorder wizard, I suggest calling _action_done() directly. The backorder wizard is not displayed in this flow.
Alternatively, if you handle this in another way where the user is informed that the moves cannot be validated because there is not enough stock, please take the first comment into account and make it easy for the user to edit the quantity.
Regarding these changes, LGTM.
|
This PR has the |
Set picked = True for pending moves
You must set picked = True for pending moves to prevent the picking process from failing if there are moves with both picked = True and picked = False
Example use case:
Please @pedrobaeza and @carlos-lopez-tecnativa can you review it?
@Tecnativa TT64069