feat: inline-editable prices in product mapping UI
Click any price cell (WC Standard, WC Sale, Odoo Price) to edit inline. Enter or click away saves and syncs to the source. Escape cancels. Validation: sale price cannot exceed standard price. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -135,6 +135,26 @@ class WooProductMap(models.Model):
|
||||
'Standard price set to $%.2f' % price,
|
||||
)
|
||||
|
||||
def action_set_sale_price(self, price):
|
||||
"""Set the WC sale price directly."""
|
||||
self.ensure_one()
|
||||
if not self.instance_id:
|
||||
return
|
||||
client = self.instance_id._get_client()
|
||||
# Sale price cannot exceed regular price
|
||||
if self.woo_regular_price and price > self.woo_regular_price + 0.01:
|
||||
raise UserError(
|
||||
'Sale price ($%.2f) cannot exceed the standard price ($%.2f).'
|
||||
% (price, self.woo_regular_price)
|
||||
)
|
||||
update_data = {'sale_price': str(price) if price > 0 else ''}
|
||||
client.update_product(self.woo_product_id, update_data)
|
||||
self.woo_sale_price = price
|
||||
self.instance_id._log_sync(
|
||||
'product', 'odoo_to_woo', self.woo_product_name, 'success',
|
||||
'Sale price set to $%.2f' % price,
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Image Sync (Task 22)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user