changes
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/** @odoo-module **/
|
||||
/*
|
||||
* Copyright 2026 Nexa Systems Inc.
|
||||
* License OPL-1 (Odoo Proprietary License v1.0)
|
||||
* Part of the Fusion Plating product family.
|
||||
*
|
||||
* Forces the QA-005 Contract Review form to open right after an
|
||||
* estimator creates a new fp.part.catalog under a customer that has
|
||||
* x_fc_contract_review_required = True. Rule 3 of the contract-review
|
||||
* flow.
|
||||
*
|
||||
* Server side (fusion_plating_quality/models/fp_part_catalog.py):
|
||||
* after auto-creating the fp.contract.review record on part create,
|
||||
* push a bus notification of type "fusion_plating.contract_review_redirect"
|
||||
* with payload {review_id, part_id, part_label}.
|
||||
*
|
||||
* Frontend side (this file): a service subscribes to that bus type
|
||||
* on session start. When a payload arrives, dispatch an ir.actions.
|
||||
* act_window opening the review's form so the user lands on the QA-005
|
||||
* automatically. They can still close it and come back later — the
|
||||
* WO-step gate (rule 5) is the backstop.
|
||||
*/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
const contractReviewRedirectService = {
|
||||
dependencies: ["bus_service", "action"],
|
||||
start(env, { bus_service: bus, action }) {
|
||||
bus.subscribe(
|
||||
"fusion_plating.contract_review_redirect",
|
||||
(payload) => {
|
||||
if (!payload || !payload.review_id) {
|
||||
return;
|
||||
}
|
||||
action.doAction({
|
||||
type: "ir.actions.act_window",
|
||||
res_model: "fp.contract.review",
|
||||
res_id: payload.review_id,
|
||||
view_mode: "form",
|
||||
views: [[false, "form"]],
|
||||
target: "current",
|
||||
});
|
||||
},
|
||||
);
|
||||
bus.start();
|
||||
},
|
||||
};
|
||||
|
||||
registry
|
||||
.category("services")
|
||||
.add("fusion_plating_contract_review_redirect", contractReviewRedirectService);
|
||||
Reference in New Issue
Block a user