2

I've been trying to insert a sales order via Odoo's web API. The requirement of my clients is that he has an excel file and wants to import his sales order into Odoo. The only way I found was via the Web API. I've been reading and reading sadly did not encounter any specific relation on inserting a sales order with his sales details.

Note : The call of Odoo's Web API is written in python 3. I can connect to the Web API, I can view the sales order but sadly I'm not able to insert or rather I do not know the instructions to insert the sales Order and Details

[EDIT] :

id = proxy.execute_kw(self.Cnn.DATABASE, self.Cnn.USERID, self.Cnn.PASSWORD, TableName, 'create', ['name: New Sale Order'])

I request for your aids.

Sam
  • 85
  • 3
  • 16
  • You can create a custom add-on to insert sale order from python, python have many features to read excel or csv file, this way you can easily achive your goal, you can also use the import facility of Odoo. Odoo it self provides good function to import data into any model, for that you need to install base_import module. – Emipro Technologies Pvt. Ltd. Mar 25 '15 at 14:09

1 Answers1

4

As mentioned before you don't need to use the web API for what you're trying to do.

But this is how to create a sales order/quotation using the Odoo web services API (in PHP)

$new = $models->execute_kw($db, $uid, $password,
    'sale.order', 'create',
    array(array('partner_id'=> 6,
                'payment_term' => 1,    //immediate payment
                'medium_id' => 1
                )));

    echo 'created new sale order with id:' . $new;
Kevin Y
  • 133
  • 8
  • Hey @KevinY, I have run your code and return "created new sale order with id:11". But why when I check in sale_order table, there isn't new data inserted with id 11? – Peternak Kode Channel Jun 22 '16 at 08:58
  • It might be because the database name being used is different than the database you're using to check the sale_order table. – Ed Menendez Jun 13 '17 at 16:51