[16.0][IMP] shopfloor_reception*: allow over receiving#1090
[16.0][IMP] shopfloor_reception*: allow over receiving#1090nicolas-delbovier-acsone wants to merge 2 commits intoOCA:16.0from
Conversation
|
Hi @simahawk, @JuMiSanAr, @guewen, @mmequignon, @sebalix, |
8e064b8 to
462d83d
Compare
| if compare == 1 and not is_over_reception_confirmed: | ||
| line.write(previous_vals) | ||
| message = self._response_for_confirm_over_reception( | ||
| picking, | ||
| line, | ||
| quantity, | ||
| action, | ||
| message=self.msg_store.line_scanned_qty_done_higher_than_allowed(), |
There was a problem hiding this comment.
avoid the useless write,
if compare == 1:
return self._response_for_confirm_over_reception()
line.qty_done = quantityThere was a problem hiding this comment.
This write is not useless, this is used to rollback the value before user confirms.
I need to do this because the function _set_quantity__check_quantity_done is checking all the qty_done on the move so I need to update the move before this check but then I need to rollback before user confirms. I agree this is not beautiful since, in the case of a user confirming, we will have a useless double write. However, I suspect this is necessary to follow this pattern to avoid problems in the case of many workers working on the same move.
I copied this pattern from the function _set_quantity__by_product
shopfloor/actions/message.py
Outdated
| # def over_reception_ask_confirm(self): | ||
| # return { | ||
| # "message_type": "warning", | ||
| # "body": _( | ||
| # "You confirmed you wanted to receive more goods " | ||
| # "than expected. Click again to continue." | ||
| # ), | ||
| # } | ||
|
|
There was a problem hiding this comment.
| # def over_reception_ask_confirm(self): | |
| # return { | |
| # "message_type": "warning", | |
| # "body": _( | |
| # "You confirmed you wanted to receive more goods " | |
| # "than expected. Click again to continue." | |
| # ), | |
| # } |
shopfloor/actions/message.py
Outdated
| "message_type": "warning", | ||
| "body": _( | ||
| "Confirm location change from %(location_from)s to " "%(location_to)s?" | ||
| "Confirm location change from %(location_from)s to %(location_to)s?" |
| } | ||
| if (this.qty > this.qtyTodo) { | ||
| return "background-color: orangered"; | ||
| return "background-color: rgb(229, 171, 0)"; |
There was a problem hiding this comment.
The idea was to make the color a "warning" color instead of a "danger" one since now it is possible to over-receive. Thus, it is no more an error.
| """ | ||
|
|
||
| def _set_quantity__process__set_qty_and_split( | ||
| self, picking, line, quantity, action, is_over_reception_confirmed=False |
There was a problem hiding this comment.
| self, picking, line, quantity, action, is_over_reception_confirmed=False | |
| self, picking, line, quantity, action=None, is_over_reception_confirmed=False |
7ffe855 to
6704bf5
Compare
| return response | ||
| compare = self._set_quantity__check_quantity_done(selected_line) | ||
| compare = self._set_quantity__check_quantity_done( | ||
| selected_line, selected_line.qty_done |
There was a problem hiding this comment.
| selected_line, selected_line.qty_done | |
| selected_line, sum(move.move_line_ids.mapped("qty_done")) |
simahawk
left a comment
There was a problem hiding this comment.
Can we have separated commits per module? The rest can be squashed.
| @@ -1,7 +1,3 @@ | |||
| .. image:: https://odoo-community.org/readme-banner-image | |||
There was a problem hiding this comment.
Could you please rollback these README changes?
TIP: run export SKIP=oca-gen-addon-readme to avoid updating readme files on each commit ;)
| savepoint.rollback() | ||
| return self._response_for_set_quantity( | ||
| picking, line, message=self.msg_store.unable_to_pick_qty() | ||
| def _after_over_recepetion_confirmed_hook(self, picking, line): |
There was a problem hiding this comment.
| def _after_over_recepetion_confirmed_hook(self, picking, line): | |
| def _after_over_reception_confirmed_hook(self, picking, line): |
| "process_with_new_pack", | ||
| is_over_reception_confirmed, |
There was a problem hiding this comment.
| "process_with_new_pack", | |
| is_over_reception_confirmed, | |
| action="process_with_new_pack", | |
| is_over_reception_confirmed=is_over_reception_confirmed, |
I'm not a fan of "hiding" kw args w/ positional args just because python allows to do so :)
| <div class="button-list button-vertical-list full"> | ||
| <v-row align="center"> | ||
| <v-col class="text-center" cols="12"> | ||
| <div>{{ state.display_info.message }}</div> |
There was a problem hiding this comment.
display_info messages are normally visible on the top of the page automatically. Is this really needed?
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
9155440 to
3b31d93
Compare
|
can you rebase please |
3b31d93 to
fde4d5a
Compare
This PR adds the possibility to receive more goods than ordered (in case of an error from the supplier for example)