Changes in Custom App not working

Hello Guys, Im a beginner in programming.

I build a custom app but it seems to not reflecting the changes i made? I already created a doctype name Members and i’m trying to customize the autonaming of the doctype. i have 2 fields in my doctype : member_name, mobile_number

even printing a message using print “Test” not reflecting in my terminal. i also used frappe.throw(_(“Test”)) but still nothing happened.

below is my code:

from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.naming import make_autoname
from frappe.model.document import Document

class Members(Document):
      def autoname(self):
          self.name = make_autoname("G-" + self.member_name)

@jhe01

Seems like okay.
Any error in console? Which name do you find after saving the document ?

1 Like

@Sangram

Thanks for the reply Sangram

There are no errors in console. even if i try to make an error purposely there are no indications of error.

don’t know if i understand it correctly but in my views i have this auto generated name field. see the image below:

and as i see, my code is not working …i already clear the cache using bench --site sitename clear-cache in frappe-bench folder but still the changes is not working.

Strange. Under which module/app you created this doctype? If you are in development setup create a new site, install the same app there and try it on the new site.

i have created a new custom app using bench new-app custom_app and a new site and install the custom app in the new site.

and watch repeatedly tutorials in youtube but can’t find what i have done wrong.

@jhe01

I have done this in my case. and it works for me.

class Member(Document):
def autoname(self):
self.name=str(self.first_name + " " + self.last_name)

1 Like

@pooja seriously? urgh :expressionless: …how is this happening?

All i did was:

  1. Create an app using bench new-app custom-app
  2. Create a new site using bench new-site sitename
  3. Set developer mode in new site using bench --site sitename set-config developer_mode 1
  4. Install app in new site using bench --site sitename install-app custom-app

did i do something wrong?

Check whether you installed an app on your current site. Because, lots of time, we installed apps somewhere else and working on some other site.

Also, do bench migrate

e.g. bench --site all migrate

1 Like

@Sangram still the same. and im sure my apps is installed in the right site cause i can see it in the desk main page.

@jhe01

It’s difficult to find out an issue from here. Do create new doctype under your custom app and try same for it.

@Sangram sorry for late reply.

as i’ve done your instruction i notice that when i create a new doctype in UI, frappe automatically creates the doctype folder corresponding on the created doctype in UI in my custom_app …

if i can remember i created the custom app first and install it in the site then create new doctype but it didnt create the files in my app so i have created its own files. maybe thats what i did wrong?

the problem already solved. but now the autoname seems to have an auto inrementing number

anyway thanks @Sangram for the instruction really appreciate it :grinning::v: