Skip to content

Commit 25cfa3d

Browse files
DHINESH00venkat102
authored andcommitted
test: sync item group to mapping hasn code
1 parent ad95ca9 commit 25cfa3d

5 files changed

Lines changed: 56 additions & 0 deletions

File tree

ecommerce_integrations/shopify/doctype/shopify_item_group_hsn_mapping/__init__.py

Whitespace-only changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"actions": [],
3+
"allow_rename": 1,
4+
"creation": "2024-12-11 15:41:11.020935",
5+
"doctype": "DocType",
6+
"editable_grid": 1,
7+
"engine": "InnoDB",
8+
"field_order": [
9+
"item_group",
10+
"hsnsac_code"
11+
],
12+
"fields": [
13+
{
14+
"fieldname": "item_group",
15+
"fieldtype": "Link",
16+
"in_list_view": 1,
17+
"label": "Item Group",
18+
"options": "Item Group"
19+
},
20+
{
21+
"fieldname": "hsnsac_code",
22+
"fieldtype": "Data",
23+
"in_list_view": 1,
24+
"label": "HSN/SAC Code"
25+
}
26+
],
27+
"index_web_pages_for_search": 1,
28+
"istable": 1,
29+
"links": [],
30+
"modified": "2024-12-11 15:45:34.268557",
31+
"modified_by": "Administrator",
32+
"module": "shopify",
33+
"name": "Shopify Item Group HSN Mapping",
34+
"owner": "Administrator",
35+
"permissions": [],
36+
"sort_field": "creation",
37+
"sort_order": "DESC",
38+
"states": []
39+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024, Frappe and contributors
2+
# For license information, please see license.txt
3+
4+
# import frappe
5+
from frappe.model.document import Document
6+
7+
8+
class ShopifyItemGroupHSNMapping(Document):
9+
pass

ecommerce_integrations/shopify/tests/test_product.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ def test_sync_single_product(self):
2525
ecommerce_item_exists = frappe.db.exists("Ecommerce Item", {"erpnext_item_code": item.name})
2626
self.assertTrue(bool(ecommerce_item_exists))
2727

28+
def test_sync_item_group(self):
29+
self.fake("products/6704435495065", body=self.load_fixture("variant_product"))
30+
product = ShopifyProduct(product_id="6704435495065")
31+
product.sync_product(sync_product_group=1)
32+
self.assertEqual(frappe.get_last_doc("Item Group").name, "shirt")
33+
self.assertEqual(product.setting.shopify_item_group_hsn_mapping[0].item_group, "shirt")
34+
2835
def test_sync_product_with_variants(self):
2936
self.fake("products/6704435495065", body=self.load_fixture("variant_product"))
3037

ecommerce_integrations/shopify/tests/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def setUpClass(cls):
7777
"erpnext_warehouse": "_Test Warehouse 2 - _TC",
7878
},
7979
],
80+
"shopify_item_group_hsn_mapping": [],
8081
}
8182
).save(ignore_permissions=True)
8283

0 commit comments

Comments
 (0)