Push Odoo docs to Frappe Server

The module "push_to_frappe" will utilize Odoo's server action to push data over to Frappe server with ease.

 · 2 min read

The reason for this module, push_to_frappe, is the need to migrate some data from Odoo to Frappe/ERPNext. Instead of using excel to export/import data, we can utilized the awesome Odoo's server action to make this works fairly easy.

How to use?

Says, user want to push sales order(s) from Odoo to ERPNext, it should be as easy as,

  1. Select sales order(s) in Odoo
  2. Click Action > Send SO to Frappe
  3. Done, with the push results

How it works?

1. At Odoo, Install Odoo module push_to_frappe

2. At Odoo, setup system parameters for Frappe connection.

  • frappe.server.url: <server url, i.e., https://xxx.frappe.cloud>
  • frappe.auth.token: <API Key>:<API Secrit>

3. Both Odoo and Frappe, make sure that all required master data are in both Odoo and Frappe for the same name

If we want to push sales order, both system require same master data for a sales order, i.e., customer, product, account, etc. Of course, you can use this method to push master data from Odoo to Frappe too.

4. At Odoo, create server action to push sales order.

This is the main thing to do. We will create a server action for whatever document we want to transfer. This module already provide some example, sales order is one of them. In the real life, it is likely that you wil be creating your own server action, with following pattern.

  1. Target Frappe Doctype (target_doctype)
  2. Data Mapping as list of dict (target_docs)
  3. Call env['push.to.frappe'].push(target_doctype, target_docs, push_file=False)
  4. Crate contextual action for this action

Note: push_file = True if you push all attachments as well.

5. At Odoo, goto sales order window and click to send data to Frappe

System will send the sales order one by one, and give the results.

Click on frappe document link, to open it in Frappe.

Final notes

Thank you to Odoo's versaitle server action, and the simple API of Frappe that make this fairly easy to implement. As this is simply a server action, it is also possible to use it in Automated Action as well. Following will example ensure the push to frappe works whenever a sales order is created.

End.


No comments yet.

Add a comment
Ctrl+Enter to add comment