Open dvdl16 opened 2 months ago
An Error Log is created when mapping weight_per_item and weight and the WooCommerce Product's weight is 0.0
weight_per_item
weight
0.0
0
The sync should not fail if weight is 0
Error Log WooCommerce Error:
WooCommerce Error
Traceback (most recent call last): File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 165, in run self.sync_ecommerce_product_with_erpnext_item() File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 256, in sync_ecommerce_product_with_erpnext_item self.update_item(self.ecommerce_product, self.item) File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 270, in update_item self.set_item_fields() File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 482, in set_item_fields frappe.db.set_value( File "apps/frappe/frappe/database/database.py", line 994, in set_value query.run(debug=debug) File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/database/database.py", line 234, in sql self._cursor.execute(query, values) File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute result = self._query(query) ^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query conn.query(q) File "env/lib/python3.11/site-packages/pymysql/connections.py", line 563, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/connections.py", line 825, in _read_query_result result.read() File "env/lib/python3.11/site-packages/pymysql/connections.py", line 1199, in read first_packet = self.connection._read_packet() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_packet packet.raise_for_error() File "env/lib/python3.11/site-packages/pymysql/protocol.py", line 219, in raise_for_error err.raise_mysql_exception(self._data) File "env/lib/python3.11/site-packages/pymysql/err.py", line 150, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.DataError: (1366, "Incorrect decimal value: '' for column `_xxxxxx`.`tabItem`.`weight_per_unit` at row 1") Item Data: ERPNextItemToSync(item=<Item: ITEM001>, item_ecommerce_server_idx=1) EC Product Data {'name': 'example.com~12345', 'owner': None, 'creation': None, 'modified': '2024-07-20T00:10:38', 'modified_by': None, 'docstatus': 0, 'idx': 0, 'ecommerce_server': 'example.com', 'ecommerce_id': 12345, 'ecommerce_name': 'Sample Product', 'description': '<h2>Product Description</h2>\n<p>Buy your product for $100</p>\n<p>Visit our store with your product</p>\n<p>Get your product verified!</p>\n<p>Share your progress on social media.</p>\n<p>To take full advantage of your product, please register on our website.</p>\n<p>The product is published by our company and supported by our community.</p>\n<h2>Important Information</h2>\n<p><strong>Details:</strong> The product details are subject to change. Please verify with our store.</p>\n', 'short_description': '<p>Embark on an exciting journey with our product! This product is your gateway to an amazing experience, guiding you to more than 100 of our favorite stores and partners.</p>\n<p>Get your product today! Makes a great gift for anyone! Read below for details.</p>\n', 'slug': 'sample-product', 'ecommerce_date_created': '2024-06-18T12:34:26', 'ecommerce_date_created_gmt': '2024-06-18T10:34:26', 'ecommerce_date_modified': '2024-07-20T00:10:38', 'ecommerce_date_modified_gmt': '2024-07-19T22:10:38', 'stock_quantity': 0.0, 'permalink': 'https://example.com/product/sample-product/', 'type': 'simple', 'status': 'publish', 'featured': 0, 'catalog_visibility': 'visible', 'purchasable': 1, 'virtual': 0, 'downloadable': 0, 'parent_id': 0, 'title': 'Sample Product', 'price': 100.0, 'regular_price': 100.0, 'sale_price': 0.0, 'tax_status': 'taxable', 'tax_class': '', 'date_on_sale_from': None, 'date_on_sale_from_gmt': None, 'date_on_sale_to': None, 'date_on_sale_to_gmt': None, 'on_sale': 0, 'total_sales': 0.0, 'sku': '', 'manage_stock': 0, 'stock_status': 'instock', 'backorders': 'no', 'backorders_allowed': 0, 'backordered': 0, 'sold_individually': 0, 'weight': 0.0, 'dimensions': '{"length": "", "width": "", "height": ""}', 'shipping_required': 1, 'shipping_taxable': 1, 'shipping_class': '', 'shipping_class_id': 0, 'upsell_ids': '[]', 'cross_sell_ids': '[]', 'related_ids': '[1099]', 'attributes': '[]', 'reviews_allowed': 1, 'rating_count': 0, 'average_rating': '0.00', 'categories': '[{"id": 532, "name": "Merchandise and Gifts", "slug": "merchandise"}, {"id": 1394, "name": "Other", "slug": "other"}]', 'tags': '[{"id": 1395, "name": "sample product", "slug": "sample-product"}, {"id": 1396, "name": "gift", "slug": "gift"}]', 'images': '[{"id": 12346, "date_created": "2024-06-18T14:29:37", "date_created_gmt": "2024-06-18T10:29:37", "date_modified": "2024-06-18T14:29:37", "date_modified_gmt": "2024-06-18T10:29:37", "src": "https://example.com/wp-content/uploads/2024/06/sample-image1.webp", "name": "sample-image1", "alt": ""}, {"id": 12347, "date_created": "2024-06-18T14:35:15", "date_created_gmt": "2024-06-18T10:35:15", "date_modified": "2024-06-18T14:35:15", "date_modified_gmt": "2024-06-18T10:35:15", "src": "https://example.com/wp-content/uploads/2024/06/sample-image2.jpg", "name": "sample-image2", "alt": ""}]', 'default_attributes': '[]', 'variations': '[]', 'meta_data': '[{"id": 5183104, "key": "_oembed_eef2ae2c71dddcee8d877089cfe90e11", "value": "<iframe title=\\"PRODUCT REVIEW\\" width=\\"717\\" height=\\"403\\" src=\\"https://www.youtube.com/embed/sample-video?feature=oembed&enablejsapi=1&origin=https://example.com\\" frameborder=\\"0\\" allow=\\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\\" referrerpolicy=\\"strict-origin-when-cross-origin\\" allowfullscreen></iframe>"}, {"id": 5183105, "key": "_oembed_time_eef2ae2c71dddcee8d877089cfe90e11", "value": "1718706812"}, {"id": 5183106, "key": "rank_math_internal_links_processed", "value": "1"}, {"id": 5183107, "key": "rank_math_seo_score", "value": "93"}, {"id": 5183108, "key": "rank_math_focus_keyword", "value": "sample product"}, {"id": 5183110, "key": "_wp_page_template", "value": "default"}, {"id": 5183111, "key": "_alg_wc_pq_min", "value": "1"}, {"id": 5183112, "key": "alg_wc_pq_min_12345_to_all", "value": "no"}, {"id": 5183113, "key": "_alg_wc_pq_step", "value": "1
Error Log woocommerce_fusion.tasks.sync_items.SynchroniseItem.run:
woocommerce_fusion.tasks.sync_items.SynchroniseItem.run
File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 256, in sync_ec_product_with_erpnext_item self.update_item(self.ecommerce_product, self.item) self = <ecommerce_fusion.tasks.sync_items.SynchroniseItem object at 0x72f6cccf6790> File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 270, in update_item self.set_item_fields() self = <ecommerce_fusion.tasks.sync_items.SynchroniseItem object at 0x72f6cccf6790> ecommerce_product = <EcommerceProduct: example.com~12345> item = ERPNextItemToSync(item=<Item: ITEM001>, item_ecommerce_server_idx=1) File "apps/ecommerce_fusion/ecommerce_fusion/tasks/sync_items.py", line 482, in set_item_fields framework.db.set_value( self = <ecommerce_fusion.tasks.sync_items.SynchroniseItem object at 0x72f6cccf6790> ec_server = <EcommerceServer: example.com> map = <EcommerceServerItemField: 9g82ekvjkj parent=example.com> erpnext_item_field_name = ['weight_per_unit', 'Weight Per Unit'] ecommerce_product_field_value = '' File "apps/framework/framework/database/database.py", line 994, in set_value query.run(debug=debug) self = <framework.database.mariadb.database.MariaDBDatabase object at 0x72f6c7ae3c50> dt = 'Item' dn = 'ITEM001' field = 'weight_per_unit' val = '' modified = None modified_by = None update_modified = False debug = False is_single_doctype = <function is_single_doctype at 0x72f6cc48ce00> to_update = {'weight_per_unit': ''} query = UPDATE `tabItem` SET `weight_per_unit`='' WHERE `name`='ITEM001' column = 'weight_per_unit' value = '' File "apps/framework/framework/query_builder/utils.py", line 87, in execute_query result = framework.db.sql(query, params, *args, **kwargs) # nosemgrep query = 'UPDATE `tabItem` SET `weight_per_unit`=%(param1)s WHERE `name`=%(param2)s' args = () kwargs = {'debug': False} child_queries = [] params = {'param1': '', 'param2': 'ITEM001'} execute_child_queries = <function patch_query_execute.<locals>.execute_child_queries at 0x72f6c7ae9440> prepare_query = <function patch_query_execute.<locals>.prepare_query at 0x72f6c791f600> File "apps/framework/framework/database/database.py", line 234, in sql self._cursor.execute(query, values) self = <framework.database.mariadb.database.MariaDBDatabase object at 0x72f6c7ae3c50> query = 'UPDATE `tabItem` SET `weight_per_unit`=%(param1)s WHERE `name`=%(param2)s' values = {'param1': '', 'param2': 'ITEM001'} as_dict = 0 as_list = 0 debug = False ignore_ddl = 0 auto_commit = 0 update = None explain = False run = True pluck = False as_iterator = False trace_id = None File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute result = self._query(query) self = <pymysql.cursors.Cursor object at 0x72f6c7a1e5d0> query = "UPDATE `tabItem` SET `weight_per_unit`='' WHERE `name`='ITEM001'" args = {'param1': '', 'param2': 'ITEM001'} File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query conn.query(q) self = <pymysql.cursors.Cursor object at 0x72f6c7a1e5d0> q = "UPDATE `tabItem` SET `weight_per_unit`='' WHERE `name`='ITEM001'" conn = <pymysql.connections.Connection object at 0x72f6c6ed3f10> File "env/lib/python3.11/site-packages/pymysql/connections.py", line 563, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) self = <pymysql.connections.Connection object at 0x72f6c6ed3f10> sql = b"UPDATE `tabItem` SET `weight_per_unit`='' WHERE `name`='ITEM001'" unbuffered = False File "env/lib/python3.11/site-packages/pymysql/connections.py", line 825, in _read_query_result result.read() self = <pymysql.connections.Connection object at 0x72f6c6ed3f10> unbuffered = False result = <pymysql.connections.MySQLResult object at 0x72f6c6d8e150> File "env/lib/python3.11/site-packages/pymysql/connections.py", line 1199, in read first_packet = self.connection._read_packet() self = <pymysql.connections.MySQLResult object at 0x72f6c6d8e150> File "env/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_packet packet.raise_for_error() self = <pymysql.connections.Connection object at 0x72f6c6ed3f10> packet_type = <class 'pymysql.protocol.MysqlPacket'> buff = bytearray(b"\xffV\x05#22007Incorrect decimal value: \'\' for column `_d7b0b8e59308386f`.`tabItem`.`weight_per_unit` at row 1") packet_header = b'h\x00\x00\x01' btrl = 104 btrh = 0 packet_number = 1 bytes_to_read = 104 recv_data = b"\xffV\x05#22007Incorrect decimal value: '' for column `_d7b0b8e59308386f`.`tabItem`.`weight_per_unit` at row 1" packet = <pymysql.protocol.MysqlPacket object at 0x72f6c6f62830> File "env/lib/python3.11/site-packages/pymysql/protocol.py", line 219, in raise_for_error err.raise_mysql_exception(self._data) self = <pymysql.protocol.MysqlPacket object at 0x72f6c6f62830> errno = 1366 File "env/lib/python3.11/site-packages/pymysql/err.py", line 150, in raise_mysql_exception raise errorclass(errno, errval) data = b"\xffV\x05#22007Incorrect decimal value: '' for column `_d7b0b8e59308386f`.`tabItem`.`weight_per_unit` at row 1" errno = 1366 errval = "Incorrect decimal value: '' for column `_d7b0b8e59308386f`.`tabItem`.`weight_per_unit` at row 1" errorclass = <class 'pymysql.err.DataError'> pymysql.err.DataError: (1366, "Incorrect decimal value: '' for column `_d7b0b8e59308386f`.`tabItem`.`weight_per_unit` at row 1")
Agriculture: v0.0.1 Customisations for x: v1.2.3 South Africa Customisations: v0.1.6 ERPNext: v15.27.7 Frappe Framework: v15.29.2 Frappe HR: v15.22.3 WooCommerce Fusion: v1.7.1
Windows
No response
Current Behavior
An Error Log is created when mapping
weight_per_item
andweight
and the WooCommerce Product's weight is0.0
Steps To Reproduce
0
Expected Behavior
The sync should not fail if weight is 0
Anything else?
Error Log
WooCommerce Error
:Error Log
woocommerce_fusion.tasks.sync_items.SynchroniseItem.run
:Environment and Versions
Operating System
Windows
What browsers are you seeing the problem on?
No response