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:
gsinghpal
2026-04-01 17:52:37 -04:00
parent a3fa1ced16
commit a0ad52fe46
4 changed files with 212 additions and 0 deletions

View File

@@ -155,6 +155,7 @@
<th>Cost</th>
<th>Margin %</th>
<th>Instance</th>
<th>Variants</th>
<th>Price Sync</th>
<th>Inventory Sync</th>
</tr>
@@ -280,6 +281,21 @@
<t t-else="" t-esc="this.formatMargin(p.odoo_cost, p.odoo_price)"/>
</td>
<td><t t-esc="p.instance_name"/></td>
<td class="text-center">
<t t-if="p.needs_variant_push">
<button class="woo-btn woo-btn-primary woo-btn-sm"
t-on-click.stop="() => this.pushVariantsToWC(p.id)"
title="Push Odoo variants to WooCommerce">
<i class="fa fa-sitemap me-1"/>
<t t-esc="p.odoo_variant_count"/> variants
</button>
</t>
<t t-elif="p.odoo_variant_count > 1 and !p.is_variation">
<span class="woo-badge woo-badge-mapped">
<t t-esc="p.odoo_variant_count"/> synced
</span>
</t>
</td>
<td>
<input type="checkbox"
t-att-checked="p.sync_price"