Commit 086a1ea0 by François C.

Aide à la commande: Option arrêt au stade Brouillon (pour besoin de La Chouette)

parent 3f1b6284
Pipeline #3370 failed with stage
in 1 minute 6 seconds
......@@ -308,11 +308,14 @@ class Order(models.Model):
api = OdooAPI()
id_po = api.create('purchase.order', order_data)
res_confirm = api.execute('purchase.order', 'button_confirm', [id_po])
confirmed = False
if getattr(settings, 'AUTO_CONFIRM_PURCHASE_ORDER', True) is True:
api.execute('purchase.order', 'button_confirm', [id_po])
confirmed = True
res = {
'id_po': id_po,
'confirm_po': True,
'confirm_po': confirmed,
'supplier_id': supplier_id,
'date_planned': date_planned
}
......
......@@ -1342,17 +1342,20 @@ function create_orders() {
});
let new_order_template = $("#templates #new_order_item_template");
new_order_template.find(".new_order_supplier_name").text(supplier_name);
new_order_template.find(".new_order_po").text(`PO${new_order.id_po}`);
new_order_template.find(".new_order_date_planned").text(`Date de livraison prévue: ${date_planned}`);
if (order_auto_confirm === true) {
new_order_template.find(".download_order_file_button").attr('id', `download_attachment_${new_order.id_po}`);
} else {
$('.download_order_file').remove()
}
$('#created_orders_area').append(new_order_template.html());
}
// Prepare buttons to download order attachment
get_order_attachments();
if (order_auto_confirm === true) get_order_attachments();
// Clear data
delete_cdb_order().finally(() => {
......
......@@ -22,6 +22,8 @@ def helper(request):
'db': settings.COUCHDB['dbs']['orders'],
'odoo_server': getattr(settings, 'ODOO_PUBLIC_URL', settings.ODOO['url']),
'metabase_url': getattr(settings, 'ORDERS_HELPER_METABASE_URL', ''),
'order_auto_confirm': getattr(settings, 'AUTO_CONFIRM_PURCHASE_ORDER', True),
'display_mail_example': getattr(settings, 'DISPLAY_PURCHASE_MAIL_EXAMPLE', True),
'nb_past_days_to_compute_sales_average': OdooAPI().get_system_param('lacagette_products.nb_past_days_to_compute_sales_average'),
'nb_of_consecutive_non_sale_days_considered_as_break': OdooAPI().get_system_param('lacagette_products.nb_of_consecutive_non_sale_days_considered_as_break')
}
......
......@@ -148,6 +148,7 @@
</div>
<div id="created_orders_area"></div>
<br/><br/><hr/><br/>
{% if display_mail_example %}
<div class="mail_example_container">
<p class="mail_type_text">Mail type :</p>
<div class="mail_example">
......@@ -161,6 +162,7 @@
Bonne journée
</div>
</div>
{% endif %}
</div>
<div id="templates" style="display:none;">
......@@ -369,6 +371,11 @@
var couchdb_server = '{{couchdb_server}}' + couchdb_dbname;
var odoo_server = '{{odoo_server}}';
var metabase_url = '{{metabase_url}}';
{% if order_auto_confirm %}
var order_auto_confirm = true;
{% else %}
var order_auto_confirm = false;
{% endif %}
</script>
<script src="{% static "js/all_common.js" %}?v=1651853225"></script>
<script type="text/javascript" src="{% static 'js/orders_helper.js' %}?v=1651853225"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment