[FIX] website_payment: fix "Donation" snippet "Pre-Filled Options"
Steps to Reproduce : - Install eCommerce. - Drag and drop the "Donation" snippet. - Click on the prices in the snippet. - Toggle the "Pre-Filled Options" option. - => There is a traceback. This bug is due to the fact that since commit [1], all templates have been added to the OWL app. With OWL, a t-foreach in a template can no longer loop over a 0 number and causes an error if we try to. This is what happens here, as toggling off the "Pre-filled Options" option sets the donationAmounts to 0, which is then used in a loop in the templates. This commit fixes this by replacing the number by an empty array, so the loop cannot fail. [1]: https://github.com/odoo/odoo/commit/4703e4a2efa9213979307e4d3dedeedc61ad0fc3 task-3859207 closes odoo/odoo#161431 Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
This commit is contained in:
@@ -289,7 +289,7 @@ options.registry.Donation = options.Class.extend({
|
||||
this.$target.find('.s_donation_donate_btn').before(sliderTemplate);
|
||||
}
|
||||
const prefilledOptions = this.$target[0].dataset.prefilledOptions;
|
||||
let donationAmounts = 0;
|
||||
let donationAmounts = [];
|
||||
let showDescriptions = false;
|
||||
if (prefilledOptions) {
|
||||
donationAmounts = JSON.parse(this.$target[0].dataset.donationAmounts);
|
||||
|
||||
Reference in New Issue
Block a user