Delivery Note Did Not Save

49 views
Skip to first unread message

CJ

unread,
Feb 14, 2014, 6:08:12 PM2/14/14
to erpnext-dev...@googlegroups.com
Why am I always facing this error? Is there something in the master setting or account I did incorrectly or some kind of wrong procedure?
I saw some kind of mentioning regarding Journal Voucher, I didn't key anything about JV.

Error log.

Traceback (innermost last):
  File "lib/webnotes/widgets/form/save.py", line 18, in savedocs
    getattr(wrapper, action.lower())()
  File "lib/webnotes/model/bean.py", line 321, in submit
    self.run_method('on_submit')
  File "lib/webnotes/model/bean.py", line 239, in run_method
    getattr(self.controller, method)(*args, **kwargs)
  File "app/stock/doctype/delivery_note/delivery_note.py", line 163, in on_submit
    self.make_gl_entries()
  File "app/controllers/stock_controller.py", line 23, in make_gl_entries
    make_gl_entries(gl_entries)
  File "app/accounts/general_ledger.py", line 18, in make_gl_entries
    save_entries(gl_map, adv_adj, update_outstanding)
  File "app/accounts/general_ledger.py", line 63, in save_entries
    validate_account_for_auto_accounting_for_stock(gl_map)
  File "app/accounts/general_ledger.py", line 92, in validate_account_for_auto_accounting_for_stock
    if gl_map[0].voucher_type=="Journal Voucher":
 IndexError: list index out of range
Traceback (innermost last):
  File "lib/webnotes/handler.py", line 78, in handle
    execute_cmd(cmd)
  File "lib/webnotes/handler.py", line 118, in execute_cmd
    ret = call(method, webnotes.form_dict)
  File "lib/webnotes/handler.py", line 140, in call
    return fn(**newargs)
  File "lib/webnotes/widgets/form/save.py", line 18, in savedocs
    getattr(wrapper, action.lower())()
  File "lib/webnotes/model/bean.py", line 321, in submit
    self.run_method('on_submit')
  File "lib/webnotes/model/bean.py", line 239, in run_method
    getattr(self.controller, method)(*args, **kwargs)
  File "app/stock/doctype/delivery_note/delivery_note.py", line 163, in on_submit
    self.make_gl_entries()
  File "app/controllers/stock_controller.py", line 23, in make_gl_entries
    make_gl_entries(gl_entries)
  File "app/accounts/general_ledger.py", line 18, in make_gl_entries
    save_entries(gl_map, adv_adj, update_outstanding)
  File "app/accounts/general_ledger.py", line 63, in save_entries
    validate_account_for_auto_accounting_for_stock(gl_map)
  File "app/accounts/general_ledger.py", line 92, in validate_account_for_auto_accounting_for_stock
    if gl_map[0].voucher_type=="Journal Voucher":
 IndexError: list index out of range

Nabin Hait

unread,
Feb 16, 2014, 6:54:59 AM2/16/14
to erpnext-dev...@googlegroups.com
Are you inserting Delivery Note through API? In that case, I think doclist is not properly created and hence gl_map values are not coming properly. 

To debug, you should print "gl_entries" at line 23 in app/controllers/stock_cotrollers.py. The expected value should be type of list of dictionary.


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/5a4ff0ed-6270-47df-90a7-25a1ca2c7f98%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

CJ

unread,
Feb 16, 2014, 7:03:52 AM2/16/14
to erpnext-dev...@googlegroups.com
Hi. I am just doing normal PO -> Purchase Receipt -> Delivery Note.
No custom script or any thing. Line 23? It says "self.update_gl_entries_after(warehouse_account)

Do you mean executing command to get this value? How do I do it?
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Nabin Hait

unread,
Feb 16, 2014, 7:08:55 AM2/16/14
to erpnext-dev...@googlegroups.com
Add `webnotes.errprint(["gl entries: ", gl_entries])` before the line `make_gl_entries(gl_entries)`.

Then try to submit the delivery note, after getting error message, check browser's console. You will find the values of gl_entries printed in the console.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/ddbfebfb-5603-44e1-b803-4f42b63ac4e3%40googlegroups.com.

CJ

unread,
Feb 16, 2014, 7:26:37 AM2/16/14
to erpnext-dev...@googlegroups.com
I added the line but I didn't see any printed value, maybe I did not do it correctly?

Traceback (innermost last): File "lib/webnotes/widgets/form/save.py", line 18, in savedocs getattr(wrapper, action.lower())() File "lib/webnotes/model/bean.py", line 321, in submit self.run_method('on_submit') File "lib/webnotes/model/bean.py", line 239, in run_method getattr(self.controller, method)(*args, **kwargs) File "app/stock/doctype/delivery_note/delivery_note.py", line 163, in on_submit self.make_gl_entries() File "app/controllers/stock_controller.py", line 23, in make_gl_entries webnotes.errprint(["gl entries: ", gl_entries]) File "app/accounts/general_ledger.py", line 18, in make_gl_entries save_entries(gl_map, adv_adj, update_outstanding) File "app/accounts/general_ledger.py", line 63, in save_entries validate_account_for_auto_accounting_for_stock(gl_map) File "app/accounts/general_ledger.py", line 92, in validate_account_for_auto_accounting_for_stock if gl_map[0].voucher_type=="Journal Voucher": IndexError: list index out of range
Traceback (innermost last): File "lib/webnotes/handler.py", line 78, in handle execute_cmd(cmd) File "lib/webnotes/handler.py", line 118, in execute_cmd ret = call(method, webnotes.form_dict) File "lib/webnotes/handler.py", line 140, in call return fn(**newargs) File "lib/webnotes/widgets/form/save.py", line 18, in savedocs getattr(wrapper, action.lower())() File "lib/webnotes/model/bean.py", line 321, in submit self.run_method('on_submit') File "lib/webnotes/model/bean.py", line 239, in run_method getattr(self.controller, method)(*args, **kwargs) File "app/stock/doctype/delivery_note/delivery_note.py", line 163, in on_submit self.make_gl_entries() File "app/controllers/stock_controller.py", line 23, in make_gl_entries webnotes.errprint(["gl entries: ", gl_entries]) File "app/accounts/general_ledger.py", line 18, in make_gl_entries save_entries(gl_map, adv_adj, update_outstanding) File "app/accounts/general_ledger.py", line 63, in save_entries validate_account_for_auto_accounting_for_stock(gl_map) File "app/accounts/general_ledger.py", line 92, in validate_account_for_auto_accounting_for_stock if gl_map[0].voucher_type=="Journal Voucher": IndexError: list index out of range

Nabin Hait

unread,
Feb 16, 2014, 7:37:51 AM2/16/14
to erpnext-dev...@googlegroups.com
Share the code through pastebin.com, after adding the line

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f2f74475-28cc-4172-9ac6-62c3c4b8756c%40googlegroups.com.

CJ

unread,
Feb 16, 2014, 8:08:22 AM2/16/14
to erpnext-dev...@googlegroups.com

rushabh

unread,
Feb 17, 2014, 12:21:59 AM2/17/14
to erpnext-dev...@googlegroups.com
Can you share the script by which you are pushing the doclist? Or the doclist that is generated from your script?

On Sunday, February 16, 2014 6:38:22 PM UTC+5:30, CJ wrote:

CJ

unread,
Feb 17, 2014, 12:24:41 AM2/17/14
to erpnext-dev...@googlegroups.com
Certainly I would love too but pardon me how do I need to do to retrieve the doclist?

Nabin Hait

unread,
Feb 17, 2014, 12:32:24 AM2/17/14
to erpnext-dev...@googlegroups.com
It must print gl_entries value in the console. Can you check again? The print should appear before the traceback message.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/688f23c3-cd4f-45c0-9d0c-88a43f5fea8e%40googlegroups.com.

CJ

unread,
Feb 17, 2014, 12:37:57 AM2/17/14
to erpnext-dev...@googlegroups.com
Hi Nabin,

I added that line in 

if self.doc.docstatus==1:
gl_entries = self.get_gl_entries(warehouse_account)
webnotes.errprint(["gl entries: ", gl_entries])
make_gl_entries(gl_entries)

but the console didn't print the value but it print the line. I was wonder is that a type in my statement or do I need to restart the machine/clear cache or something?

File "app/stock/doctype/delivery_note/delivery_note.py", line 163, in on_submit
    self.make_gl_entries()
  File "app/controllers/stock_controller.py", line 23, in make_gl_entries
    webnotes.errprint(["gl entries: ", gl_entries])
  File "app/accounts/general_ledger.py", line 18, in make_gl_entries
    save_entries(gl_map, adv_adj, update_outstanding)


CJ

unread,
Feb 17, 2014, 12:47:25 AM2/17/14
to erpnext-dev...@googlegroups.com
I restarted the server and now I saw this: "File "app/controllers/stock_controller.py", line 23 webnotes.errprint(["gl entries: ", gl_entries])"  SyntaxError: invalid syntax

I guess that is a good sign it is trying to execute. Why is there syntax error?

CJ

unread,
Feb 17, 2014, 1:09:10 AM2/17/14
to erpnext-dev...@googlegroups.com
Hi, I am able to print now.

[u'gl entries: ', [{u'aging_date': u'2014-02-15', u'company': u'Graphical Application', u'is_opening': u'No', u'fiscal_year': u'2013-2014', u'against': u'Finished Goods - GA', u'voucher_type': u'Delivery Note', u'credit': 0.0, u'debit': 0.0, u'remarks': u'Accounting Entry for Stock', u'posting_date': u'2014-02-15', u'voucher_no': u'DN00001', u'account': u'Finished Goods - GA', u'cost_center': u'Main - GA'}]]

Means anything for debugging?


On Monday, 17 February 2014 13:37:57 UTC+8, CJ wrote:

Nabin Hait

unread,
Feb 17, 2014, 1:20:52 AM2/17/14
to erpnext-dev...@googlegroups.com
Looking like you have selected "Finished Goods - GA" as "Difference Account" in Delivery Note item table, which is same as account for the warehouse. In delivery note, the difference account should be an expense account.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/81d9e180-3af1-47db-ac7e-1f7613f49bb8%40googlegroups.com.

CJ

unread,
Feb 17, 2014, 1:38:23 AM2/17/14
to erpnext-dev...@googlegroups.com
Hi Nabit, I want to thank you. That is the cause the the error.
Can I request the such error to be such clearer or offer more clues to user what is wrong other than "Do not saved"?

Nabin Hait

unread,
Feb 17, 2014, 1:40:01 AM2/17/14
to erpnext-dev...@googlegroups.com
Sure, I will add a validation message for that.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/2e1a47eb-7895-474c-b20f-b7eb3b3ad96d%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages