feat: add WC Price and Odoo Price columns to product mapping UI

Added woo_price field to woo.product.map model, populated during fetch.
Search endpoint now returns both odoo_price and woo_price for side-by-side
comparison in the mapped products table.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-03-31 22:32:42 -04:00
parent ab16040eb4
commit 919dbcb4cf
4 changed files with 29 additions and 0 deletions

View File

@@ -196,12 +196,19 @@ class WooInstance(models.Model):
match_state = 'mapped'
auto_matched += 1
wc_price = 0.0
try:
wc_price = float(wc_prod.get('regular_price') or wc_prod.get('price') or 0)
except (ValueError, TypeError):
pass
ProductMap.create({
'instance_id': self.id,
'product_id': odoo_product.id if odoo_product else False,
'woo_product_id': wc_id,
'woo_product_name': wc_name,
'woo_sku': wc_sku,
'woo_price': wc_price,
'woo_product_type': wc_type if wc_type in ('simple', 'variable', 'grouped', 'external') else 'simple',
'state': match_state,
'company_id': self.company_id.id,
@@ -239,12 +246,19 @@ class WooInstance(models.Model):
var_state = 'mapped'
auto_matched += 1
var_price = 0.0
try:
var_price = float(var.get('regular_price') or var.get('price') or 0)
except (ValueError, TypeError):
pass
ProductMap.create({
'instance_id': self.id,
'product_id': var_product.id if var_product else False,
'woo_product_id': var_id,
'woo_product_name': var_name,
'woo_sku': var_sku,
'woo_price': var_price,
'woo_product_type': 'simple',
'woo_parent_id': wc_id,
'is_variation': True,