8848digital / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
0 stars 0 forks source link

Bug: Error while creating single variant and multiple variant from Item #229

Closed tinadn closed 1 month ago

tinadn commented 1 month ago

Information about bug

image

Refer Item Attribute: http://3.12.196.161/app/item-attribute/Test%20Numeric%20Variant Create Item variant with:

{
"Item_variant",
            {
                "attributes": [
                    {
                        "attribute": "Test Numeric Variant",
                        "numeric_values": 1,
                        "from_range": 0.0,
                        "to_range": 100.0,
                        "increment": 0.5,
                    },
                ],
                "has_variants": 1,
            },
}
File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1775, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/controllers/item_variant.py", line 48, in get_variant
    return find_variant(template, args, variant)
  File "apps/erpnext/erpnext/controllers/item_variant.py", line 179, in find_variant
    possible_variants = [i for i in get_item_codes_by_attributes(args, template) if i != variant_item_code]
  File "apps/erpnext/erpnext/utilities/product.py", line 161, in get_item_codes_by_attributes
    item_codes = set([r[0] for r in frappe.db.sql(query, query_values)])
  File "apps/frappe/frappe/database/postgres/database.py", line 218, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
  File "apps/frappe/frappe/database/database.py", line 227, in sql
    self._cursor.execute(query, values)
psycopg2.errors.UndefinedFunction: operator does not exist: character varying = numeric
LINE 8: ...tribute = 'Test Numeric Variant' and attribute_value = 1.1 )
                                                                ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Module

stock

Version

ERPNext: v15.34.0 (pre-prod)

Frappe Framework: v15.41.0 (pre-prod)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

tinadn commented 1 month ago

Issue resolved. Hence closing.