| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Sales (sale_management) • Invoicing (account) |
| Lines of code | 616 |
| Technical Name |
cm_sa_margin_guard |
| License | OPL-1 |
| Website | https://cm.sa |
| Versions | 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Sales (sale_management) • Invoicing (account) |
| Lines of code | 616 |
| Technical Name |
cm_sa_margin_guard |
| License | OPL-1 |
| Website | https://cm.sa |
| Versions | 17.0 18.0 19.0 |

SO Margin Guard
Stop a sale order from confirming below the margin you set.
Sales reps chase quota by giving away margin, and sales managers only find out at month-end when the variance is already booked. Odoo shows margin on the form but never blocks the confirmation. Margin Guard wraps SO confirmation: if gross margin falls below your threshold, only members of the override group can confirm, and they have to type a reason first. Every override is logged.
SO Margin Guard
Block sale-order confirmation when gross margin falls below a configurable threshold, with a per-group override and reason log.
What it does
Sales managers want a guardrail: "no salesperson confirms an order below 10% margin without explicit sign-off". Native Odoo shows margin on the form but does not block confirmation, and the paid margin-alert modules on apps.odoo.com all bake in a single threshold for a single model.
Core provides no per-model configuration, no Python-expression formula, and no reason-logging override group, so margin policy stays a Slack rule.
What this module adds:
- Rule engine: pick any model (
sale.order, a custom quotation or contract model) and any method (action_confirm, a custom button). - Margin formula as a Python expression against the record, default
(record.amount_untaxed - record.margin_cost) / record.amount_untaxed * 100forsale.order. - Threshold percentage per rule.
- Override group: only members can confirm below-threshold orders, and they are prompted for a reason first.
- Every override logged to
cm_sa.margin.override.logwith user, record, threshold, computed margin, reason, and timestamp. - Pivot view by user times month ships out of the box.
Who benefits
Sales managers, CFOs, and revenue operations teams at SMB and mid-market companies who want margin discipline without a heavy approval workflow.
How it works
_register_hook wrapper at registry load, no core-model inheritance. TransactionCase tested on Odoo 17, 18, and 19. Safe to install, safe to uninstall. Pairs naturally with cm_sa_so_confirm_guard (required fields at confirm) and cm_sa_reset_auditor (reason on reset-to-draft).
What the module looks like
Real screenshots from a live Odoo 19 install. Every view is standard Odoo chrome, no bespoke widgets to learn.
Common questions
Does it inherit or patch core Odoo models?
_register_hook to wrap the target method at registry load, and the wrapper unwinds cleanly at uninstall. No schema changes to core tables, no monkey-patches, no Studio surgery.Does it work on Odoo Community, or only Enterprise?
Can I uninstall it cleanly if it does not fit?
What support do I get after buying?
Can Cube Master customise it for my company?
Beyond this module, Cube Master also builds:
We are a full technology house. The Odoo utility you are reading about is one part of what we ship. If your back office, website, or app team needs more, we have the team for it.
More from the Cube Master catalogue
We ship 33 single-feature utilities at the same price point. If this one solved a pain for you, the others probably will too.
About Cube Master
We blend mastery with creativity - نمزج الإتقان بالإبداع
Cube Master is a Saudi technology house based in Al-Mubarraz. We design, build, and run business systems for customers across the Gulf and beyond: end-to-end Odoo ERP rollouts, custom AI workflows, corporate websites, and mobile apps. Strategic technology partners with Microsoft, AWS, Odoo, and Umbraco.
The Odoo utility you are reading about is one small piece of what we ship. If you need any of the above for your company, talk to us.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module