2
votes

I am working on the android application that connects to Odoo(OpenErp 8).In my application I want to have a button and when I click the button I want the "produce" button in Manufacturing module in Odoo to be clicked as well. How can I do that?

4

4 Answers

0
votes

Hello i found a solution for that i have made a odoo client connector using json RPC. https://github.com/GauravSahu/odoo-client-JSON-RPC
in odoo.js you can put your function and using following string you can call

client_req = {
"opts" : {
    "login" : "admin",
        "password" : "123",
        "db" : "test",
        "host": "localhost",
        "port": "8069"
},
"moduleDetail" : {
    "model" : "hr.employee",
    "method" : "create",
    "args" : {
        "name" : "Gaurav"
    },
    "filter" : "",
    "fields" : "",
    "domain" : "",
    "offset" : "",
    "limit" : "",
    "sort" : "",
    "resource_id":""
}

}

Here create function called...

0
votes

You have to call the action_produce method from mrp. Just called it in same way as you call the other objects like create, search etc with the required params.

def action_produce(self, cr, uid, production_id, production_qty, production_mode, wiz=False, context=None):
...

It might also necessary to trigger the signal to follow the workflow properly otherwise I think your workflow will be broken. Here is how you can call the work for produce.

self.signal_workflow(cr, uid, [production_id], 'button_produce')
0
votes

As in Odoo buttons are either action or object. So you can make RPC call to call that method which is call through the "Produce" button.

0
votes

The Produce button opens a wizard and let you choose the mode, quantity and the products to consume then you need to confirm your choice by clicking on confirm button, So you have to show a similar wizard to the user and use an AsynchTask class to call confirm button in background.

  • Add `mrp_product_produce` and `mrp_product_produce_line` to your models.
  • Add an activity to show the values like on odoo server.
  • The click on `confim` button should call `do_produce` present in `mrp.product.produce` like they did at SalesDetail.