[ADD] sale_order_zero_stock_blockage: add manager approval on insufficient stock #1050
+137
−0
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.

Currently, a sales user can confirm a Quotation even if it contains no
products or if the products have insufficient stock compared to the
order quantity. This leads to the creation of invalid Sales Orders,
which negatively impacts inventory planning and invoicing.
This module introduces a validation to the Sales Order confirmation
process to prevent these issues.
The following checks are added:
To bypass the insufficient stock restriction, a user with the 'Sales Manager'
group must enable the new 'Approval' (zero_stock_approval) field on the
order.
Technical details:
sale.order: Addedzero_stock_approvalBoolean field.fields_get: Overridden to setzero_stock_approvalasreadonly for users who are not in the
sales_team.group_sale_managergroup.action_confirm: Added logic to raise aUserErrorif:qty_availableis less thanproduct_uom_qty(forgoods) and the
zero_stock_approvalis not enabled.Task-5382939