@alien4u I think you need to set
promo_rec.setValue({fieldId:'discounttype', value:'flat'});
to a different value to flat, flat is for flat rate, probably easily ascertained by creating a percentage based discount and looking at the underlying values.