Hi,
In Odoo’s standard Sales Promotions & Coupons app, promotions are applied at the time of creating a sales order (so they affect future purchases, not past ones). To set up your case — “Buy any of 4 machines, get 50% off on selected accessories” — you would create a Promotion Program where the condition is that the order contains at least one of the 4 machine products, and the reward applies a 50% discount on a defined list of accessory products. Odoo does this by checking products in the cart/order and then applying the discount rule automatically. However, note that this promotion won’t retroactively discount past sales of the machines; it will only work on the same order where both the machine and accessories are added together. If you want the customer to buy the machine first and then come back later for discounted accessories, you’d instead use a Coupon Program (generate coupons on machine purchase and redeem them later for accessories).
For more details, please refer to the links:
1. https://www.cybrosys.com/blog/an-overview-of-coupons-and-promotion-in-odoo-17-point-of-sale
2. https://www.youtube.com/watch?v=EYUazWrK4yU
Hope it helps.