Hooks for Address doctype not working

I’m having some trouble hooking Address doctype. I want to autofill the address_title field, but there is a throw(_(“Address Title is mandatory.”)) in autoname method of Address doctype which I think overrides my hook.

I’ve added this to hooks.py of my custom app (let’s call it “myapp”):

doc_events = {
    "Address": {
        "autoname": "myapp.hooks.nome_endereco",
        "before_save": "myapp.hooks.nome_endereco"
    }
 }
def nome_endereco(doc, method):
  doc.address_title = doc.address_line1
  if method == "autoname":
    doc.name = doc.address_title

But I still get “Address Title is mandatory” error…

Is Address doctype hookable? If yes, why my code isn’t working?

Thanks

PS: I saw that ERPnext overrides the default Frappe Address doctype on its hooks.py:
override_doctype_class = {“Address”: “erpnext.accounts.custom.address.ERPNextAddress”}

Maybe my override is being annuled by it?
Is it possible to “override an override”??

Solved it using before_insert hook instead of autoname and before_save …