You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
1.3 KiB

/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import PaymentForm from '@payment/js/payment_form';
PaymentForm.include({
/**
* Function executes when payment provider is clicked and it checks if there are
* any shipping methods specified inside the payment provider to list them
* in website after the payment provider.
*
* @param {Object} ev Contains details about the payment provider.
*/
async _selectPaymentOption(ev) {
this._super(...arguments);
$('.list-group-item.o_delivery_carrier_select').each(function(key,carrier) {
$(this).find('input[type="radio"]').prop('checked', false);
$(this).addClass('d-none');
});
let providerId = ev.target.dataset['providerId']
let carriers=await this.rpc('/web/deliver/carrier',{
'provider_id':parseInt(providerId),
})
if(carriers.length > 0){
carriers.forEach((id)=>{
if(id){
let deliveryMethod = '#delivery_method_'+id
$(deliveryMethod)[0].classList.remove('d-none')
$('#NoShippingMethod')[0].classList.remove('d-none')
}
})
}else{
$('#NoShippingMethod')[0].classList.remove('d-none')
}
},
});