fix: filter inactive/attributeless variants from push wizard
Archived variants (active=False) and variants with no attribute values were being included, causing WC 400 errors. Now only active variants with attribute assignments are shown and pushed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,9 +35,12 @@ class WooVariantPushWizard(models.TransientModel):
|
|||||||
res['product_name'] = tmpl.name
|
res['product_name'] = tmpl.name
|
||||||
res['woo_product_id'] = pm.woo_product_id
|
res['woo_product_id'] = pm.woo_product_id
|
||||||
|
|
||||||
# Populate variant lines
|
# Populate variant lines — only active variants with attribute values
|
||||||
lines = []
|
lines = []
|
||||||
for variant in tmpl.product_variant_ids:
|
active_variants = tmpl.product_variant_ids.filtered(
|
||||||
|
lambda v: v.active and v.product_template_attribute_value_ids
|
||||||
|
)
|
||||||
|
for variant in active_variants:
|
||||||
already_mapped = self.env['woo.product.map'].search([
|
already_mapped = self.env['woo.product.map'].search([
|
||||||
('instance_id', '=', pm.instance_id.id),
|
('instance_id', '=', pm.instance_id.id),
|
||||||
('product_id', '=', variant.id),
|
('product_id', '=', variant.id),
|
||||||
|
|||||||
Reference in New Issue
Block a user