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

Call a new public method via xml rpc

By
Praveen
on 4/11/13, 10:45 AM 2,552 views

Hi , I want a new method which will update the customer total receivables (guess by creating the corresponding account.move objects) which has to be called via xml-rpc . Is there anything more to be done than making this method public and using XML RPC to invoke this method in the right resource with the right params . When I tried to do it ,it gave an error saying parameters not matching (expected min 5 but got only 4) My definition is something like -

 def update_customer_receivables(self, cr, uid, partner_id,amount,context=None):

And my java client looks something like this :

   Object args1[]={"partner_id","=",patientId};
    Object args2[]={"amount","=",amount};
    Vector params = new Vector();
    params.addElement(args1);
    params.addElement(args2);

And the call :

        Object args[]={database,id,password,resource,"update_customer_receivables",params};
          xmlRpcClient().execute("execute", args)

What am I missing ? Any help is appreciated

1

patrick

--patrick--
1958
| 5 4 7
Baarn, Netherlands
--patrick--
patrick
On 4/13/13, 8:32 AM

The procedure to let openERP know additional info:

  1. copy the module to the /addon directory
  2. restart openERP (or even the machine)
  3. update the module list (not always needed)
  4. install or upgrade the modified module

I think that you need to do 4 (and maybe 3 as well) in order for openERP to know the added (or changed) method.

Thanks .Guess in my case I also made a silly mistake .In the client I had been passing all the values as a single list .So I changed my method to something like " def update_customer_receivables(self, cr, uid, args,context=None):" where args is a 2 dimensional List .This fixed it

Praveen
on 4/15/13, 9:18 AM

If it is fixed, can you close this question?

patrick
on 4/24/13, 7:46 AM

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

0 follower(s)

Stats

Asked: 4/11/13, 10:45 AM
Seen: 2552 times
Last updated: 3/16/15, 8:10 AM