Sale Promotion Rule

sale_promotion_rule
REPOSITORY
REPOSITORYOCA/sale-workflow
GIT
GIThttps://github.com/OCA/sale-workflow.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/sale-workflow/tree/17.0/sale_promotion_rule
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYSale
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, JasminSForgeFlow
WEBSITE
WEBSITEhttps://github.com/OCA/sale-workflow
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:20:05
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - sale
    - sales_team
    - base
    - mail
    - base_setup
    - web
    - bus
    - web_tour
    - account_payment
    - account
    - onboarding
    - product
    - uom
    - analytic
    - portal
    - web_editor
    - http_routing
    - auth_signup
    - digest
    - resource
    - payment
    - utm
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
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.

![Promotion rules screenshot](../sale_promotion_rule/static/description/promotion_rule.png)

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
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 group 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
Models touched (4)

New fields (5)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True string='Coupont Promotion Code'
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] index=True readonly=True string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] index=True readonly=True string='Promotion rules' args: 'sale.promotion.rule'
Public methods (3)
  • add_coupon(self, coupon_code)
  • apply_promotions(self)
  • clear_promotions(self)

New fields (1)
  • name Char
    required=True string='Coupon Name'
Public methods (1)
  • doit(self)

New fields (6)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • is_promotion_line Boolean
    help='True if the line has been added by a promotion rule'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] string='Promotion rules' args: 'sale.promotion.rule'
Public methods (0)

No public methods.

New fields (19)
  • code Char
  • company_id Many2one → res.company
    comodel_name='res.company' help='Define on which company this promotion rule is available (let it empty if available for every companies)' index=True string='Company'
  • date_from Date
  • date_to Date
  • discount_amount Float
    digits='Discount' required=True
  • discount_amount_currency_id Many2one → res.currency
    default=<expr> string='Discount Amount Currency' args: 'res.currency'
  • discount_product_id Many2one → product.product
    domain=[('type', '=', 'service')] string='Product used to apply the promotion' args: 'product.product'
  • discount_type Selection
    default='percentage' required=True selection=[('percentage', 'Percentage'), ('amount_tax_included', 'Amount (Taxes included)'), ('amount_tax_excluded', 'Amount (Taxes excluded)')]
  • is_minimal_amount_tax_incl Boolean
    default=True required=True args: 'Tax included into minimal amount?'
  • minimal_amount Float
    digits='Discount'
  • multi_rule_strategy Selection
    default='use_best' selection=[('use_best', 'Use the best promotion'), ('cumulate', 'Cumulate promotion'), ('exclusive', 'Exclusive promotion'), ('keep_existing', 'Keep existing discount')]
  • name Char
    required=True translate=True
  • only_newsletter Boolean
  • promo_type Selection
    default='discount' required=True selection=[('discount', 'Discount')]
  • restrict_partner_ids Many2many → res.partner
    column1='rule_id' column2='partner_id' comodel_name='res.partner' relation='discount_rule_partner_rel' string='Restricted partners'
  • restrict_pricelist_ids Many2many → product.pricelist
    column1='rule_id' column2='pricelist_id' comodel_name='product.pricelist' relation='discount_rule_pricelist_rel' string='Restricted pricelists'
  • rule_type Selection
    default='coupon' required=True selection=[('coupon', 'Coupon'), ('auto', 'Automatic')]
  • sequence Integer
    default=10
  • usage_restriction Selection
    default='no_restriction' required=True selection=[('one_per_partner', 'One per partner'), ('no_restriction', 'No restriction')]
Public methods (5)
  • apply_auto(self, orders)
    @api.model
    Apply automatic promotion rules to the orders
  • apply_coupon(self, orders, coupon_code)
    Add a coupon to orders
  • compute_promotions(self, orders)
    @api.model
    Compute 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
REPOSITORY
REPOSITORYOCA/sale-workflow
GIT
GIThttps://github.com/OCA/sale-workflow.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/sale-workflow/tree/14.0/sale_promotion_rule
VERSION
VERSION 1.0.1
CATEGORY
CATEGORYSale
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, Xavier Bouquiaux
WEBSITE
WEBSITEhttps://github.com/OCA/sale-workflow
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:40:58
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - sale
    - sales_team
    - base
    - mail
    - base_setup
    - web
    - bus
    - web_tour
    - payment
    - account
    - product
    - uom
    - analytic
    - portal
    - web_editor
    - http_routing
    - auth_signup
    - digest
    - resource
    - utm
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
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 group 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
Models touched (4)

New fields (5)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True string='Coupont Promotion Code'
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] index=True readonly=True string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] index=True readonly=True string='Promotion rules' args: 'sale.promotion.rule'
Public methods (3)
  • add_coupon(self, coupon_code)
  • apply_promotions(self)
  • clear_promotions(self)

New fields (1)
  • name Char
    required=True string='Coupon Name'
Public methods (1)
  • doit(self)

New fields (6)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • is_promotion_line Boolean
    help='True if the line has been added by a promotion rule'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] string='Promotion rules' args: 'sale.promotion.rule'
Public methods (0)

No public methods.

New fields (19)
  • code Char
  • company_id Many2one → res.company
    comodel_name='res.company' help='Define on which company this promotion rule is available (let it empty if available for every companies)' index=True string='Company'
  • date_from Date
  • date_to Date
  • discount_amount Float
    digits='Discount' required=True
  • discount_amount_currency_id Many2one → res.currency
    default=<expr> string='Discount Amount Currency' args: 'res.currency'
  • discount_product_id Many2one → product.product
    domain=[('type', '=', 'service')] string='Product used to apply the promotion' args: 'product.product'
  • discount_type Selection
    default='percentage' required=True selection=[('percentage', 'Percentage'), ('amount_tax_included', 'Amount (Taxes included)'), ('amount_tax_excluded', 'Amount (Taxes excluded)')]
  • is_minimal_amount_tax_incl Boolean
    default=True required=True args: 'Tax included into minimal amount?'
  • minimal_amount Float
    digits='Discount'
  • multi_rule_strategy Selection
    default='use_best' selection=[('use_best', 'Use the best promotion'), ('cumulate', 'Cumulate promotion'), ('exclusive', 'Exclusive promotion'), ('keep_existing', 'Keep existing discount')]
  • name Char
    required=True translate=True
  • only_newsletter Boolean
  • promo_type Selection
    default='discount' required=True selection=[('discount', 'Discount')]
  • restrict_partner_ids Many2many → res.partner
    column1='rule_id' column2='partner_id' comodel_name='res.partner' relation='discount_rule_partner_rel' string='Restricted partners'
  • restrict_pricelist_ids Many2many → product.pricelist
    column1='rule_id' column2='pricelist_id' comodel_name='product.pricelist' relation='discount_rule_pricelist_rel' string='Restricted pricelists'
  • rule_type Selection
    default='coupon' required=True selection=[('coupon', 'Coupon'), ('auto', 'Automatic')]
  • sequence Integer
    default=10
  • usage_restriction Selection
    default='no_restriction' required=True selection=[('one_per_partner', 'One per partner'), ('no_restriction', 'No restriction')]
Public methods (5)
  • apply_auto(self, orders)
    @api.model
    Apply automatic promotion rules to the orders
  • apply_coupon(self, orders, coupon_code)
    Add a coupon to orders
  • compute_promotions(self, orders)
    @api.model
    Compute 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
REPOSITORY
REPOSITORYOCA/sale-workflow
GIT
GIThttps://github.com/OCA/sale-workflow.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/sale-workflow/tree/12.0/sale_promotion_rule
VERSION
VERSION 1.0.1
CATEGORY
CATEGORYSale
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
COMMITTERS
COMMITTERSOCA Transbot, oca-travis, Weblate, OCA-git-bot, Pierrick Brun
WEBSITE
WEBSITEhttps://github.com/OCA/sale-workflow
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:29:17
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - sale
    - sales_team
    - base
    - mail
    - base_setup
    - web
    - bus
    - web_tour
    - payment
    - account
    - product
    - decimal_precision
    - uom
    - analytic
    - portal
    - http_routing
    - digest
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
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 group 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
Models touched (4)

New fields (5)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] index=True readonly=True string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] index=True readonly=True string='Promotion rules' args: 'sale.promotion.rule'
Public methods (3)
  • add_coupon(self, coupon_code)
    @api.multi
  • apply_promotions(self)
    @api.multi
  • clear_promotions(self)
    @api.multi

New fields (1)
  • name Char
    required=True
Public methods (1)
  • doit(self)
    @api.multi

New fields (6)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Applied Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • is_promotion_line Boolean
    help='True if the line has been added by a promotion rule'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] string='Promotion rules' args: 'sale.promotion.rule'
Public methods (0)

No public methods.

New fields (18)
  • code Char
  • date_from Date
  • date_to Date
  • discount_amount Float
    digits=dp.get_precision('Discount') required=True
  • discount_amount_currency_id Many2one → res.currency
    default=<expr> string='Discount Amount Currency' args: 'res.currency'
  • discount_product_id Many2one → product.product
    domain=[('type', '=', 'service')] string='Product used to apply the promotion' args: 'product.product'
  • discount_type Selection
    default='percentage' required=True selection=[('percentage', 'Percentage'), ('amount_tax_included', 'Amount (Taxes included)'), ('amount_tax_excluded', 'Amount (Taxes excluded)')]
  • is_minimal_amount_tax_incl Boolean
    default=True required=True args: 'Tax included into minimal amount?'
  • minimal_amount Float
    digits=dp.get_precision('Discount')
  • multi_rule_strategy Selection
    default='use_best' description="\nIt's possible to apply multiple promotions to a sale order. In such a case\nthe rules will be applied in the sequence order.\nIf the first applicable rule is 'exclusice' the process will only apply\nthis rule. Otherwise the process will loop over each rule and apply it\naccording to the strategy\n" selection=[('use_best', 'Use the best promotion'), ('cumulate', 'Cumulate promotion'), ('exclusive', 'Exclusive promotion'), ('keep_existing', 'Keep existing discount')]
  • name Char
    required=True translate=True
  • only_newsletter Boolean
  • promo_type Selection
    default='discount' required=True selection=[('discount', 'Discount')]
  • restrict_partner_ids Many2many → res.partner
    column1='rule_id' column2='partner_id' comodel_name='res.partner' relation='discount_rule_partner_rel' string='Restricted partners'
  • restrict_pricelist_ids Many2many → product.pricelist
    column1='rule_id' column2='pricelist_id' comodel_name='product.pricelist' relation='discount_rule_pricelist_rel' string='Restricted pricelists'
  • rule_type Selection
    default='coupon' required=True selection=[('coupon', 'Coupon'), ('auto', 'Automatic')]
  • sequence Integer
    default=10
  • usage_restriction Selection
    default='no_restriction' required=True selection=[('one_per_partner', 'One per partner'), ('no_restriction', 'No restriction')]
Public methods (5)
  • apply_auto(self, orders)
    @api.model
    Apply automatic promotion rules to the orders
  • apply_coupon(self, orders, coupon_code)
    @api.multi
    Add a coupon to orders
  • compute_promotions(self, orders)
    @api.model
    Compute available promotions on the given orders. If a coupon is already defined on the orders, it's preserved
  • name_get(self)
    @api.multi
  • remove_promotions(self, orders)
    @api.model
REPOSITORY
REPOSITORYOCA/sale-workflow
GIT
GIThttps://github.com/OCA/sale-workflow.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/sale-workflow/tree/10.0/sale_promotion_rule
VERSION
VERSION 2.1.1
CATEGORY
CATEGORYSale
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion, ACSONE SA/NV
COMMITTERS
COMMITTERSLaurent Mignon (ACSONE), Denis Roussel, OCA Transbot, oca-travis, OCA-git-bot, François Honoré
WEBSITE
WEBSITEhttps://github.com/OCA/sale-workflow
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:19:56
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - sale
    - sales_team
    - base
    - mail
    - base_setup
    - web_kanban
    - web
    - bus
    - web_tour
    - account
    - product
    - decimal_precision
    - report
    - analytic
    - web_planner
    - procurement
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
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 field 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
Models touched (4)

New fields (5)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] index=True readonly=True string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] index=True readonly=True string='Promotion rules' args: 'sale.promotion.rule'
Public methods (3)
  • add_coupon(self, coupon_code)
    @api.multi
  • apply_promotions(self)
    @api.multi
  • clear_promotions(self)
    @api.multi

New fields (1)
  • name Char
    required=True
Public methods (1)
  • doit(self)
    @api.multi

New fields (6)
  • applied_promotion_rule_ids Many2many → sale.promotion.rule
    compute='_compute_applied_promotion_rule_ids' string='Promotion rules' args: 'sale.promotion.rule'
  • coupon_code Char
    readonly=True related='coupon_promotion_rule_id.code' store=True
  • coupon_promotion_rule_id Many2one → sale.promotion.rule
    domain=[('rule_type', '=', 'coupon')] string='Coupon promotion rule' args: 'sale.promotion.rule'
  • has_promotion_rules Boolean
    compute='_compute_has_promotion_rules'
  • is_promotion_line Boolean
    help='True if the line has been added by a promotion rule'
  • promotion_rule_ids Many2many → sale.promotion.rule
    domain=[('rule_type', '!=', 'coupon')] string='Promotion rules' args: 'sale.promotion.rule'
Public methods (0)

No public methods.

New fields (18)
  • code Char
  • date_from Date
  • date_to Date
  • discount_amount Float
    digits=dp.get_precision('Discount') required=True
  • discount_amount_currency_id Many2one → res.currency
    default=<expr> string='Discount Amount Currency' args: 'res.currency'
  • discount_product_id Many2one → product.product
    domain=[('type', '=', 'service')] string='Product used to apply the promotion' args: 'product.product'
  • discount_type Selection
    default='percentage' required=True selection=[('percentage', 'Percentage'), ('amount_tax_included', 'Amount (Taxes included)'), ('amount_tax_excluded', 'Amount (Taxes excluded)')]
  • is_minimal_amount_tax_incl Boolean
    default=True required=True args: 'Tax included into minimal amount?'
  • minimal_amount Float
    digits=dp.get_precision('Discount')
  • multi_rule_strategy Selection
    default='use_best' description="\nIt's possible to apply multiple promotions to a sale order. In such a case\nthe rules will be applied in the sequence order.\nIf the first applicable rule is 'exclusice' the process will only apply\nthis rule. Otherwise the process will loop over each rule and apply it\naccording to the strategy\n" selection=[('use_best', 'Use the best promotion'), ('cumulate', 'Cumulate promotion'), ('exclusive', 'Exclusive promotion'), ('keep_existing', 'Keep existing discount')]
  • name Char
    required=True translate=True
  • only_newsletter Boolean
  • promo_type Selection
    default='discount' required=True selection=[('discount', 'Discount')]
  • restrict_partner_ids Many2many → res.partner
    column1='rule_id' column2='partner_id' comodel_name='res.partner' relation='discount_rule_partner_rel' string='Restricted partners'
  • restrict_pricelist_ids Many2many → product.pricelist
    column1='rule_id' column2='pricelist_id' comodel_name='product.pricelist' relation='discount_rule_pricelist_rel' string='Restricted pricelists'
  • rule_type Selection
    default='coupon' required=True selection=[('coupon', 'Coupon'), ('auto', 'Automatic')]
  • sequence Integer
    default=10
  • usage_restriction Selection
    default='no_restriction' required=True selection=[('one_per_partner', 'One per partner'), ('no_restriction', 'No restriction')]
Public methods (5)
  • apply_auto(self, orders)
    @api.model
    Apply automatic promotion rules to the orders
  • apply_coupon(self, orders, coupon_code)
    @api.multi
    Add a coupon to orders
  • compute_promotions(self, orders)
    @api.model
    Compute available promotions on the given orders. If a coupon is already defined on the orders, it's preserved
  • name_get(self)
    @api.multi
  • remove_promotions(self, orders)
    @api.model