ERPNext Conference 2019* ERPNext.com Blog

Error with variants valuation


#1

hi all
i`v created a templet item and it works fine even i created its variants all things going well

but when i upload csv file with the huge number of variants

it uploads and create every thing well

but when i try to update the templet item or save any changes in it i face the fowling error message

Value cannot be changed for Valuation Method
any idea about this issue ??


#2

update !

I`v also tried to upload them with Valuation Method column with Moving Average as default in stock settings but the same error


#3

Please check Variant Settings (in stock module) and ensure that Valuation Rate field is NOT included in the table.


#4

i`v removed Valuation Method from table not valuation rate

but i faced a new error

Value cannot be changed for Variant Based On


#5

Can you please share complete error log? Also share the browser’s console message when validation occurs.


#6

jquery.min.js:4 POST https://erp.riadco.com.eg/ 417 (EXPECTATION FAILED)
send @ jquery.min.js:4
ajax @ jquery.min.js:4
frappe.request.call @ desk.min.js?ver=1514284956.0:1548
frappe.call @ desk.min.js?ver=1514284956.0:1441
_call @ form.min.js?ver=1514284956.0:2433
save @ form.min.js?ver=1514284956.0:2289
frappe.ui.form.save @ form.min.js?ver=1514284956.0:2459
(anonymous) @ form.min.js?ver=1514284956.0:747
Promise resolved (async)
(anonymous) @ desk.min.js?ver=1514284956.0:675
frappe.run_serially @ desk.min.js?ver=1514284956.0:673
_f.Frm._save @ form.min.js?ver=1514284956.0:737
(anonymous) @ form.min.js?ver=1514284956.0:695
setTimeout (async)
(anonymous) @ form.min.js?ver=1514284956.0:694
_f.Frm.save @ form.min.js?ver=1514284956.0:688
Save @ form.min.js?ver=1514284956.0:1727
(anonymous) @ desk.min.js?ver=1514284956.0:3195
dispatch @ jquery.min.js:3
$event.dispatch @ report.min.js?ver=1514284956.0:3020
r.handle @ jquery.min.js:3
desk.min.js?ver=1514284956.0:1649 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 111, in on_update
self.update_variants()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 631, in update_variants
variant.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 293, in _save
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 455, in _validate
self.validate_set_only_once()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 482, in validate_set_only_once
frappe.CannotChangeConstantError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
CannotChangeConstantError: Value cannot be changed for Maintain Stock

desk.min.js?ver=1514284956.0:1649 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 111, in on_update
self.update_variants()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 631, in update_variants
variant.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 293, in _save
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 455, in _validate
self.validate_set_only_once()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 482, in validate_set_only_once
frappe.CannotChangeConstantError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
CannotChangeConstantError: Value cannot be changed for Maintain Stock


#7

i`v solved maintain stock error message but
Value cannot be changed for Variant Based On


#8

jquery.min.js:4 POST https://erp.riadco.com.eg/ 417 (EXPECTATION FAILED)
send @ jquery.min.js:4
ajax @ jquery.min.js:4
frappe.request.call @ desk.min.js?ver=1514284956.0:1548
frappe.call @ desk.min.js?ver=1514284956.0:1441
_call @ form.min.js?ver=1514284956.0:2433
save @ form.min.js?ver=1514284956.0:2289
frappe.ui.form.save @ form.min.js?ver=1514284956.0:2459
(anonymous) @ form.min.js?ver=1514284956.0:747
Promise resolved (async)
(anonymous) @ desk.min.js?ver=1514284956.0:675
frappe.run_serially @ desk.min.js?ver=1514284956.0:673
_f.Frm._save @ form.min.js?ver=1514284956.0:737
(anonymous) @ form.min.js?ver=1514284956.0:695
setTimeout (async)
(anonymous) @ form.min.js?ver=1514284956.0:694
_f.Frm.save @ form.min.js?ver=1514284956.0:688
Save @ form.min.js?ver=1514284956.0:1727
(anonymous) @ desk.min.js?ver=1514284956.0:3195
dispatch @ jquery.min.js:3
$event.dispatch @ report.min.js?ver=1514284956.0:3020
r.handle @ jquery.min.js:3
desk.min.js?ver=1514284956.0:1649 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 111, in on_update
self.update_variants()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 631, in update_variants
variant.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 293, in _save
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 455, in _validate
self.validate_set_only_once()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 482, in validate_set_only_once
frappe.CannotChangeConstantError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
CannotChangeConstantError: Value cannot be changed for Variant Based On

desk.min.js?ver=1514284956.0:1649 Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 111, in on_update
self.update_variants()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/item/item.py”, line 631, in update_variants
variant.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 293, in _save
self._validate()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 455, in _validate
self.validate_set_only_once()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 482, in validate_set_only_once
frappe.CannotChangeConstantError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
CannotChangeConstantError: Value cannot be changed for Variant Based On


#9

sorry about that i`v downloaded a new template file including Variant Based On column and its finally working

thanks @umair


#10

#11

I faced a very similar issue and your advice to remove the “valuation_method” row from the “Variant Settings” (in stock module) has enabled me to update the items with the “Bulk Update Tool” (changed the item_group).

Now I am wondering whether I should put that “valuation_method” row back in again or leave it away for good?

What in general is a little illogical is that this problem only was present for just a few of the item templates while a large majority could be updated (via ‘Bulk Update Tool’) without much of a problem apart from the entire procedure crashing several times and consuming a lot of RAM which rendered my machine almost immobile.


Installed Apps

  • ERPNext: v11.1.15 (master)
  • Frappe Framework: v11.1.14 (master)