- if (!exists $entry->{raw_data}->{is_sales}) {
- $entry->{object}->is_sales(!!$entry->{object}->customer_id);
+ if (!exists $entry->{raw_data}->{order_type}) {
+ # if no type is present - set to sales delivery order or purchase delivery
+ # order depending on is_sales or customer/vendor
+
+ $entry->{object}->order_type(
+ $entry->{object}->customer_id ? SALES_DELIVERY_ORDER_TYPE :
+ $entry->{object}->vendor_id ? PURCHASE_DELIVERY_ORDER_TYPE :
+ $entry->{raw_data}->{is_sales} ? SALES_DELIVERY_ORDER_TYPE :
+ PURCHASE_DELIVERY_ORDER_TYPE
+ );