Have you had any joy here Roland?
If you’re stuck don’t be shy to complain!
Have you had any joy here Roland?
If you’re stuck don’t be shy to complain!
I tried demo run on v10 master and have following error
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
“main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 117, in execute
ret = frappe.get_attr(method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/demo/demo.py”, line 65, in simulate
fixed_asset.work()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/demo/user/fixed_asset.py”, line 15, in work
asset_list = make_asset_purchase_entry()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/demo/user/fixed_asset.py”, line 45, in make_asset_purchase_entry
pi.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 279, in _save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 218, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 859, in run_before_save_methods
self.run_method(“validate”)
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/accounts/doctype/purchase_invoice/purchase_invoice.py”, line 72, in validate
self.validate_fixed_asset()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 618, in validate_fixed_asset
.format(d.idx, d.asset, asset.status))
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))
frappe.exceptions.ValidationError: Row #1: Asset Chair 2 is already Fully Depreciated
This suggests
https://github.com/frappe/erpnext/blob/develop/erpnext/demo/demo.py
bench --site demo.erpnext.dev execute erpnext.demo.demo.simulate
Referring to the code, the demo setup is for a 100 day time period up to current and picks random dates for ‘business events’.
Inevitably some ‘business rule’ break sthe build - for eg Asset Chair 2 is already Fully Depreciated
So if you rerun the simulation, the next time the biz rule violation may fix itself?
Thanks for the help. It doesnot work
Running simulate for 4-5 times but same error
raise raise_exception(encode(msg))
frappe.exceptions.ValidationError: Row #1: Asset Chair 2 is already Fully Depreciated
In that case perhaps the setup fixture code may need to be changed.
I can’t say for sure where this is located - I believe these are simply json file of (key,value) pairs.
ok two thoughts to try
after a make ValidationError run ‘bench reinstall’ that apparently deletes the old database instance?
delete Chair 2 from asset.json? That you will find referenced here https://github.com/frappe/erpnext/blob/develop/erpnext/demo/setup/manufacture.py
frappe@erpnext:~/frappe-bench$ find . -name ‘asset.json’
./apps/erpnext/erpnext/demo/data/asset.json
./apps/erpnext/erpnext/assets/doctype/asset/asset.json
I tried above steps i.e. removed Chair 2 from asset.json
Then it gave error - frappe.exceptions.ValidationError: Row #1: Asset Chair 1 is already Fully Depreciated
So i went ahead and removed Chair 1 also
Then it gave error - frappe.exceptions.ValidationError: Row #1: Asset ERPNext is already Fully Depreciated
So it appears, problem is not with items itself but with some other data
Following might be imp lines from error trace
fixed_asset.py", line 45, in make_asset_purchase_entry
purchase_invoice.py", line 72, in validate self.validate_fixed_asset()
accounts_controller.py", line 618, in validate_fixed_asset
To followup, the Wind Power LLC demo code seems to work on this version
frappe@ubuntu:~/frappe-bench$ bench version
erpnext 10.1.38
frappe 10.1.36
with these two code changes:
Apply this change so those assets have instead status ‘Submitted’ (note that this hack may well violate asset depreciation - you have been warned
status = "Submitted"
if self.journal_entry_for_scrap:
status = "Scrapped"
elif flt(self.value_after_depreciation) < flt(self.expected_value_after_useful_life):
status = "Fully Depreciated"
elif flt(self.value_after_depreciation):
if flt(self.value_after_depreciation) < flt(self.gross_purchase_amount):
status = 'Partially Depreciated'
def create_log(ss_list):
if not ss_list:
frappe.msgprint("There's no employee for the given criteria. Check that Salary Slips have not already been created.")
return ss_list
You then run a ‘simulate’ cycle with this:
frappe@ubuntu:~/frappe-bench$ bench --site site1.local execute erpnext.demo.demo.simulate
whereupon this is displayed for eg
Simulating 2018-04-16: Day 6
and this exception below occurs, to end that simulate cycle. To continue, rerun the ‘simulate’ that will advance the simulation date:
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py”, line 457, in validate_schedule_date
frappe.throw(_(“Row #{0}: Reqd by Date cannot be before Transaction Date”).format(d.idx))
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))
frappe.exceptions.ValidationError: Row #1: Reqd by Date cannot be before Transaction Date
For a taste of the dataset here are some screenshots
I created a new site and ran the command
bench --site demo.erpnext execute erpnext.demo.demo.make
I get following error
> ashish@ashish-Latitude-E5530-vPro:~/frappe-bench-master$ bench --site demo.erpnext execute erpnext.demo.demo.make > Complete Setup... > Traceback (most recent call last): > File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main > "__main__", fname, loader, pkg_name) > File "/usr/lib/python2.7/runpy.py", line 72, in _run_code > exec code in run_globals > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module> > main() > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/utils/bench_helper.py", line 18, in main > click.Group(commands=commands)(prog_name='bench') > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__ > return self.main(*args, **kwargs) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main > rv = self.invoke(ctx) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke > return _process_result(sub_ctx.command.invoke(sub_ctx)) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke > return _process_result(sub_ctx.command.invoke(sub_ctx)) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke > return ctx.invoke(self.callback, **ctx.params) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke > return callback(*args, **kwargs) > File "/home/ashish/frappe-bench-master/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func > return f(get_current_context(), *args, **kwargs) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/commands/__init__.py", line 24, in _func > ret = f(frappe._dict(ctx.obj), *args, **kwargs) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/commands/utils.py", line 117, in execute > ret = frappe.get_attr(method)(*args, **kwargs) > File "/home/ashish/frappe-bench-master/apps/erpnext/erpnext/demo/demo.py", line 28, in make > setup_data.setup(domain) > File "/home/ashish/frappe-bench-master/apps/erpnext/erpnext/demo/setup/setup_data.py", line 15, in setup > setup_holiday_list() > File "/home/ashish/frappe-bench-master/apps/erpnext/erpnext/demo/setup/setup_data.py", line 114, in setup_holiday_list > frappe.set_value("Company", erpnext.get_default_company(), "default_holiday_list", holiday_list.name) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/__init__.py", line 619, in set_value > return frappe.client.set_value(doctype, docname, fieldname, value) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/client.py", line 121, in set_value > doc = frappe.get_doc(doctype, name) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/__init__.py", line 638, in get_doc > return frappe.model.document.get_doc(*args, **kwargs) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/model/document.py", line 68, in get_doc > return controller(*args, **kwargs) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/model/document.py", line 103, in __init__ > self.load_from_db() > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/model/document.py", line 140, in load_from_db > frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError) > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/__init__.py", line 323, in throw > msgprint(msg, raise_exception=exc, title=title, indicator='red') > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/__init__.py", line 309, in msgprint > _raise_exception() > File "/home/ashish/frappe-bench-master/apps/frappe/frappe/__init__.py", line 282, in _raise_exception > raise raise_exception(encode(msg)) > frappe.exceptions.DoesNotExistError: Company None not found
So i checked python console and indeed the company is not there
So, question is how to get the demo company ‘Wind Power LLC’?!
I can’t say what to suggest. The same company setup problem reported here just now with revant’s wizard setup workaround [Mar-2017] Showing there were error during setup ERPNext - #26 by skanel
@salman enquired
“This looks wonderful, Just curious does this data set still work on v11 ?”
It should but may require some work to restore.
This online version is rebuilt at intervals https://demo.erpnext.com/desk#query-report/General%20Ledger
Tested this and it does work on fresh install of v11 without much changes,
Good to know thanks!
Please whatever you can document would be a help for all - for future reference for you too perhaps
This doesn’t work on v12
chow@scw-awesome-jankelope:~/frappe-bench$ bench --site site1.local execute erpnext.demo.demo.simulate
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
“main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/chimso/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/chimso/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/chimso/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/chimso/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/chimso/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 145, in execute
ret = frappe.get_attr(method)(*args, **kwargs)
File “/home/chimso/frappe-bench/apps/frappe/frappe/init.py”, line 1033, in get_attr
return getattr(get_module(modulename), methodname)
File “/home/chimso/frappe-bench/apps/frappe/frappe/init.py”, line 814, in get_module
return importlib.import_module(modulename)
File “/home/chimso/frappe-bench/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/chimso/frappe-bench/apps/erpnext/erpnext/demo/demo.py”, line 6, in
from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset
File “/home/chimso/frappe-bench/apps/erpnext/erpnext/demo/user/fixed_asset.py”, line 9, in
from erpnext.assets.doctype.asset.asset import make_purchase_invoice, make_sales_invoice
ImportError: cannot import name ‘make_purchase_invoice’
Thanks for reporting this - this code probably is not part of the current ‘official’ online demo, hence it is not maintained?
I seem to have been able to get a working site with test data on v12 using the following
bench new-site <siteName>
bench --site <siteName> install-app erpnext
bench --site <siteName> set-config allow_tests true
bench --site <siteName> run-tests --app erpnext
I also ran bench --site <siteName> migrate
and bench setup nginx
(to see which port).
is using the run-tests
feature the new way of populating dummy-data?
@KanchanChauhan mentioned:
Install Demo
bench --site <site-name> execute erpnext.demo.demo.make
If Demo breaks, to continue
bench --site <site-name> execute erpnext.demo.demo.simulate
not sure what “if breaks” means and if we should worry?
tried a clean instance on the version-13-beta, get this when I execute erpnext.demo.demo.make
File "apps/frappe/frappe/model/document.py", line 798, in _validate_mandatory
raise frappe.MandatoryError('[{doctype}, {name}]: {fields}'.format(
frappe.exceptions.MandatoryError: [POS Profile, Demo POS Profile]: warehouse
then
File "apps/frappe/frappe/__init__.py", line 1642, in safe_eval
return eval(code, eval_globals, eval_locals)
File "<string>", line 1, in <module>
NameError: name 'erpnext' is not defined
if I continue and run bench --site mysite execute erpnext.demo.demo.simulate
it fails on
File "apps/erpnext/erpnext/demo/user/fixed_asset.py", line 43, in get_random_asset
return frappe.db.sql(""" select name, item_code, value_after_depreciation, gross_purchase_amount
IndexError: list index out of range
would really like to get some fixtures / demo-data in v13 when testing around
can anyone pls help howto
running the test I got the following
======================================================================
ERROR: test_invalid_serial_no_validation (erpnext.accounts.doctype.pos_invoice.test_pos_invoice.TestPOSInvoice)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py", line 496, in test_invalid_serial_no_validation
self.assertRaises(frappe.ValidationError, pos.submit)
File "/usr/local/lib/python3.9/unittest/case.py", line 739, in assertRaises
return context.handle('assertRaises', args, kwargs)
File "/usr/local/lib/python3.9/unittest/case.py", line 201, in handle
callable_obj(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1018, in submit
return self._submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1007, in _submit
return self.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 310, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 347, in _save
self.run_before_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1055, in run_before_save_methods
self.run_method("validate")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 941, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1260, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1242, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 938, in fn
return method_object(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 50, in validate
self.validate_stock_availablility()
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 231, in validate_stock_availablility
self.validate_invalid_serial_nos(d)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/pos_invoice/pos_invoice.py", line 211, in validate_invalid_serial_nos
frappe.throw(error_msg, title=_("Invalid Item"), as_list=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 503, in throw
msgprint(
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 448, in msgprint
print(f"Message: {strip_html_tags(out.message)}")
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 345, in strip_html_tags
return re.sub("\<[^>]*\>", "", text)
File "/usr/local/lib/python3.9/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object