Warning: include_once(/home/favoledo/robertozanardo.com/wp-content/sunrise.php): Failed to open stream: No such file or directory in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52

Warning: include_once(): Failed opening '/home/favoledo/robertozanardo.com/wp-content/sunrise.php' for inclusion (include_path='.:/opt/alt/php83/usr/share/pear:/opt/alt/php83/usr/share/php:/usr/share/pear:/usr/share/php') in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52
Calling Javascript and get data in models from button in Odoo

Calling Javascript and get data in models from button in Odoo

Calling Javascript from button in Odoo and obtain records data from model seems simple but made me crazy for some subtle details and messy documentation.
Maybe this is not the perfect way to do it but finally i’ve found it (any suggestion will be appreciate)

The first problem is in obtaing data from current model and relational fields.

I’ve made it with some data taken directly from record.data in javascript and some others in python code with @api.model directives.

This is the code i’ve used for .py

@api.model
def get_all_data(self,partner_id, pick_id, company_id,contract_id):
   packs = 0
   result = {}
   res_ids = self.env['res.partner'].search([['id', '=', partner_id]])

   for p in res_ids:
      result['name'] = p.name
      result['street'] = p.street
      result['street2'] = p.street2
      result['zip'] = p.zip
      result['city'] = p.city

return(result)

and this for .js

FormController.include({_onButtonClicked: function (event) {
   if(event.data.attrs['name'] == 'gls_call')
   {
      var partner_id = record.data.partner_id.data.id;

      rpc.query({
               model: 'stock.picking',
               method: 'get_all_data',
               args: [partner_id,pick_id,company_id,contract_id],
               }).then(function(res)
               {
                  var Street= res.street
               })

Hope all of this can be of any help for someone catching with the same problem!

1 commento su “Calling Javascript and get data in models from button in Odoo”

Lascia un commento

kolaybet giriş
kolaybet
betgaranti
bettilt
kolaybet
betpark
betgaranti
betpark
betgaranti
kolaybet
kolaybet
betpark
betpark
betgaranti
hellocasino
betgaranti
Kolaybet
bettilt
betpark
betpark
Kolaybet
Kolaybet Giriş
Kolaybet
betpark
betpark
kolaybet
betpark
betgaranti
kolaybet giriş
kolaybet
Kolaybet Giriş
Kolaybet
Kolaybet Telegram
Kolaybet Giriş
betpark
betpark
holiganbet
Kolaybet
Kolaybet
Betgaranti
matbet güncel giriş
matbet güncel giriş
matbet güncel giriş
matbet güncel giriş
betgaranti
betgaranti
betgaranti
sahabet
sahabet
kolaybet
kolaybet
sahabet
Hititbet
Hititbet Giriş
sahabet
Hititbet Güncel Giriş
vdcasino
onwin
onwin
hititbet
betgaranti
Hellocasino
Hello Casino
Hititbet
Hititbet
Hititbet Güncel Giriş
hititbet
vdcasino
onwin
onwin
grandpashabet
betpark
betgaranti
hititbet
grandpashabet
bettilt
sahabet
sahabet
sahabet
onwin
onwin
hititbet giriş
hititbet
hititbet giriş
hititbet mobil giriş
hititbet güncel giriş
vdcasino
grandpashabet
kolaybet
kolaybet
betpark
Kolaybet Giriş
Kolaybet Güncel Giriş
betgaranti
betgaranti giriş
betgaranti 2026