Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
22675 Weergaven

I am launching a wizard (mail.message.compose) using .js and want to pre fill some fields at launch of wizard. many2many fields are not prefilled using attachment_ids = [( 6, 0, [1])], many2one, char and selection fields are working fine.

I am doing something like ..

function launch_wizard(self, view, user_type, email) {

      var action = view.getParent().action;

      var Mail = new session.web.DataSet(self, 'mail.compose.message', view.dataset.get_context());

      var domain = new session.web.CompoundDomain(view.dataset.domain);

      if (view.fields_view.type == 'form') {

          domain = new session.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);

      }

      if (view.fields_view.type == 'form') rec_name = view.datarecord.name;

      else rec_name = '';

      session.web.pyeval.eval_domains_and_contexts({

       domains: [domain],

      contexts: [Mail.get_context()]

      }).done(function (result) {

Mail.create({

         subject: action.name,

      record_name: rec_name,

      composition_mode: 'comment',
     attachment_ids = [( 6, 0, [1])], writing it here directly for removing complications of computing attachment ids

      }).done(function(mail_id) {

      var step1 = Mail.call('go_step_1', [[mail_id], Mail.get_context()]).done(function(result) {

      var action = result;

      self.do_action(action);

      });

});

});

}

Avatar
Annuleer
Auteur Beste antwoord


So if anyone needs that in .js, it is used like attachment_ids = [[ 6, 0, [1] ]] , please note with [ ] not ( ).

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
4
sep. 15
4089
3
aug. 15
7515
2
apr. 23
28826
1
mrt. 17
3015
0
jun. 16
3537