ODOO 10 - Testing - Missing res_partner_attributes model

(Ramashish Joshi) #1

Earlier version (7.0) had res_partner_attributes model (corresponding table res.partner.attributes) which is missing from ODOO 10. This was used to sync OpenMRS Person Attributes with ERP.

Also the related code to create Person Attributes in ERP is missing from /opt/bahmni-erp/bahmni-addons/bahmni_atom_feed/models/

What is our strategy to sync OpenMRS Person Attributes in ERP?

(Angshuman Sarkar) #2

We should do that. Do you think you can contribute this or port the existing module in Odoo 10?

(Ramashish Joshi) #3

In our local implementation we synced person attributes in res_partner by adding this after line #139 (after fetching address_details) in _get_customer_vals in /opt/bahmni-erp/bahmni-addons/bahmni_atom_feed/models/atom_event_worker.py

attributes = vals.get("attributes", "{}")
attribute_details = self._create_or_update_person_attributes(json.loads(attributes))

And added a new function to fetch person attributes from sync data

def _create_or_update_person_attributes(self, attributes):
    res_attributes = {}
    for key in attributes:
        res_attributes.update({'x_'+key : attributes[key]})
    return res_attributes

So if any specific person attribute needs to be synced then a custom field should be created in res_partner as x_<openmrs person attribute name> and it should sync with the above code.

But we can always move person attributes in separate model as earlier res_partner_attributes.

(Angshuman Sarkar) #4

Can you create a JIRA card and raise a PR?

(Angshuman Sarkar) #5

@ramashish the JIRA card for this is BAH-808. Can you please raise a PR for this?