diff --git a/customer_itch_cycle/__manifest__.py b/customer_itch_cycle/__manifest__.py
index 2a99ccb..27d1fe4 100644
--- a/customer_itch_cycle/__manifest__.py
+++ b/customer_itch_cycle/__manifest__.py
@@ -16,13 +16,14 @@
'views/itch_cycle_product_partner_view.xml',
'views/res_partner_view.xml',
'views/product_category_view.xml',
+ 'views/itch_cycle_actions.xml',
+ 'views/itch_cycle_menu.xml',
'security/ir.model.access.csv'
],
'assets': {
'web.assets_backend': [
'customer_itch_cycle/static/src/js/cycle_product_partner_list_view.js',
'customer_itch_cycle/static/src/xml/process_history_button.xml',
-
],
},
'installable': True,
diff --git a/customer_itch_cycle/static/src/js/cycle_product_partner_list_view.js b/customer_itch_cycle/static/src/js/cycle_product_partner_list_view.js
index 1d3483c..55efb80 100644
--- a/customer_itch_cycle/static/src/js/cycle_product_partner_list_view.js
+++ b/customer_itch_cycle/static/src/js/cycle_product_partner_list_view.js
@@ -3,31 +3,29 @@
import { registry } from "@web/core/registry";
import { listView } from "@web/views/list/list_view";
import { ListController } from "@web/views/list/list_controller";
+import { useService } from "@web/core/utils/hooks";
class CycleProductPartnerListController extends ListController {
setup() {
super.setup();
- this.orm = this.env.services.orm; // Service ORM pour effectuer des appels RPC
+ this.orm = useService("orm");
+ this.notification = useService("notification");
}
async ProcessHistoryButton() {
try {
- // Appel RPC via le service ORM
await this.orm.call("itch.cycle.product.partner", "populate_from_past_orders", []);
- this.displayNotification({
+ this.notification.add("L'action a été exécutée avec succès.", {
type: "success",
- message: "L'action a été exécutée avec succès.",
});
} catch (error) {
- this.displayNotification({
+ this.notification.add(`Une erreur s'est produite : ${error.message}`, {
type: "danger",
- message: `Une erreur s'est produite : ${error.message}`,
});
}
}
}
-// Enregistrement de la vue personnalisée
registry.category("views").add("cycle_product_partner_list", {
...listView,
Controller: CycleProductPartnerListController,
diff --git a/customer_itch_cycle/views/itch_cycle_actions.xml b/customer_itch_cycle/views/itch_cycle_actions.xml
new file mode 100644
index 0000000..688aede
--- /dev/null
+++ b/customer_itch_cycle/views/itch_cycle_actions.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Product Cycle Management
+ itch.cycle.product.partner
+ tree,form
+
+
+
+
\ No newline at end of file
diff --git a/customer_itch_cycle/views/itch_cycle_menu.xml b/customer_itch_cycle/views/itch_cycle_menu.xml
index e69de29..9ea82d9 100644
--- a/customer_itch_cycle/views/itch_cycle_menu.xml
+++ b/customer_itch_cycle/views/itch_cycle_menu.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/customer_itch_cycle/views/itch_cycle_product_partner_view.xml b/customer_itch_cycle/views/itch_cycle_product_partner_view.xml
index da80ddf..c2433bb 100644
--- a/customer_itch_cycle/views/itch_cycle_product_partner_view.xml
+++ b/customer_itch_cycle/views/itch_cycle_product_partner_view.xml
@@ -76,18 +76,4 @@
-
-
- Product Cycle Management
- itch.cycle.product.partner
- tree,form
-
-
-
-
\ No newline at end of file