eo_facture: reload new bill form when client is selected (#60970)

This commit is contained in:
Pierre Ducroquet 2022-12-06 10:14:05 +01:00
parent 590d5f1625
commit 74810b68d5
1 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,23 @@
{% extends "admin/change_form.html" %}
{% load admin_urls i18n %}
{% block extrahead %}{{ block.super }}
{% if not change and not original.client %}
<script type="text/javascript">
window.addEventListener("load", function(){
let client_selector = document.getElementById("id_client");
client_selector.onchange = function() {
if (client_selector.value) {
let new_url = window.location.origin + "{% url "admin:eo_facture_facture_add" %}?client=" + client_selector.value;
if (new_url != window.location)
window.location = new_url;
}
};
});
</script>
{% endif %}
{% endblock %}
{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">