dvdl16 / woocommerce_fusion

WooCommerce connector for ERPNext v15
https://finfoot.tech
Other
28 stars 24 forks source link

[BUG] Handle Trashed WooCommerce Products #111

Closed dvdl16 closed 2 months ago

dvdl16 commented 3 months ago

Current Behavior

When trying to sync a product that has been trashed, sync fails

Steps To Reproduce

  1. Go to WooCommerce
  2. Move an Item to Trash
  3. Go to the relevant WooCommerce Product
  4. Trigger a manual sync

Expected Behavior

Item should sync without failure

Anything else?

Error Log: WooCommerce Error: Price List Sync

Traceback (most recent call last):
  File "apps/woocommerce_fusion/woocommerce_fusion/tasks/sync_item_prices.py", line 134, in sync_items_with_woocommerce_products
    wc_product.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 376, in _save
    self._validate()
  File "apps/frappe/frappe/model/document.py", line 576, in _validate
    self._validate_selects()
  File "apps/frappe/frappe/model/base_document.py", line 885, in _validate_selects
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
frappe.exceptions.ValidationError:  Status cannot be "trash". It should be one of "draft", "pending", "private", "publish"

Environment and Versions

Agriculture: v0.0.1
Customisations for x: v1.2.3
Frappe CRM: v1.19.0
South Africa Customisations: v0.1.6
ERPNext: v15.27.7
Frappe Framework: v15.29.2
Helpdesk: v0.10.0
Frappe HR: v15.22.3
WooCommerce Fusion: v1.7.2

Operating System

Windows

What browsers are you seeing the problem on?

Chrome, Firefox