Payment Terms Error Message

Hello all

We are having a problem on our self hosted site

Anytime we pick a party to create either a sales or purchase transaction we get the error message below

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 62, in application
response = frappe.handler.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 22, in handle
data = execute_cmd(cmd)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 53, in execute_cmd
return, **frappe.form_dict)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 939, in call
return fn(*args, **newargs)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/”, line 34, in get_party_details
company, posting_date, price_list, currency, doctype, ignore_permissions)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/”, line 39, in _get_party_details
out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/”, line 167, in set_account_and_due_date
“due_date”: get_due_date(posting_date, party_type, party, company)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/”, line 275, in get_due_date
template_name = get_pyt_term_template(party, party_type, company)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/”, line 374, in get_pyt_term_template
customer.customer_group, fieldname=‘payment_terms’)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 439, in get_value
order_by, cache=cache)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 483, in get_values
out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 615, in _get_values_from_table
as_dict=as_dict, debug=debug, update=update)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 166, in sql
self._cursor.execute(query, values)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 165, in execute
result = self._query(query)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 321, in _query
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 1061, in _read_query_result
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 1349, in read
first_packet = self.connection._read_packet()
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 1018, in _read_packet
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 384, in check_error
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (1054, u"Unknown column ‘payment_terms’ in ‘field list’")

Is their anyone that can throw light on what the issue is?

@tundebabzy any insight into what we need to do to payment terms to make this error message dissapear ?


I am getting quite desperate right now and am forced to tag people that can help, please forgive me and do not be annoyed

@KanchanChauhan please help
@rmehta please help
@Pawan please help

Like I said I am getting desperate forgive me for tagging you, I need urgent help

Do you have Payment Terms set up in the new way in your instance?

Since this is a self-hosted instance, not sure what else we can do really.

Thanks Pawan

The challenge I am having is that it is affecting all my instances not just one

did “bench migrate” run successfully for you?

No…we had errors with bench migrate

[17:54, 2/2/2018] Isael Amysan: Updating node libraries…
INFO:bench.utils:npm install
npm WARN frappe@ No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

up to date in 3.315s

That is the error message we get

Maybe share this link with your server admin. If bench migrate runs fine, you should be good.

Thanks we are looking at it now

Will let you know how it works out

There was a commit today that tweaked payment terms. You may want to see if this is linked. All I can say is that the upgrade to V10 worked for me with payment terms

We are getting stuck trying to do bench migrate, the error message stated above is still stopping us.

Meanwhile @Julian_Robbins you are right, the issue is with payment terms.

There is a field called Default Payment Term Template (name is payment_terms), its hidden and sales and purchase invoice expects to see a something on that field for all customers and suppliers.

I am sure if we are able to conclude the bench migrate we will be ok, but we have tried all we know …no solution.

@noetico would you mind lending a helping hand here, been at this all day.

Emmm. If you cannot update due to the OS - what OS is in use? - then you may have to look at the columns in the dB for tables customer and supplier; see if the payment terms field exists.

Are you able to login to erpnext or you have an error on the system? If you can login, head to the doctypes (I realized customize form doesn’t work in v9 and 10; changes are discarded) for the customer and supplier, add the field‎ and in the Default for the new field enter the name of the payment term. The name of your new field should be Payment Term.

If you cannot login; and you can’t update fully; maybe you can try adding this field in the database using ALTER table; after that, use update table to set the value against all the customer and supplier entries.

@olamide_shodunke this must be as a result of a failed migration. I’m just taking a stab in the dark here but have a look at the Payment Term Template fields in Doctype List and compare with what you have in your database.

You are perfectly right. It was a result of a failed migration.


Absolutely right Bench migration issue … Thank you guys