[ADD] sale_zero_stock_approval: add zero stock approval control on sale orders#1275
Draft
aykhu-odoo wants to merge 1 commit into
Draft
[ADD] sale_zero_stock_approval: add zero stock approval control on sale orders#1275aykhu-odoo wants to merge 1 commit into
aykhu-odoo wants to merge 1 commit into
Conversation
e8caa4a to
c251395
Compare
…le orders In standard behavior, sales users can confirm orders even when there is not enough available stock, which may lead to unintended commitments, stock issues, or reliance on manual validation processes. This change introduces a *Zero Stock Approval* mechanism to enforce better control over such scenarios. A boolean field is added on the sale order to explicitly allow confirmation when stock is insufficient. For regular sales users, this field acts as a required approval flag: they cannot confirm the order unless it is enabled. To maintain flexibility and align with existing access rights, sales managers are not restricted by this rule and can confirm orders regardless of stock availability or field value. The field is read-only for regular users to prevent unauthorized changes, while administrators can manage it as needed. The confirmation logic is extended to validate stock availability per order line and block confirmation when the conditions are not met. This ensures that zero-stock sales are intentional, traceable, and aligned with business approval workflows.
c251395 to
f9ee2ae
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

By default, sales users can confirm orders even when there is not enough available stock. While this provides flexibility, it can also lead to unintended commitments, stock inconsistencies, and reliance on manual validation.
This PR introduces a Zero Stock Approval mechanism to bring better control and accountability to such scenarios.
⚙️ Key Changes
Add a boolean field (zero_stock_approval) on sale orders
Restrict sales users from confirming orders with insufficient stock unless approval is granted
Allow sales managers to bypass this restriction
Make the field read-only for regular users and manageable by administrators
Extend confirmation logic to validate stock availability per order line
✅ Result
Controlled confirmation of zero-stock orders
Reduced risk of stock-related issues
Clear approval flow aligned with business rules
Improved reliability and traceability in sales operations