cmanuel
cmanuel

Reputation: 43

How to set a value into a openerp form view field from javascript

this is the code i use to call the form view:

get_view_form_dimension: function() {
    var self = this;
    var action_manager = new openerp.web.ActionManager(this);
    var dialog = new openerp.web.Dialog(this, {
        width: 800,
        buttons : [
            {text: _t("Cancel"), click: function() { $(this).dialog('destroy'); }},
            {text: _t("Save"), click: function() {
                var form_view = action_manager.inner_viewmanager.views.form.controller;

                form_view.do_save(function() {
                    $.jstree._reference("#new_tree").destroy();
                    self.get_tree_structure();
                });
                $(this).dialog('destroy');


            }}
        ]
    }).open();

    action_manager.appendTo(dialog.$element);
    action_manager.do_action({
        res_model : 'df.bi.dimension',
        res_id: self.process_id,
        views : [[false, 'form']],
        type : 'ir.actions.act_window',
        flags : {
            search_view: false,
            sidebar : false,
            views_switcher : false,
            action_buttons : false,
            pager: false
        }

    });


},

how can i set values into the form that this method will rise ?? or in case that exist other solution please tell me ? sorry for my english!

Upvotes: 1

Views: 1221

Answers (1)

GrupoCITEC
GrupoCITEC

Reputation: 26

Add a context field to your do_action call with default values, like this:

context: {'default_account_id': 5, 'default_name': 'hello'},

Upvotes: 1

Related Questions