Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Point Of Sale KItchen Order

pos
By
senthil
on 5/2/16, 4:35 AM 396 views

I want to send data from pos to another custom model (kitchen.order)


I write a js code to call that model  but it throws 

TypeError: create() got an unexpected keyword argument 'user_id' (that is parameter not valid)


How to fix this 

Here is my code follows kitchen.js

odoo.define('hsr_pos.kitchen_order', function (require) {

"use strict";

var screens = require('point_of_sale.screens');

var PosDB = require('point_of_sale.DB');

//~ var kot = require('kitchen.order');

var Model = require('web.DataModel');

var KitchenButton = screens.ActionButtonWidget.extend({

template: 'KitchenButton',

button_click: function(){

var self = this;

 

self.send_kitchen();

},

send_kitchen: function() {

var order = this.pos.get_order();

var lines = order.get_orderlines();

this.db = new PosDB();

var order_id = this.db.add_order(order.export_as_JSON());

var o = new Model('pos.order');

var vals = {};

var orders = this.db.get_orders();

console.log(order.export_as_JSON());

o.call('create',order.export_as_JSON());

},

});

screens.define_action_button({

'name': 'kitchen',

'widget': KitchenButton,

});

});

0
senthil
On 5/2/16, 9:22 AM

I got it

Code as follows


var screens = require('point_of_sale.screens');
var Model = require('web.DataModel');
var KitchenButton = screens.ActionButtonWidget.extend({
    template: 'KitchenButton',
    button_click: function(){
        var self = this;
        var val = "test";
        self.send_kitchen();
    },
    send_kitchen: function() {
        var order = this.pos.get_order();
        var lines = order.get_orderlines();
        var o = new Model('kitchen.order');
        console.log(order.export_as_JSON());
        o.call('create',[_.map(orders, function (order) {
                return order;
            })],undefined,
            {
                shadow: false,
                timeout: false
            }
            ););  
    },
});

screens.define_action_button({
    'name': 'kitchen',
    'widget': KitchenButton,

});

});


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/2/16, 4:35 AM
Seen: 396 times
Last updated: 5/2/16, 9:22 AM