DeliveryOrder: typ checks im javascript
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 1 Oct 2021 15:39:02 +0000 (17:39 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 13:53:49 +0000 (14:53 +0100)
js/kivi.DeliveryOrder.js

index f90184f..1552616 100644 (file)
@@ -521,7 +521,7 @@ namespace('kivi.DeliveryOrder', function(ns) {
     var vc;
     var vc_id;
     var title;
-    if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
+    if ($('#order_customer_id').val()) {
       vc    = 'customer';
       vc_id = $('#order_customer_id').val();
       title = kivi.t8('Customer details');
@@ -704,21 +704,13 @@ namespace('kivi.DeliveryOrder', function(ns) {
 });
 
 $(function() {
-  if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
-    $('#order_customer_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
-  } else {
-    $('#order_vendor_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
-  }
+  $('#order_customer_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
+  $('#order_vendor_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
 
   $('#order_currency_id').change(kivi.DeliveryOrder.update_exchangerate);
   $('#order_transdate_as_date').change(kivi.DeliveryOrder.update_exchangerate);
   $('#order_exchangerate_as_null_number').change(kivi.DeliveryOrder.exchangerate_changed);
 
-  if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
-    $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
-  } else {
-    $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.lastcost, -2)) });
-  }
   $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_description').val(o.description) });
   $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_unit').val(o.unit) });