-
-
Notifications
You must be signed in to change notification settings - Fork 217
[IMP] shopfloor: Allow to partially reserve in location_content_transfer #1225
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
base: 16.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import json | ||
| import logging | ||
|
|
||
| from odoo import SUPERUSER_ID, api | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def migrate(cr, version): | ||
| if not version: | ||
| return | ||
| env = api.Environment(cr, SUPERUSER_ID, {}) | ||
| location_content_transfer = env.ref("shopfloor.scenario_location_content_transfer") | ||
| _update_scenario_options(location_content_transfer) | ||
|
|
||
|
|
||
| def _update_scenario_options(scenario): | ||
| options = scenario.options | ||
| options["allow_reserve_only_available"] = True | ||
| options_edit = json.dumps(options or {}, indent=4, sort_keys=True) | ||
| scenario.write({"options_edit": options_edit}) | ||
| _logger.info( | ||
| "Option 'allow_reserve_only_available' added to scenario %s", | ||
| scenario.name, | ||
| ) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -81,6 +81,13 @@ class ShopfloorMenu(models.Model): | |||||||||
| help="If you tick this box, this scenario will allow operator to move" | ||||||||||
| " goods even if a reservation is made by a different operation type.", | ||||||||||
| ) | ||||||||||
| reserve_only_available_is_possible = fields.Boolean( | ||||||||||
| compute="_compute_reserve_only_available_is_possible" | ||||||||||
| ) | ||||||||||
| allow_reserve_only_available = fields.Boolean( | ||||||||||
| string="Allow to reserve only available quantities on source location", | ||||||||||
|
Comment on lines
+87
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with location content transfer we want to move the goods, is "reserve" the right word here? Suggestion:
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, this is for quant quantities reservations, the 'move' is the next step :-) |
||||||||||
| help="Check this if you want the scenario to reserve only available quantities", | ||||||||||
| ) | ||||||||||
| ignore_no_putaway_available_is_possible = fields.Boolean( | ||||||||||
| compute="_compute_ignore_no_putaway_available_is_possible" | ||||||||||
| ) | ||||||||||
|
|
@@ -337,6 +344,13 @@ def _check_options(self): | |||||||||
| ) | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| @api.depends("scenario_id", "picking_type_ids") | ||||||||||
| def _compute_reserve_only_available_is_possible(self): | ||||||||||
| for menu in self: | ||||||||||
| menu.reserve_only_available_is_possible = bool( | ||||||||||
| menu.scenario_id.has_option("allow_reserve_only_available") | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| @api.depends("scenario_id", "picking_type_ids") | ||||||||||
| def _compute_move_create_is_possible(self): | ||||||||||
| for menu in self: | ||||||||||
|
|
||||||||||
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.
I would avoid the exclamation mark in messages returned to the user?
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.
Yes, less pressure but we know they don't read them at all 😃