feat: variant wizard now creates AND updates existing WC variations

Already synced variants are editable — change price, SKU, image and click
Save & Sync to update them on WooCommerce. New variants are created,
existing ones updated in a single action. Button shows on all products
with variants (purple for new, grey for already synced).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-01 18:10:07 -04:00
parent 1bf4092b39
commit 8983c8bd50
3 changed files with 105 additions and 25 deletions

View File

@@ -210,20 +210,15 @@
</td>
<td>
<t t-esc="p.odoo_product_name"/>
<t t-if="p.needs_variant_push">
<button class="woo-btn woo-btn-primary woo-btn-sm ms-2"
<t t-if="p.odoo_variant_count > 1 and !p.is_variation">
<button class="woo-btn woo-btn-sm ms-2"
t-att-class="p.needs_variant_push ? 'woo-btn woo-btn-primary woo-btn-sm ms-2' : 'woo-btn woo-btn-secondary woo-btn-sm ms-2'"
t-on-click.stop="() => this.pushVariantsToWC(p.id)"
title="Push Odoo variants to WooCommerce">
title="Manage variants — create new or update existing">
<i class="fa fa-sitemap me-1"/>
Push <t t-esc="p.odoo_variant_count"/> variants
<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 ms-2">
<i class="fa fa-sitemap me-1"/>
<t t-esc="p.odoo_variant_count"/> synced
</span>
</t>
</td>
<td class="text-end woo-editable-cell" t-on-click.stop="() => this.startEdit(p.id, 'woo_regular', p.woo_regular_price)">
<t t-if="this.isEditing(p.id, 'woo_regular')">