Skip to content

Commit

Permalink
fix: convert HTML to text while syncing description (frappe#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Mar 14, 2023
1 parent 0dbdc0b commit 3546eca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ecommerce_integrations/unicommerce/product.py
Expand Up @@ -2,7 +2,7 @@

import frappe
from frappe import _
from frappe.utils import get_url, now
from frappe.utils import get_url, now, to_markdown
from frappe.utils.nestedset import get_root_of
from stdnum.ean import is_valid as validate_barcode

Expand Down Expand Up @@ -82,7 +82,7 @@ def import_product_from_unicommerce(sku: str, client: UnicommerceAPIClient = Non


def _create_item_dict(uni_item):
""" Helper function to build item document fields"""
"""Helper function to build item document fields"""

item_dict = {"weight_uom": DEFAULT_WEIGHT_UOM}

Expand Down Expand Up @@ -270,6 +270,9 @@ def _build_unicommerce_item(item_code: ItemCode) -> JsonDict:

item_json["enabled"] = not bool(item.get("disabled"))

if item_json.get("description"):
item_json["description"] = to_markdown(item_json["description"]) or item_json["description"]

for barcode in item.barcodes:
if not item_json.get("scanIdentifier"):
# Set first barcode as scan identifier
Expand Down

0 comments on commit 3546eca

Please sign in to comment.