Odoo customer creation fails on sync from openmrs, if state is not predefined for the country in context

Description

When we create a patient in OpenMRS, then a corresponding customer created in Odoo. In this process, the patient addresses are also mapped in Odoo.

If Odoo is configured for a "country" for which there states already loaded in "res_country_state", and the "state" mentioned for the patient exists in the "country state" list in Odoo, then it works fine.

If not, then the Bahmni-odoo module tries to create the state (and district and level 3) for the country. The "state" to be created needs a "code" (e.g. for Karantaka State - it may be KA). Without which the patient sync fails as it fails to create the state.

Technical:
1. Document in WIKI, that implementers need to upload/create States for the Country is context, and they need to be same (Text, spelling etc) in OpenMRS. This way, they can define a State Code (in India, we have similar codes for states, same in many other countries)
2. Introduce a configuration in Odoo that mentions whether custom address levels are to be automatically created if not found. (applies for State/Province, District/County, Level 3). If configuration is false, do not create address levels.
3. If the configuration is set to true, then create state with code - UNKNOWN.

Assignee

Angshuman Sarkar

Reporter

Angshuman Sarkar

Labels

None

Units

None

PercentDone

None

DueTime

None

Clients

None

External issue ID

None

UAT Assignee

None

Reviewer

None

Components

Sprint

Fix versions

Configure