Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6968 Zobrazení

I'm changing odoo 10 module to odoo 11.I'm facing problem for missing dependency web.DataModel. How can I convert the following code to odoo 11 version?

          
var temp = {

       'partner_id': client['id'],
       'coupon_pos': cp.code,
          };
 new Model('partner.coupon.pos').call('update_history', 
 ['',temp]).done(function (result) {
     // alert("result")
     var applied = self.pos.applied_coupon;
     var already_used = false;
     for (var j in applied) {
     if (applied[j]['partner_id'][0] == client['id'] &&
         applied[j]['coupon_pos'] == order.coupon_status['code']) {
         applied[j]['number_pos'] += 1;
         already_used = true;
         break;
     }
   }
   if (!already_used) {
      var temp = {
          'partner_id': [client['id'], client['name']],
          'number_pos': 1,
          'coupon_pos': order.coupon_status['code']
       };
       self.pos.applied_coupon.push(temp);
    }
 });
self.gui.close_popup();


Avatar
Zrušit
Nejlepší odpověď

Hi Jordan Web.DataModel is deprecated in odoo 11. so you can use RPC queries instead .

var rpc = require('web.rpc')

rpc.query(

     model: //your model,

     method: //your method,

      args: [{

          'arg1': value1,

      }]

 }).then(function (result) { 

            // your code 

  });

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
zář 18
5435
0
led 19
2938
1
led 19
3496
1
led 19
2596
0
čvc 25
228