If only one of the two dates rules fields is specified, it won't be considered
when filtering coupon programs, and the program will always be considered valid...
This commit reorder the conditon to correctly consider both fields: rule_date_from
and rule_date_to, even if only one of the two field is set.
X-original-commit: 871a118d2c72f58185cbf822375282b613e67337
This refactoring extracts parts of `sale_coupon` module to create a more
generic module called `coupon`. This new module can be extended in
different sales modules to implement functionalities specific to modules
that extend it.
/!\ Cherry-pick of odoo/enterprise@8b85628c65 that was lost between
coupon move from OE to OC and forward-port
It is possible to setup multiple global promotions, i.e. 5% discount
after 5 products and 10% discount after 10 products. Buying 10 products
gives the 10% discount. But if you select 5 products (5% is applied)
then add 5 more products, the 10% discount is not automatically applied,
the custommer must remove the 5% discount in order to get the 10% one.
This commit automatically upgrades the promotion to use the best
applicable discount.
opw-1953224
closesodoo/odoo#32314
Signed-off-by: Christophe Simonis <chs@odoo.com>