t8('Sales Order'),
submit => [ '#form', { action => "sales_order" } ],
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
- only_if => $params{is_sales_quo},
+ only_if => $params{is_sales_quo} || $params{is_pur_ord},
],
action => [
t8('Purchase Order'),
submit => [ '#form', { action => "purchase_order" } ],
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
- only_if => $params{is_req_quo},
+ only_if => $params{is_sales_ord} || $params{is_req_quo},
],
action => [
t8('Delivery Order'),
t8('Quotation'),
submit => [ '#form', { action => "quotation" } ],
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
+ only_if => $params{is_sales_ord},
],
action => [
t8('Request for Quotation'),
submit => [ '#form', { action => "request_for_quotation" } ],
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
+ only_if => $params{is_pur_ord},
],
], # end of combobox "Workflow"
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
- $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
+ my $current_employee = SL::DB::Manager::Employee->current;
+ $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
+ $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
+ $form->{employee_id} ||= $current_employee->id;
+ $form->{salesman_id} ||= $current_employee->id;
# openclosed checkboxes
my @tmp;
if ($form->{resubmit} && ($form->{format} eq "html")) {
$dispatch_to_popup = "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';";
$dispatch_to_popup .= "document.do.submit();";
- } elsif ($form->{resubmit}) {
+ } elsif ($form->{resubmit} && $form->{action_print}) {
# emulate click for resubmitting actions
- $dispatch_to_popup = "document.oe.${_}.click(); " for grep { /^action_/ } keys %$form;
+ $dispatch_to_popup = "kivi.SalesPurchase.show_print_dialog(); kivi.SalesPurchase.print_record();";
} elsif ($creditwarning) {
$::request->{layout}->add_javascripts_inline("alert('$credittext');");
}