changes
This commit is contained in:
@@ -492,7 +492,38 @@ export class ProductMapping extends Component {
|
||||
}
|
||||
|
||||
async createInOdoo(wooMapId) {
|
||||
this.notification.add("Create in Odoo queued.", { type: "info" });
|
||||
if (!this.state.instanceId) {
|
||||
this.notification.add("Please select an instance first.", { type: "warning" });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await rpc("/web/dataset/call_kw", {
|
||||
model: "woo.product.map",
|
||||
method: "action_create_in_odoo",
|
||||
args: [[wooMapId]],
|
||||
kwargs: {},
|
||||
});
|
||||
if (!result || !result.product_id) {
|
||||
this.notification.add("Failed to create product.", { type: "danger" });
|
||||
return;
|
||||
}
|
||||
this.notification.add("Product created and mapped. Opening for editing…", { type: "success" });
|
||||
this.actionService.doAction({
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'product.product',
|
||||
res_id: result.product_id,
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
context: { form_view_initial_mode: 'edit' },
|
||||
}, {
|
||||
onClose: async () => {
|
||||
await this._refreshAll();
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("[ProductMapping] createInOdoo error:", err);
|
||||
this.notification.add(err.message || "Failed to create product in Odoo.", { type: "danger" });
|
||||
}
|
||||
}
|
||||
|
||||
async ignoreWoo(wooMapId) {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/**
|
||||
* Theme detection for Fusion WooCommerce.
|
||||
*
|
||||
* Odoo 19 stores dark mode preference in the "color_scheme" cookie ("dark" or "bright").
|
||||
* It also sets `color-scheme: dark` on .o_web_client via SCSS.
|
||||
*
|
||||
* This script reads the cookie and adds a `data-woo-theme="dark"` attribute on <html>
|
||||
* so our CSS can target it reliably. It also observes for changes (user toggles theme).
|
||||
*/
|
||||
import { cookie } from "@web/core/browser/cookie";
|
||||
|
||||
function applyTheme() {
|
||||
const scheme = cookie.get("color_scheme");
|
||||
const isDark = scheme === "dark";
|
||||
document.documentElement.setAttribute("data-woo-theme", isDark ? "dark" : "light");
|
||||
}
|
||||
|
||||
// Apply on load
|
||||
applyTheme();
|
||||
|
||||
// Re-apply periodically in case user toggles theme mid-session
|
||||
// (Odoo doesn't fire a DOM event for this, so we poll the cookie)
|
||||
setInterval(applyTheme, 2000);
|
||||
Reference in New Issue
Block a user