Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,11 @@ public abstract class BaseRouteIntegrationTest {

private static final String odooCustomerDobField = "x_customer_dob";

protected static final List<String> orderDefaultAttributes = asList(
"id",
"client_order_ref",
"partner_id",
"state",
"order_line",
odooCustomerWeightField,
odooCustomerDobField);
protected static final List<String> orderDefaultAttributes =
asList("id", "client_order_ref", "partner_id", "state", "order_line");

protected static final List<String> partnerDefaultAttributes =
asList("id", "name", "ref", "street", "street2", "city", "zip", "active", "comment", odooCustomerDobField);
asList("id", "name", "ref", "street", "street2", "city", "zip", "active", "comment");

protected WireMockServer wireMockServer = new WireMockServer(8080);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public void shouldCreateSaleOrderInOdooGivenMedicationRequestBundle() {
assertNotNull(createdSaleOrder);
assertEquals(ENCOUNTER_PART_OF_UUID, createdSaleOrder.getOrderClientOrderRef());
assertEquals("draft", createdSaleOrder.getOrderState());
assertEquals("77.0 kg", createdSaleOrder.getPartnerWeight());
assertEquals("1984-01-01", createdSaleOrder.getPartnerBirthDate());
// assertEquals("77.0 kg", createdSaleOrder.getPartnerWeight());
// assertEquals("1984-01-01", createdSaleOrder.getPartnerBirthDate());

// verify sale order has sale order line
assertFalse(createdSaleOrder.getOrderLine().isEmpty());
Expand Down Expand Up @@ -191,7 +191,7 @@ public void shouldCreateSaleOrderWithoutPatientWeightInOdooGivenMedicationReques
assertNotNull(createdSaleOrder);
assertEquals(ENCOUNTER_PART_OF_UUID, createdSaleOrder.getOrderClientOrderRef());
assertEquals("draft", createdSaleOrder.getOrderState());
assertEquals("false", createdSaleOrder.getPartnerWeight());
// assertEquals("false", createdSaleOrder.getPartnerWeight());

// verify sale order has sale order line
assertFalse(createdSaleOrder.getOrderLine().isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void shouldCreatePartnerInOdooGivenFhirPatient() {
assertEquals(PATIENT_1_UUID, createdPartner.getPartnerRef());
assertEquals("City2062", createdPartner.getPartnerCity());
assertEquals(PATIENT_IDENTIFIER_1_VALUE, createdPartner.getPartnerComment());
assertEquals("1939-02-14", createdPartner.getPartnerBirthDate());
// assertEquals("1939-02-14", createdPartner.getPartnerBirthDate());
}

@Test
Expand Down Expand Up @@ -139,7 +139,7 @@ public void shouldUpdatePartnerInOdooGivenFhirPatient() {
assertEquals(PATIENT_2_UUID, updatedPartner.getPartnerRef());
assertEquals("Nairobi", updatedPartner.getPartnerCity());
assertEquals(PATIENT_IDENTIFIER_2_VALUE, updatedPartner.getPartnerComment());
assertEquals("2019-09-25", updatedPartner.getPartnerBirthDate());
// assertEquals("2019-09-25", updatedPartner.getPartnerBirthDate());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public void shouldCreateSaleOrderInOdooGivenServiceRequestBundle() {
assertNotNull(createdSaleOrder);
assertEquals(ENCOUNTER_PART_OF_UUID, createdSaleOrder.getOrderClientOrderRef());
assertEquals("draft", createdSaleOrder.getOrderState());
assertEquals("77.0 kg", createdSaleOrder.getPartnerWeight());
assertEquals("1984-01-01", createdSaleOrder.getPartnerBirthDate());
// assertEquals("77.0 kg", createdSaleOrder.getPartnerWeight());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on why this is commented. Add a Todo item so that we remember to uncomment later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better we revert this commit as soon as the release PR is in. WDYT?

// assertEquals("1984-01-01", createdSaleOrder.getPartnerBirthDate());

// verify sale order has sale order line
assertFalse(createdSaleOrder.getOrderLine().isEmpty());
Expand Down Expand Up @@ -192,7 +192,7 @@ public void shouldCreateSaleOrderWithoutPatientWeightInOdooGivenServiceRequestBu
assertNotNull(createdSaleOrder);
assertEquals(ENCOUNTER_PART_OF_UUID, createdSaleOrder.getOrderClientOrderRef());
assertEquals("draft", createdSaleOrder.getOrderState());
assertEquals("false", createdSaleOrder.getPartnerWeight());
// assertEquals("false", createdSaleOrder.getPartnerWeight());

// verify sale order has sale order line
assertFalse(createdSaleOrder.getOrderLine().isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.ozonehis.eip.odoo.openmrs.client;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.lang.reflect.Field;
Expand Down Expand Up @@ -36,7 +37,7 @@ public <T> T convertToObject(Map<String, Object> data, Class<T> objectClass) {
T obj = mapper.convertValue(data, objectClass);

for (Field field : obj.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(JsonProperty.class)) {
if (field.isAnnotationPresent(JsonProperty.class) && !field.isAnnotationPresent(JsonIgnore.class)) {
JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class);
String propertyValue = environment.getProperty(jsonProperty.value());
if (propertyValue != null && data.containsKey(propertyValue)) {
Expand All @@ -59,7 +60,7 @@ public Map<String, Object> convertObjectToMap(Object object) throws Exception {

for (Field field : fields) {
field.setAccessible(true);
if (field.isAnnotationPresent(JsonProperty.class)) {
if (field.isAnnotationPresent(JsonProperty.class) && !field.isAnnotationPresent(JsonIgnore.class)) {
JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class);
String propertyValue = environment.getProperty(jsonProperty.value());
String key = propertyValue == null ? jsonProperty.value() : propertyValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public class PartnerHandler {
public List<String> partnerDefaultAttributes;

public Partner getPartnerByID(String partnerRefID) {
partnerDefaultAttributes = asList(
"id", "name", "ref", "street", "street2", "city", "zip", "active", "comment", odooCustomerDobField);
partnerDefaultAttributes = asList("id", "name", "ref", "street", "street2", "city", "zip", "active", "comment");
Object[] records = odooClient.searchAndRead(
Constants.PARTNER_MODEL, List.of(asList("ref", "=", partnerRefID)), partnerDefaultAttributes);
if (records == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,7 @@ public class SaleOrderHandler {
public List<String> orderDefaultAttributes;

public SaleOrder getDraftSaleOrderIfExistsByVisitId(String visitId) {
orderDefaultAttributes = asList(
"id",
"client_order_ref",
"partner_id",
"state",
"order_line",
odooCustomerWeightField,
odooCustomerDobField);
orderDefaultAttributes = asList("id", "client_order_ref", "partner_id", "state", "order_line");
Object[] records = odooClient.searchAndRead(
Constants.SALE_ORDER_MODEL,
List.of(asList("client_order_ref", "=", visitId), asList("state", "=", "draft")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.ozonehis.eip.odoo.openmrs.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -56,5 +57,6 @@ public class Partner implements OdooResource {
private String partnerComment; // Stores Patient Identifier

@JsonProperty("odoo.customer.dob.field")
@JsonIgnore
private String partnerBirthDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.ozonehis.eip.odoo.openmrs.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
Expand Down Expand Up @@ -39,8 +40,10 @@ public class SaleOrder implements OdooResource {
private String orderTypeName;

@JsonProperty("odoo.customer.weight.field")
@JsonIgnore
private String partnerWeight;

@JsonProperty("odoo.customer.dob.field")
@JsonIgnore
private String partnerBirthDate;
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<fhir-r4.version>7.0.0</fhir-r4.version>
<openmrs.fhir.version>4.0.0-SNAPSHOT</openmrs.fhir.version>
<test.containers.version>1.19.3</test.containers.version>
<ozone.version>1.0.0-SNAPSHOT</ozone.version>
<ozone.version>1.0.0-alpha.11</ozone.version>
<skipTests>false</skipTests>
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
Expand Down
Loading