js work
This commit is contained in:
parent
3ba182fe0e
commit
d644841f99
5 changed files with 28 additions and 22 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
11
customer_itch_cycle/views/itch_cycle_actions.xml
Normal file
11
customer_itch_cycle/views/itch_cycle_actions.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="action_cycle_product_partner" model="ir.actions.act_window">
|
||||
<field name="name">Product Cycle Management</field>
|
||||
<field name="res_model">itch.cycle.product.partner</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_cycle_product_partner_tree"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<menuitem id="menu_itch_cycle_product_root"
|
||||
name="Product Cycle"
|
||||
sequence="5"
|
||||
parent="sale.menu_sale_report"
|
||||
action="action_cycle_product_partner"/>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -76,18 +76,4 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_cycle_product_partner" model="ir.actions.act_window">
|
||||
<field name="name">Product Cycle Management</field>
|
||||
<field name="res_model">itch.cycle.product.partner</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_cycle_product_partner_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_itch_cycle_product_root"
|
||||
name="Product Cycle"
|
||||
|
||||
sequence="5"
|
||||
parent="sale.menu_sale_report"
|
||||
action="action_cycle_product_partner"/>
|
||||
</odoo>
|
||||
Loading…
Reference in a new issue