Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert HTML to text while syncing description #235

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ecommerce_integrations/unicommerce/product.py
Original file line number Diff line number Diff line change
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