TIP: You can type at any time to perform a new search.
Sale Promotion Rule
sale_promotion_rule · OCA/sale-workflow
- Repository
- OCA/sale-workflow · module folder · Try on Runboat
- Module version
- 1.0.0
- Category
- Sale
- Folder size
- 0.32 MB
- License
- AGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://github.com/OCA/sale-workflow
- Last tracking update
- 2026-08-07 08:22:55
- Authors
- Akretion, ACSONE SA/NV, Odoo Community Association (OCA)
- Maintainers
- Akretion, ACSONE SA/NV, Odoo Community Association (OCA)
- Committers
- Weblate, OCA-git-bot, oca-ci, JasminSForgeFlow
- Odoo dependencies
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
- Description
This module adds the concept of promotion rules that can be applied on the sale order. Two kinds of rules are implemented: - automatic - coupon Automatic rules are applied/recomputed automatically for a sale order when the user clicks on the button "Apply discount" in the view form. Depending on the rule's criteria more than one automatic rule can be applied to a same sale order. Coupon are special manual rules. Only one coupon can be applied to a sale order. This rule takes always precedence over automatic rules. 
Code Analysis ⓘ
Views touched (5)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
sale_order_add_coupon_form_view |
sale.order.add.coupon.form (in sale_promotion_rule) | sale.order.add.coupon | form | New |
view_order_form |
sale.order | form | Inherits sale.view_order_form | |
view_sale_order_applied_sale_promotion_rule_tree |
sale.promotion.rule | tree | New | |
view_sale_promotion_rule_form |
sale.promotion.rule | form | New | |
view_sale_promotion_rule_tree |
sale.promotion.rule | tree | New |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (4)
New fields (5)
-
applied_promotion_rule_idsMany2many → sale.promotion.rulecompute='_compute_applied_promotion_rule_ids'string='Applied Promotion rules' args: 'sale.promotion.rule' -
coupon_codeCharreadonly=Truerelated='coupon_promotion_rule_id.code'store=Truestring='Coupont Promotion Code' -
coupon_promotion_rule_idMany2one → sale.promotion.ruledomain=[('rule_type', '=', 'coupon')]index=Truereadonly=Truestring='Coupon promotion rule' args: 'sale.promotion.rule' -
has_promotion_rulesBooleancompute='_compute_has_promotion_rules' -
promotion_rule_idsMany2many → sale.promotion.ruledomain=[('rule_type', '!=', 'coupon')]index=Truereadonly=Truestring='Promotion rules' args: 'sale.promotion.rule'
-
add_coupon(self, coupon_code) -
apply_promotions(self) -
clear_promotions(self)
New fields (1)
-
nameCharrequired=Truestring='Coupon Name'
-
doit(self)
New fields (6)
-
applied_promotion_rule_idsMany2many → sale.promotion.rulecompute='_compute_applied_promotion_rule_ids'string='Applied Promotion rules' args: 'sale.promotion.rule' -
coupon_codeCharreadonly=Truerelated='coupon_promotion_rule_id.code'store=True -
coupon_promotion_rule_idMany2one → sale.promotion.ruledomain=[('rule_type', '=', 'coupon')]string='Coupon promotion rule' args: 'sale.promotion.rule' -
has_promotion_rulesBooleancompute='_compute_has_promotion_rules' -
is_promotion_lineBooleanhelp='True if the line has been added by a promotion rule' -
promotion_rule_idsMany2many → sale.promotion.ruledomain=[('rule_type', '!=', 'coupon')]string='Promotion rules' args: 'sale.promotion.rule'
No public methods.
New fields (19)
-
codeChar -
company_idMany2one → res.companycomodel_name='res.company'help='Define on which company this promotion rule is available (let it empty if available for every companies)'index=Truestring='Company' -
date_fromDate -
date_toDate -
discount_amountFloatdigits='Discount'required=True -
discount_amount_currency_idMany2one → res.currencydefault=<expr>string='Discount Amount Currency' args: 'res.currency' -
discount_product_idMany2one → product.productdomain=[('type', '=', 'service')]string='Product used to apply the promotion' args: 'product.product' -
discount_typeSelectiondefault='percentage'required=Trueselection=[('percentage', 'Percentage'), ('amount_tax_included', 'Amount (Taxes included)'), ('amount_tax_excluded', 'Amount (Taxes excluded)')] -
is_minimal_amount_tax_inclBooleandefault=Truerequired=True args: 'Tax included into minimal amount?' -
minimal_amountFloatdigits='Discount' -
multi_rule_strategySelectiondefault='use_best'selection=[('use_best', 'Use the best promotion'), ('cumulate', 'Cumulate promotion'), ('exclusive', 'Exclusive promotion'), ('keep_existing', 'Keep existing discount')] -
nameCharrequired=Truetranslate=True -
only_newsletterBoolean -
promo_typeSelectiondefault='discount'required=Trueselection=[('discount', 'Discount')] -
restrict_partner_idsMany2many → res.partnercolumn1='rule_id'column2='partner_id'comodel_name='res.partner'relation='discount_rule_partner_rel'string='Restricted partners' -
restrict_pricelist_idsMany2many → product.pricelistcolumn1='rule_id'column2='pricelist_id'comodel_name='product.pricelist'relation='discount_rule_pricelist_rel'string='Restricted pricelists' -
rule_typeSelectiondefault='coupon'required=Trueselection=[('coupon', 'Coupon'), ('auto', 'Automatic')] -
sequenceIntegerdefault=10 -
usage_restrictionSelectiondefault='no_restriction'required=Trueselection=[('one_per_partner', 'One per partner'), ('no_restriction', 'No restriction')]
-
apply_auto(self, orders)@api.modelApply automatic promotion rules to the orders -
apply_coupon(self, orders, coupon_code)Add a coupon to orders -
compute_promotions(self, orders)@api.modelCompute available promotions on the given orders. If a coupon is already defined on the orders, it's preserved -
name_get(self) -
remove_promotions(self, orders)@api.model
Loading…
Loading…
Loading…