- my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval :
- $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1;
- $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)) if !$self->order->reqdate;
+ my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval :
+ $self->type eq sales_order_type() ? $::instance_conf->get_delivery_date_interval : 1;
+
+ if ( ($self->type eq sales_order_type() && $::instance_conf->get_deliverydate_on)
+ || ($self->type eq sales_quotation_type() && $::instance_conf->get_reqdate_on)
+ && (!$self->order->reqdate)) {
+ $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days));
+ }