Patient's/Doctor Relationship type (Doctor's name) sync from openmrs to odoo sync in bahmni?


How can we sync the patient/doctor relationship(doctor’s name) from openmrs to odoo same like provider’s name which is being synced in sales quotation in Odoo ? Is there any generic way to get doctors name printed in sales quotation invoice/table?? Any idea would be appreciated.


You can do that in Quotation/Sale order. You need to modify the report template “report_saleorder_document” and add the field “provider_name”. And the print will show the field.

However, we do not carry forward the “provider_name” to the “account.invoice” model. So that will require some custom work

  1. Carry forward “provider_name” in the account.invoice model - (Not preferred)
  2. account.invoice model has source document (SO) attached (account.invoice.origin field) - and you can probably create a sub-view to fetch the details from the origin Sale Order.

@anandpatel 2 should be doable without bahmni odoo module code change?

This is what you can do.

  1. Go to “menu / settings / technical / user interface / views” and search for “account.report_invoice_document” and edit that.
  2. Add code snippet like below (say after the source field’s div element)
<div name="provider_name" class="col-xs-2" t-if="o.origin">
  <t t-foreach="request.env['sale.order'].search([('name', '=', o.origin)])" t-as="obj">
     <p t-field="obj.provider_name"/>

Note: the above assumes the source of the invoice is a sale order.

It works for me. Some might object to make “request.env” call in QWeb views. Alternatively, you can figure out what is the model, add a method in there, and call the method for the view template.

I am no expert on Odoo, but @anandpatel @ramashish can verify if this the correct way.

Thank you for your reply,

Actually what i am trying to do is to track the respective registration fees is associated to respective doctor so to track the doctors registration fee. Any idea would be great.