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

Errors and Bugs in the New item Variants #3905

Closed
adityaduggal opened this issue Aug 18, 2015 · 1 comment
Closed

Errors and Bugs in the New item Variants #3905

adityaduggal opened this issue Aug 18, 2015 · 1 comment

Comments

@adityaduggal
Copy link
Contributor

Hi,

I have encountered 2 errors as below, @neilLasrado and @anandpdoshi please let me know if you need more information:

The below one happens when I tried to set the increment to 0.001 in float attributes when the float precision was set to 2 in the setup. Also it happened with float precision set to 3.

Traceback (innermost last):
  File "/home/aditya/frappe-bench/apps/frappe/frappe/app.py", line 66, in application
    response = frappe.handler.handle()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/handler.py", line 74, in handle
    execute_cmd(cmd)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/handler.py", line 99, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/__init__.py", line 756, in call
    return fn(*args, **newargs)
  File "/home/aditya/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py", line 506, in get_variant
    if (not values.from_range < cint(args[d]) < values.to_range) or ((cint(args[d]) - values.from_range) % values.increment != 0):
 ZeroDivisionError: float modulo

The below error happens if you follow the following steps:

  • Create a Template.
  • Goto Item List
  • Filter items has variants = yes (ensure that only 1 template is there)
  • Now click on New Item this item would have has variant as that template
  • save item and you get the below error
Traceback (innermost last):
  File "/home/aditya/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 216, in save
    self.insert()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 178, in insert
    self.run_before_save_methods()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 543, in run_before_save_methods
    self.run_method("validate")
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 509, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 636, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 619, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 503, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/aditya/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py", line 67, in validate
    self.validate_variant_attributes()
  File "/home/aditya/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py", line 353, in validate_variant_attributes
    variant = get_variant(self.variant_of, args)
  File "/home/aditya/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py", line 528, in get_variant
    variant=  frappe.db.sql("""select i.name from tabItem i where {0}""".format(conds))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/database.py", line 146, in sql
    self._cursor.execute(query)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
 ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and not exists (select iv.name from `tabItem Variant Attribute` iv where iv.pare' at line 1")

Traceback (innermost last):
  File "/home/aditya/frappe-bench/apps/frappe/frappe/app.py", line 66, in application
    response = frappe.handler.handle()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/handler.py", line 74, in handle
    execute_cmd(cmd)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/handler.py", line 99, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/__init__.py", line 756, in call
    return fn(*args, **newargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 216, in save
    self.insert()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 178, in insert
    self.run_before_save_methods()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 543, in run_before_save_methods
    self.run_method("validate")
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 509, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 636, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 619, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/document.py", line 503, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/aditya/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py", line 67, in validate
    self.validate_variant_attribute
@anandpdoshi
Copy link
Contributor

@neilLasrado and @adityaduggal looking into this right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants