first push message

This commit is contained in:
2026-07-01 14:41:49 +07:00
parent 6667dec2bf
commit 58b5f46cc4
2951 changed files with 316619 additions and 0 deletions
@@ -0,0 +1,56 @@
/** @odoo-module **/
/**
* Odoo 19 upgrade notes for ks_gantt_controller.js:
*
* 1. BlockUI: in Odoo 18/19, BlockUI is no longer a manually instantiated
* class — it is managed by the `ui` service. Replaced with the `ui`
* service's `block()` / `unblock()` calls.
*
* 2. crash_manager: removed in Odoo 17+. Errors are handled through the
* notification service or simply re-thrown. Removed the crash_manager call.
*
* 3. download(): stable in Odoo 19 — no changes needed.
*
* 4. patch() API: stable in Odoo 19 — no changes needed.
*/
import { KsGanttController } from "@ks_gantt_view_base/js/ks_gantt_controller_new";
import { patch } from "@web/core/utils/patch";
import { download } from "@web/core/network/download";
import { useService } from "@web/core/utils/hooks";
patch(KsGanttController.prototype, {
setup() {
super.setup();
// Capture the ui service for block/unblock during export
this._uiService = useService("ui");
},
async _ksExportReport(ev) {
const ks_report_type = ev.currentTarget.getAttribute("report_type");
const isProjectModel = (
this.model.modelName === "project.task" ||
this.model.modelName === "project.project"
);
if (ks_report_type === "excel" && isProjectModel) {
this._uiService.block();
try {
await download({
url: "/web/ksgantt/export/xlsx/",
data: {
project_id: this.model.context.default_project_id
? this.model.context.default_project_id
: false,
},
});
} finally {
this._uiService.unblock();
}
} else {
super._ksExportReport(...arguments);
}
},
});
@@ -0,0 +1,74 @@
/** @odoo-module **/
/**
* Odoo 19 upgrade notes for ks_gantt_renderer_inherit.js:
*
* 1. jsonrpc removed: `jsonrpc` from `@web/core/network/rpc_service` was
* deprecated in Odoo 17 and removed in 18+. Replaced with the `rpc`
* service via `useService("rpc")` consumed in `setup()`.
*
* 2. willstart() → onWillStart(): OWL 1 lifecycle method names are gone.
* OWL 2 (used since Odoo 16) uses `onWillStart`. The patch now overrides
* `setup()` to register the hook there, which is the correct OWL 2 pattern.
*
* 3. Async data fetching: `onWillStart` is registered via the OWL hook inside
* an overridden `setup()`. We capture the rpc service there and initiate
* the data fetch before the component mounts.
*/
import { ksGanttRenderer } from "@ks_gantt_view_base/js/ks_gantt_renderer_new";
import { patch } from "@web/core/utils/patch";
import { useService } from "@web/core/utils/hooks";
import { onWillStart } from "@odoo/owl";
patch(ksGanttRenderer.prototype, {
setup() {
super.setup();
// Capture the rpc service here; it's only available during setup().
this._rpc = useService("rpc");
onWillStart(async () => {
const promises = [];
// Load project-specific config when viewing project tasks
if (this.active_id && this.ks_model_name === "project.task") {
promises.push(
this._rpc({
model: "project.project",
method: "ks_project_config",
args: [this.active_id],
kwargs: {},
}).then((result) => {
this.ks_project_start = result.ks_project_start || false;
this.ks_project_end = result.ks_project_end || false;
this.ks_enable_project_deadline = result.ks_enable_project_deadline;
this.ks_enable_task_dynamic_text = result.ks_enable_task_dynamic_text;
this.ks_enable_task_dynamic_progress = result.ks_enable_task_dynamic_progress;
this.ks_enable_weekends = result.ks_enable_weekends;
this.ks_days_off = result.ks_days_off;
this.ks_days_off_selection = result.ks_days_off_selection;
this.ks_enable_quickinfo_extension = result.ks_enable_quickinfo_extension;
this.ks_project_tooltip_config = result.ks_project_tooltip_config || false;
this.ks_hide_date = result.ks_hide_date;
this.ks_allow_subtasks = result.ks_allow_subtasks;
})
);
}
// Load public holidays for all project gantt views
promises.push(
this._rpc({
model: "project.project",
method: "ks_public_holidays",
args: [],
kwargs: {},
}).then((result) => {
this.ks_exclude_holiday = result;
})
);
await Promise.all(promises);
});
},
});