简体   繁体   中英

Add confirm when drag and drop the kanban view in odoo 10

I work with project.task model. I need to add confirmation for every stage change when user did the drag and drop. Is there any possible way.. I add validation error in write method. But Its not complete my wish. please help me

I have done the same similar, so you can follow my method if you wish.

  • I did write a function for onchange task stage.

  • create a temp stage

  • make visible this temp stage records for PM and he can also confirm the same.

Note :- you should store the details on onchange function. like the stage to be changed and where from etc..

Finally I found the solution... In this case you have to change the kanban_view.js file in web_kanban module. You can replace

 add_record_to_column: function (event)

this function by this code in "kanban_view.js" file.

add_record_to_column: function (event) {
    var self = this;
    var column = event.target;
    var record = event.data.record;
    var data = {};
    data[this.group_by_field] = event.target.id;
    // display confirm message
    if (confirm("Are you sure you want to change this stage?")){
       //if click yes do this
        this.dataset.write(record.id, data, {}).done(function () {
            if (!self.isDestroyed()) {
                self.reload_record(record);
                self.resequence_column(column); 
                alert("You have change the stage!");
            }
        }).fail(this.do_reload);
    }else{// if no reload the page and remain the tile in same satage
        location.reload();
    }},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM