diff --git a/loko/common/static/common/base_style.css b/loko/common/static/common/base_style.css index 5e005f1..84d1237 100644 --- a/loko/common/static/common/base_style.css +++ b/loko/common/static/common/base_style.css @@ -571,4 +571,13 @@ label, .text-status-validated { color: #388e3c !important; } .text-status-invoiced { color: #738f7a !important; } .text-status-closed { color: #09425f !important; } -.text-status-canceled { color: #cfd8dc !important; } \ No newline at end of file +.text-status-canceled { color: #cfd8dc !important; } + +/* Badge & utilitaire Indigo (destinations externes, tiers, partenaires) */ +.badge-indigo { + background-color: #6610f2 !important; + color: #ffffff !important; +} +.bg-indigo { + background-color: #6610f2 !important; +} \ No newline at end of file diff --git a/loko/mobile/templates/mobile/mobile_base.html b/loko/mobile/templates/mobile/mobile_base.html index f08c817..e89b9ee 100644 --- a/loko/mobile/templates/mobile/mobile_base.html +++ b/loko/mobile/templates/mobile/mobile_base.html @@ -19,6 +19,13 @@ :root { --brand-color: #0f172a; } + .badge-indigo { + background-color: #6610f2 !important; + color: #ffffff !important; + } + .bg-indigo { + background-color: #6610f2 !important; + } body { padding-top: 4.5rem; padding-bottom: 3.5rem; diff --git a/loko/stock/models.py b/loko/stock/models.py index 5683961..9529dbe 100644 --- a/loko/stock/models.py +++ b/loko/stock/models.py @@ -2441,6 +2441,11 @@ class ProductionOrder(models.Model): verbose_name = _("Bon de confection") verbose_name_plural = _("Bons de confection") + @property + def is_external(self): + """Retourne True si le bon de confection est destiné à l'usage externe.""" + return self.destination == self.DESTINATION_EXTERNAL + @property def is_reopened(self): """Retourne True si le bon a été réouvert et est actuellement en cours ou à traiter.""" diff --git a/loko/stock/templates/stock/mobile/stock_preparation_order_detail_mobile.html b/loko/stock/templates/stock/mobile/stock_preparation_order_detail_mobile.html index 3860019..4adacfa 100644 --- a/loko/stock/templates/stock/mobile/stock_preparation_order_detail_mobile.html +++ b/loko/stock/templates/stock/mobile/stock_preparation_order_detail_mobile.html @@ -365,8 +365,13 @@ {% if item_data.production_order %}
+ class="btn btn-sm btn-outline-secondary py-0 px-2 d-inline-flex align-items-center" style="font-size:0.78rem;"> {{ item_data.production_order.code }} + {% if item_data.production_order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} {{ item_data.production_order.get_status_display }}
@@ -406,8 +411,13 @@ {% if oi_data.production_order %}
+ class="btn btn-sm btn-outline-secondary py-0 px-2 d-inline-flex align-items-center" style="font-size:0.78rem;"> {{ oi_data.production_order.code }} + {% if oi_data.production_order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} {{ oi_data.production_order.get_status_display }}
diff --git a/loko/stock/templates/stock/mobile/stock_production_order_detail_mobile.html b/loko/stock/templates/stock/mobile/stock_production_order_detail_mobile.html index f0c7553..669646b 100644 --- a/loko/stock/templates/stock/mobile/stock_production_order_detail_mobile.html +++ b/loko/stock/templates/stock/mobile/stock_production_order_detail_mobile.html @@ -47,7 +47,14 @@
-
{{ order.code }}
+
+ {{ order.code }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} +
{{ order.created_at|date:"d/m/Y H:i" }}
@@ -94,9 +101,9 @@ {% translate "Destination" %} {% if order.destination == 'internal' %} - {% translate "Interne" %} + {% translate "Interne" %} {% else %} - {% translate "Externe" %} + {% translate "Externe" %} {% endif %}
diff --git a/loko/stock/templates/stock/mobile/stock_production_orders_mobile.html b/loko/stock/templates/stock/mobile/stock_production_orders_mobile.html index 944ae0d..36a2583 100644 --- a/loko/stock/templates/stock/mobile/stock_production_orders_mobile.html +++ b/loko/stock/templates/stock/mobile/stock_production_orders_mobile.html @@ -144,8 +144,13 @@
-
+
{{ order.code|default:order.id }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %}
@@ -155,10 +160,6 @@ {% translate "Interne" %} - {% else %} - - {% translate "Externe" %} - {% endif %}
diff --git a/loko/stock/templates/stock/preparation_order_detail.html b/loko/stock/templates/stock/preparation_order_detail.html index 66575e4..77e5276 100644 --- a/loko/stock/templates/stock/preparation_order_detail.html +++ b/loko/stock/templates/stock/preparation_order_detail.html @@ -436,6 +436,11 @@ class="btn btn-sm {% if item_data.production_order.status == 'completed' %}btn-outline-success{% elif item_data.production_order.status == 'in_production' %}btn-outline-primary{% elif item_data.production_order.status == 'cancelled' %}btn-outline-danger{% elif item_data.production_order.status == 'draft' %}btn-outline-secondary{% else %}btn-outline-warning{% endif %}" title="{{ item_data.production_order.get_status_display }}"> {{ item_data.production_order.code }} + {% if item_data.production_order.destination == 'external' %} + + + + {% endif %}
{% elif can_manage and preparation_order.status != 'processed' and preparation_order.status != 'cancelled' %} @@ -560,6 +565,11 @@ class="btn btn-sm {% if oi_data.production_order.status == 'completed' %}btn-outline-success{% elif oi_data.production_order.status == 'in_production' %}btn-outline-primary{% elif oi_data.production_order.status == 'cancelled' %}btn-outline-danger{% elif oi_data.production_order.status == 'draft' %}btn-outline-secondary{% else %}btn-outline-warning{% endif %}" title="{{ oi_data.production_order.get_status_display }}"> {{ oi_data.production_order.code }} + {% if oi_data.production_order.destination == 'external' %} + + + + {% endif %} {% else %} {{ order.code }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} {{ order.warehouse.name }} {{ order.quantity }} diff --git a/loko/stock/templates/stock/production_order_detail.html b/loko/stock/templates/stock/production_order_detail.html index e8fcaa6..571460b 100644 --- a/loko/stock/templates/stock/production_order_detail.html +++ b/loko/stock/templates/stock/production_order_detail.html @@ -10,9 +10,13 @@
-

- - {% translate "Bon de confection" %} {{ order.code }} +

+ {% translate "Bon de confection" %} {{ order.code }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %}

{{ order.created_at|date:"d/m/Y H:i" }} @@ -123,11 +127,11 @@ {% translate "Destination" %} {% if order.destination == 'internal' %} - - {% translate "Interne" %} + + {% translate "Interne" %} {% else %} - + {% translate "Externe" %} {% endif %} diff --git a/loko/stock/templates/stock/production_order_list.html b/loko/stock/templates/stock/production_order_list.html index c7b1b18..f8cf200 100644 --- a/loko/stock/templates/stock/production_order_list.html +++ b/loko/stock/templates/stock/production_order_list.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base.html" %} {% load static %} {% load i18n %} @@ -69,6 +69,11 @@ {{ order.code }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} diff --git a/loko/stock/templates/stock/stock_movements.html b/loko/stock/templates/stock/stock_movements.html index d9702b5..a5280f6 100644 --- a/loko/stock/templates/stock/stock_movements.html +++ b/loko/stock/templates/stock/stock_movements.html @@ -374,14 +374,18 @@ {{ order.code|default:order.pk }} + {% if order.destination == 'external' %} + + {% translate "Externe" %} + + {% endif %} + {{ order.get_status_display }} {% if order.destination == 'internal' %} {% translate "Interne" %} - {% else %} - {% translate "Externe" %} {% endif %} {% if order.preparation_order %} diff --git a/loko/stock/tests.py b/loko/stock/tests.py index 1fe8d36..3bf2e65 100644 --- a/loko/stock/tests.py +++ b/loko/stock/tests.py @@ -530,11 +530,17 @@ class PreparationOrderPriorityTests(TestCase): self.assertIn(order1, list(response.context["production_orders"])) self.assertNotIn(order2, list(response.context["production_orders"])) + # Property is_external + self.assertTrue(order2.is_external) + self.assertFalse(order1.is_external) + # Search filter response = self.client.get(reverse("mobile:stock_production_orders_mobile") + "?q=Potelet") self.assertEqual(response.status_code, 200) self.assertIn(order2, list(response.context["production_orders"])) self.assertNotIn(order1, list(response.context["production_orders"])) + self.assertContains(response, "#6610f2") + self.assertContains(response, "bi-truck") def test_production_order_display_output_product_name(self): from .models import ProductionOrder, Warehouse, Product