From c4bb14d6b8ce4907be2d060d2b85a4eab5e18fd0 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sat, 6 Feb 2010 08:53:03 +0100 Subject: [PATCH] Einkaufspreis bei Einkaufsauftrag aus Verkaufsauftrag MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Generiert man im Workflow aus einem Kundenauftrag einen Lieferantenauftrag so sollte als Verkaufspreis nicht der Verkaufspreis aus dem Verkaufsauftrag sondern der Einkaufspreis für die Waren in der Maske gesetzt werden. --- bin/mozilla/oe.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 9cc570ace..d8f4415a4 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1688,7 +1688,9 @@ sub purchase_order { check_oe_access(); $main::auth->assert('purchase_order_edit'); + $form->{sales_order_to_purchase_order} = 0; if ($form->{type} eq 'sales_order') { + $form->{sales_order_to_purchase_order} = 1; check_for_direct_delivery(); } @@ -1706,6 +1708,8 @@ sub purchase_order { &poso; + delete $form->{sales_order_to_purchase_order}; + $main::lxdebug->leave_sub(); } @@ -1754,8 +1758,14 @@ sub poso { $form->{old_salesman_id} = $form->{salesman_id}; # reset - map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered - ordnumber); + map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber); + + # if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i + if ( $form->{sales_order_to_purchase_order} ) { + for my $i (1 .. $form->{rowcount}) { + $form->{"sellprice_${i}"} = $form->parse_amount(\%myconfig, $form->{"lastcost_${i}"}); + }; + }; for my $i (1 .. $form->{rowcount}) { map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount); -- 2.20.1