This module allows to configure a formula (Python code to use in sales, pos). It's a technical base to be extended with top level functionality (see sale_loyalty_margin_computation).
auto_awesome What this module does
AI-generated from the code · Odoo 18.0Adds a Python formula field to loyalty rewards so a margin can be calculated from a reward. It is a technical building block meant to be extended by other modules.
This module extends the loyalty reward configuration in Odoo. On the loyalty reward form, a new section called "Margin's Formulas" appears where you can type a Python formula in a code editor.
- The formula is stored on the
loyalty.rewardmodel in the fieldsale_margin_formula. - When you save a reward, Odoo checks the formula for Python syntax errors and blocks saving with a clear error message if the code is invalid.
- The form shows a help box listing the variables available inside the formula:
env(the sale order line environment) andreward(the reward record), plus an example.
This module does not itself calculate or display any margin; it only provides the place to store the formula and validates it. The actual margin computation is expected to be added by an extension module. It touches the loyalty reward configuration screen and the loyalty.reward model.
Depends on
Models and fields (1)
- loyalty.reward · extends an existing modelsale_margin_formula
Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 1 confirmed, 8 with no information of 9 versions.
Sources · Odoo 18.0
Confirmed on 2026-11-03 in branch 18.0 of OCA/margin-analysis.
terminal Installation and usage
No verified informationInstallation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.