feat: push variants button on mapped products — convert simple→variable in WC
When a mapped product is simple on WC but has variants in Odoo, a purple "N variants" button appears in the Variants column. Clicking it: 1. Converts the WC product from simple to variable 2. Creates WC attributes and terms from Odoo attribute lines 3. Creates a WC variation for each Odoo variant with price/SKU/stock/tax/image 4. Creates woo.product.map records for each variation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -855,6 +855,29 @@ export class ProductMapping extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Push variants to WC
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
async pushVariantsToWC(mapId) {
|
||||
try {
|
||||
this.state.loading = true;
|
||||
await rpc("/web/dataset/call_kw", {
|
||||
model: "woo.product.map",
|
||||
method: "action_push_variants_to_wc",
|
||||
args: [[mapId]],
|
||||
kwargs: {},
|
||||
});
|
||||
this.notification.add("Variants pushed to WooCommerce successfully.", { type: "success" });
|
||||
await this._refreshAll();
|
||||
} catch (err) {
|
||||
console.error("[ProductMapping] pushVariantsToWC error:", err);
|
||||
this.notification.add(err.message || "Failed to push variants.", { type: "danger" });
|
||||
} finally {
|
||||
this.state.loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Bulk price sync
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user