Odoo Frappe Print Form

Use odoo module "report_frappe" to utilize frappe report builder for Odoo form printout

 · 2 min read

Odoo's module report_frppe will act as the bridge between Odoo and Frappe Server.

How it works?

  1. From Odoo, click print (report action) on a document, Odoo will formulate data of that document.
  2. Call Frappe API and send to a Doctype document
  3. Frappe will create PDF of that document
  4. Send PDF file back to Odoo.

1. In Odoo, install module.

2. In Frappe, create an Authentication Token.

Click Generate Keys

token = <API Key>:<API Secret>

3. In Odoo, setup auth token and frappe server in system params.

4. In Frappe, create Doctype (model) data place holder.

For example, Odoo model purchase.order and purchase.order.line, can be represented as 2 Doctypes in Frappe

  1. Odoo PO (as normal doctype)
  2. Odoo PO Line (as child doctype)

With Doctype created, now user can test adding data manually as a PO

5. In Frappe, use Print Format to create form printout.

Click print. Without doing anything yet, Standard print format is ready to use (based on Doctype layout)

To add more Print Format, click Try the new Print Format Builder to Create new or Edit the existing

Print Format come with drag and drop features.

User can always go to Print Format doctype to see all print formats.

Note: now we have following information ready to set report action in Odoo.

  • DocType = Odoo PO
  • Print Format = My PO Form
  • Letter Head = Ecosoft

6. In Odoo, create report action.

Create as following, the important part is how to map data in python.

{
  'odoo_ref': object.name,
  'vendor': object.partner_id.name,
  'confirmation_date': object.date_approve.strftime("%Y-%m-%d %H:%M:%S"),
  'order_lines': [{
    'product_description': x.name,
    'quantity': x.product_qty,
    'unit_price': x.price_unit,
    'subtotal': x.price_subtotal
  } for x in object.order_line],
  'notes': object.notes,
  'total': object.amount_total
}

Note: When ready, make sure to add print menu

7. In Odoo, test the printout.

You can now print form as normal. Internally, it now connect to frappe server to print form.


No comments yet.

Add a comment
Ctrl+Enter to add comment