Repository
OCA/sale-promotion · module folder · Try on Runboat
Module version
1.0.0
Category
Sale
Folder size
0.06 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/sale-promotion
Last tracking update
2026-08-07 08:43:05
Authors
Odoo Community Association (OCA), Tecnativa
Maintainers
Odoo Community Association (OCA), Tecnativa
Committers
OCA-git-bot, oca-ci, Bhavesh Heliconia
Odoo dependencies
Python dependencies
None
System dependencies
None
Required by
sale_loyalty_limit, sale_loyalty_multi_gift, sale_loyalty_partner
Description
This module adds a link in the sale order line to the program used in a
discount, so it can be easily tracked afterwards. Also eases the
implementation of loyalty modules that don't necessarily use the
discount product as product for the discount line.

It also links the reward lines to:  
- The order lines that generated them, so we can follow which order
  lines produced which discounts.
- The order lines over which the reward is applied:
  - In a discount promo: the cheapest product, specific products or the
    whole order.
  - In a product promo: the product lines over which the reward is
    discounted.

Additionally, this module adds a button in the loyalty program form view to open related sale orders.

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
loyalty_program_view_form_inherit loyalty.program.form.inherit loyalty.program form Inherits loyalty.loyalty_program_view_form
view_order_form sale.order form Inherits sale.view_order_form
view_order_line_tree sale.order.line tree Inherits sale.view_order_line_tree
view_order_product_search sale.report search Inherits sale.view_order_product_search
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (4)

New fields (1)
  • related_so_count Integer
    compute='_compute_related_so_count'
Public methods (1)
  • action_open_related_sale_orders(self)

New fields (0)

No new fields.

Public methods (1)
  • write(self, vals)
    We're looking for reward lines set in the write, from those, we'll get the proper ids to write them into the related lines

New fields (4)
  • loyalty_program_id Many2one
    related='reward_id.program_id' store=True string='Loyalty Program'
  • reward_generated_line_ids Many2many → sale.order.line
    column1='sale_line_id' column2='reward_generated_line_id' comodel_name='sale.order.line' help='Link on the reward lines generated meeting this line as criteria' relation='sale_line_reward_generated_line_rel' string='Reward Generated lines'
  • reward_line_ids Many2many → sale.order.line
    column1='sale_line_id' column2='reward_line_id' comodel_name='sale.order.line' help='Link on the reward lines applied from this one' relation='sale_line_reward_line_rel' string='Reward lines'
  • reward_origin_generated_line_ids Many2many → sale.order.line
    column1='reward_generated_line_id' column2='sale_line_id' comodel_name='sale.order.line' help='Origin Link on the reward lines generated meeting this line as criteria' relation='sale_line_reward_generated_line_rel' string='Origin Reward Generated lines'
Public methods (1)
  • write(self, vals)
    When the reward line is update we should refresh the line links as well

New fields (1)
  • loyalty_program_id Many2one → loyalty.program
    comodel_name='loyalty.program' string='Loyalty Program'
Public methods (0)

No public methods.

Loading…

Loading…

Status
Open migration PR — not merged yet for this version
CI status
green — ready to merge
Open since
104 days ago
Last activity
2 days ago
Repository
OCA/sale-promotion
Pull request
[19.0][MIG] sale_loyalty_order_line_link: Migration to 19.0 (#328)