Yardım

2

How to override this js method in website_sale_delivery module

Avatar
Annadurai

    var _onCarrierClick = function(ev) {

        $pay_button.prop('disabled', true);

        var carrier_id = $(ev.currentTarget).val();

 

        var values = {'carrier_id': carrier_id};

        ajax.jsonRpc('/shop/update_carrier', 'call', values)

          .then(_onCarrierUpdateAnswer);

    };


Need to add a variable like this

    var _onCarrierClick = function(ev) {

        $pay_button.prop('disabled', true);

        var carrier_id = $(ev.currentTarget).val();

        var c_name = $('#carrier_name').val();

        var values = {'carrier_id': carrier_id, 'carrier_name':c_name};

        ajax.jsonRpc('/shop/update_carrier', 'call', values)

          .then(_onCarrierUpdateAnswer);

    };


Avatar
Vazgeç
1 Cevap
1
Avatar
Fatih Piristine
En iyi cevap

copy all code from original source, include it in new module. apply sequence to change load order if needed. do your modifications where needed. re-generated assets and done.


'use strict';
odoo.define('your_module_name.checkout', function (require) {

require('web.dom_ready');
var ajax = require('web.ajax');

var _onCarrierClick = function(ev) {
$pay_button.prop('disabled', true);
var carrier_id = $(ev.currentTarget).val();
var values = {'carrier_id': carrier_id};
ajax.jsonRpc('/shop/update_carrier', 'call', values)
.then(_onCarrierUpdateAnswer);
};

var $carriers = $("#delivery_carrier input[name='delivery_type']");
$carriers.click(_onCarrierClick);
// diy: avoid double ajax calls!
2 Yorumlar
Avatar
Vazgeç
Avatar
Annadurai
-

Can u explain the sequence to load order?

Avatar
Fatih Piristine
-

search for module loading sequence. default is 100 if not mistaken.