This question has been flagged
2 Replies
8160 Views

I got the error while executing the code given below:

widget.js:
odoo.define('web_one2many_selectable_10.form_widgets', function (require) {
"use strict";

var core = require('web.core');
var _t = core._t;
var QWeb = core.qweb;
var field_registry = require('web.field_registry');
var FieldOne2Many = field_registry.get('one2many');
var One2ManySelectable = FieldOne2Many.extend({
    // my custom template for unique char field
    template: 'One2ManySelectable', 

    multi_selection: true,
    //button click
    events: {
        "click .cf_button_confirm": "action_selected_lines",
    },
    init: function () {
        console.log("Excuting Inited");
        this._super.apply(this, arguments);

        // boolean used to prevent concurrent record creation
        this.creatingRecord = false;
    },

    start: function() 
    {   
        this._super.apply(this, arguments);
        var self=this;          
       },
    //passing ids to function
    action_selected_lines: function()
    {       
        var self=this;
        var selected_ids = self.get_selected_ids_one2many();
        if (selected_ids.length === 0)
        {
            this.do_warn(_t("You must choose at least one record."));
            return false;
        }
        var model_obj=new Model(this.dataset.model); 

        model_obj.call('bulk_verify',[selected_ids],{context:self.dataset.context})
        .then(function(result){
        });
    },
    //collecting the selected IDS from one2manay list
    get_selected_ids_one2many: function ()
    {
        var ids =[];
        debugger
        this.$el.find('td.o_list_record_selector input:checked')
                .closest('tr').each(function () {

                    ids.push(parseInt($(this).context.dataset.id));
                    console.log(ids);
        });
        return ids;
    },


});
// register unique widget, because Odoo does not know anything about it
//you can use <field name="One2many_ids" widget="x2many_selectable"> for call this widget
core.form_widget_registry.add('one2many_selectable', One2ManySelectable);
});

Style error:

The style compilation failed, see the error below. Your recent actions may be the cause, please try reverting the changes you made.

Could not get content for /helpdesk/static/src/less/helpdesk.less defined in bundle 'web.assets_backend'.

and this error in console:

Missing widget: one2many_selectable for field result_line of type one2many

I want to make one2many selectable with checkbox using widget in odoo 11 Can Anyone help to resolve this problem ?

Also see same problem in :

https://stackoverflow.com/q/50982992/8409617
Avatar
Discard
Best Answer

Anand, I have the same issue, have you resolved it?

I've tried that "One2many Mass Select Delete Widget" but it doesn't work either.
Avatar
Discard