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

What is argument "ids" in the method and how to call it from javascript ?

By
GonG
on 6/13/14, 10:25 AM 810 views

Hi, I've been trying to call the python method from the web client. The method is

action_invoice(self, cr, uid, ids, context=None):

In javascript, I call this method via

var model = new instance.web.Model("pos.order");

model.call("action_invoice", [], {context: new instance.web.CompoundContext()});

But it doesn't work. The error says that I lack one argument in the call. I think what I miss is the arguments "ids". From googling, it seems to be a list of record ids. What is it anyway ? Could you please tell me what is it and how to store that argument it in the javascript ?

Thank you very much

argument "ids" is the record id or list of records ids. In the method call pass "ids" record id value. so that method is executed for the particular record id.

Prakash
on 6/18/14, 6:23 AM
0
Jaakko Komulainen
On 6/18/14, 6:50 AM

You need to pass a list of ids containing those pos.order ids of which action_invoice you wish to call.

For example if you want to call action_invoice on pos.order with id of 1:

var model = new.istance.web.Model("pos.order");

model.call("action_invoice",[[1]]);

In the above example, first brackets after the method name contain arguments you wish to pass, inner brackets are for the list of ids.

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

2 follower(s)

Stats

Asked: 6/13/14, 10:25 AM
Seen: 810 times
Last updated: 3/16/15, 8:10 AM