Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to modify the PetToysList component in OpenERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 221
    Comment on it

    How to modify the PetToysList component so clicking on a toy replaces the homepage by the toy's form view in OpenERP/Odoo ?

    If you want to modify the PetToysList component in OpenERP(Odoo) so that when you click on a toy it replaces the homepage by the toy's form view in OpenERP/Odoo for this follow the below mentioned code and paste it in your .js file.

    local.PetToysList = instance.Widget.extend({
        template: 'PetToysList',
        events: {
            'click .oe_petstore_pettoy': 'selected_item',
        },
        start: function () {
            var self = this;
            return new instance.web.Model('product.product')
                .query(['name', 'image'])
                .filter([['categ_id.name', '=', "Pet Toys"]])
                .limit(5)
                .all()
                .then(function (results) {
                    _(results).each(function (item) {
                        self.$el.append(QWeb.render('PetToy', {item: item}));
                    });
                });
        },
        selected_item: function (event) {
            this.do_action({
                type: 'ir.actions.act_window',
                res_model: 'product.product',
                res_id: $(event.currentTarget).data('id'),
                views: [[false, 'form']],
            });
        },
    });
    

    Note- With the help of this code we will replaces the homepage by the toy's form view.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: