Bug 25655: Select currency and prefill unitprice with previous receipt
In case of partial order we want to prefill the unit price and the currency with the value of the previous receipt. Sponsored-by: The Research University in the Helmholtz Association (KIT) Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
fb0e6a20f8
commit
a5d214bd78
1 changed files with 15 additions and 3 deletions
|
@ -429,12 +429,20 @@
|
|||
</li>
|
||||
<li id="select_currency">
|
||||
<label for="invoice_unitprice"></label>
|
||||
<input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="" />
|
||||
<input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="[% order.invoice_unitprice | $Price on_editing => 1 %]" />
|
||||
[% IF currencies.count %]
|
||||
<select name="invoice_currency">
|
||||
<option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
|
||||
[% IF order.invoice_currency == active_currency.currency %]
|
||||
<option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
|
||||
[% ELSE %]
|
||||
<option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
|
||||
[% END %]
|
||||
[% FOR currency IN currencies %]
|
||||
<option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
|
||||
[% IF order.invoice_currency == currency.currency %]
|
||||
<option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]" selected="selected">[% currency.currency | html %] ([% currency.symbol | html %])</option>
|
||||
[% ELSE %]
|
||||
<option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
[% END %]
|
||||
|
@ -607,6 +615,10 @@
|
|||
}
|
||||
}).change();
|
||||
|
||||
[% IF order.invoice_unitprice %]
|
||||
$("input[name='change_currency']").click().trigger('change');
|
||||
[% END %]
|
||||
|
||||
function update_unitprice() {
|
||||
var rate = Number($("select[name='invoice_currency'] option:selected").data('rate'));
|
||||
var unitprice = $("#invoice_unitprice").val();
|
||||
|
|
Loading…
Reference in a new issue