Version 11 to 12 data schema - AttributeError: ‘Subscription’ object has no attribute ‘naming_series’

Hi, I was able to do a fresh install of version 12 and then did a export from my v11 and import to 12.
Everything went fine, all data there no know errors.
I had an issue in V11 trying to create subscriptions with an error
AttributeError: ‘Subscription’ object has no attribute ‘naming_series’

In version 12 clean it works just fine. But when i imported V11 data i get the error again. I assuming that the schema of V11 overwrote V12?

Command used to import into 12
bench --force restore --with-public-files /home/mrsadmin/backup/20190927_081756-site1_local-files.tar --with-private-files /home/mrsadmin/backup/20190927_081756-site1_local-private-files.tar /home/mrsadmin/backup/20190927_081756-site1_local-database.sql.gz
bench --site mrs.site migrate

Any thoughts? Anyway to update V12 schema?

Thanks

Stop the server, perform your bench restore, then start bench,

Then, in another window, run the bench migrate

Thanks for the info. I ssh with on session and did the restore and with another ssh session i did the migrate and still have the same error.
AttributeError: ‘Subscription’ object has no attribute ‘naming_series’

First ssh
sudo service supervisor stop
sudo service nginx stop
bench -force restore …
bench start


ssh with another terminal
did the migrate.
bench --site erp.mysite migrate

Did not see any errors in the process

Please copy and paste your traceback here for the record thanks!

Apparently Subscription has issues Subscriptions gone wrong? - #11 by federico_calvo

That may help @federico_calvo and @Nahuel_Nso troubleshoot…

1 Like

Before i import the data in a fresh install of v12 i am able to create subscription without any issues.

[ERROR] 2019-10-04 12:31:59,027 | /home/mrsadmin/frappe-bench/apps/frappe/frappe/app.py:
Site: mrs.site
Form Dict: {
“action”: “Save”,
“cmd”: “frappe.desk.form.save.savedocs”,
“doc”: "{"docstatus":0,"doctype":"Subscription","name":"New Subscription 2","__islocal":1,"__unsaved":1,"owner":"russ@mrsmmc.com",
“status":"","days_until_due":12,"cancel_at_period_end":0,"generate_invoice_at_period_start":0,"apply_additional_discount":"","plans":[{
"docstatus":0,"doctype":"Subscription Plan Detail","name":"New Subscription Plan Detail 2","__islocal":1,"__unsaved":1,"owner":"russ@
mrsmmc.com","parent":"New Subscription 2","parentfield":"plans","parenttype":"Subscription","idx":1,"qty":1,"plan":"Test plan"}],
"customer":"Titan Heating","start":"2019-10-01"}”
}
Request Error
Traceback (most recent call last):
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 271, in save
return self._save(*args, **kwargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 294, in _save
self.insert()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 223, in insert
self.set_new_name()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 391, in set_new_name
set_new_name(self)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/naming.py”, line 42, in set_new_name
set_name_from_naming_options(autoname, doc)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/naming.py”, line 71, in set_name_from_naming_options
set_name_by_naming_series(doc)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/naming.py”, line 81, in set_name_by_naming_series
if not doc.naming_series:
AttributeError: ‘Subscription’ object has no attribute ‘naming_series’
[ERROR] 2019-10-04 12:31:59,219 | /home/mrsadmin/frappe-bench/apps/frappe/frappe/utils/error.py:
Could not take error snapshot: startswith first arg must be str or a tuple of str, not bytes
Traceback (most recent call last):
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 271, in save
return self._save(*args, **kwargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 294, in _save

It seems your v11 data restore to v12 has a pending unsaved New Subscription that disagrees with say a Subscription change that occurred.

Why not delete that v11 problem one and create a new subscription in v12?

I delete the subscription plan and created a new one. Went to add a subscription and got same error
the plan names was CreatedinV12

[ERROR] 2019-10-04 14:43:42,533 | /home/mrsadmin/frappe-bench/apps/frappe/frappe/app.py:
Site: mrs.site
Form Dict: {
“action”: “Save”,
“cmd”: “frappe.desk.form.save.savedocs”,
“doc”: "{"docstatus":0,"doctype":"Subscription","name":"New Subscription 3","__islocal":1,"__unsaved":1,"owner":"russ@mrsmmc.com",
“status":"","days_until_due":15,"cancel_at_period_end":0,"generate_invoice_at_period_start":0,"apply_additional_discount":"","plans":[{
"docstatus":0,"doctype":"Subscription Plan Detail","name":"New Subscription Plan Detail 3","__islocal":1,"__unsaved":1,"owner":"russ@
mrsmmc.com","parent":"New Subscription 3","parentfield":"plans","parenttype":"Subscription","idx":1,"qty":1,"plan":"CreatedinV12"
}],"customer":"Titan Heating","start":"2019-10-01"}”
}
Request Error
Traceback (most recent call last):
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 271, in save
return self._save(*args, **kwargs)
File “/home/mrsadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 294, in _save
self.insert()

ok if this does not help

bench reload-doc accounts doctype subscription 

Please report this here - you pick the issue or add a new one Issues · frappe/erpnext · GitHub

This is how I fixed this issue,
Open Subscription, then Go to Customize, Under Naming remove “:” column sign
naming_series: change to naming_series