| 1 | import { |
| 2 | NewContentSystrayItem, |
| 3 | MODULE_STATUS, |
| 4 | } from "@website/client_actions/website_preview/new_content_systray_item"; |
| 5 | import { rpc } from "@web/core/network/rpc"; |
| 6 | import { patch } from "@web/core/utils/patch"; |
| 7 | |
| 8 | patch(NewContentSystrayItem.prototype, { |
| 9 | setup() { |
| 10 | super.setup(); |
| 11 | |
| 12 | const newJobElement = this.state.newContentElements.find(element => element.moduleXmlId === 'base.module_website_hr_recruitment'); |
| 13 | newJobElement.createNewContent = () => this.createNewJob(); |
| 14 | newJobElement.status = MODULE_STATUS.INSTALLED; |
| 15 | newJobElement.model = 'hr.job'; |
| 16 | }, |
| 17 | |
| 18 | async createNewJob() { |
| 19 | const url = await rpc('/jobs/add'); |
| 20 | this.website.goToWebsite({ path: url, edition: true }); |
| 21 | }, |
| 22 | }); |