'sales_quotation' => 'sales_quotation_edit',
};
+my $oe_view_access_map = {
+ 'sales_order' => 'sales_order_edit | sales_order_view',
+ 'purchase_order' => 'purchase_order_edit | purchase_order_view',
+ 'request_quotation' => 'request_quotation_edit | request_quotation_view',
+ 'sales_quotation' => 'sales_quotation_edit | sales_quotation_view',
+};
+
sub check_oe_access {
+ my (%params) = @_;
my $form = $main::form;
- my $right = $oe_access_map->{$form->{type}};
+ my $right = ($params{with_view}) ? $oe_view_access_map->{$form->{type}} : $oe_access_map->{$form->{type}};
$right ||= 'DOES_NOT_EXIST';
$main::auth->assert($right);
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- check_oe_access();
+ check_oe_access(with_view => 1);
if ($form->{type} eq 'purchase_order') {
$form->{vc} = 'vendor';
my $cgi = $::request->{cgi};
my %params = @_;
- check_oe_access();
+ check_oe_access(with_view => 1);
my $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
$::dispatcher->end_request;
}
- _oe_remove_delivered_or_billed_rows(id => $form->{id}, type => 'billed');
+ _oe_remove_delivered_or_billed_rows(id => $form->{id}, type => 'billed') if $form->{new_invoice_type} ne 'final_invoice';
$form->{cp_id} *= 1;
if ( $form->{type} eq 'sales_order'
|| $form->{type} eq 'sales_quotation') {
- $form->{title} = ($form->{new_invoice_type} eq 'invoice_for_advance_payment')
- ? $locale->text('Add Invoice for Advance Payment')
+ $form->{title} = ($form->{new_invoice_type} eq 'invoice_for_advance_payment') ? $locale->text('Add Invoice for Advance Payment')
+ : ($form->{new_invoice_type} eq 'final_invoice') ? $locale->text('Add Final Invoice')
: $locale->text('Add Sales Invoice');
$form->{script} = 'is.pl';
$script = "is";