Unable to save address

App Versions

{
	"erpnext": "16.0.0-dev",
	"frappe": "16.0.0-dev"
}

Route

Form/Address/new-address-buysiktnuk

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 116, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 51, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 84, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1461, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/desk/form/save.py", line 43, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 484, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 506, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 414, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1277, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 1128, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1517, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1495, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 1125, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/custom/address.py", line 12, in validate
    self.validate_reference()
  File "apps/erpnext/erpnext/accounts/custom/address.py", line 29, in validate_reference
    if self.is_your_company_address and not [row for row in self.links if row.link_doctype == "Company"]:
AttributeError: 'ERPNextAddress' object has no attribute 'is_your_company_address'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"docstatus\":0,\"doctype\":\"Address\",\"name\":\"new-address-buysiktnuk\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"atulraj@gennextit.com\",\"address_type\":\"Billing\",\"emirate\":\"\",\"country\":\"United Arab Emirates\",\"is_primary_address\":0,\"is_shipping_address\":0,\"disabled\":0,\"links\":[{\"docstatus\":0,\"doctype\":\"Dynamic Link\",\"name\":\"new-dynamic-link-sdkmitytxa\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"atulraj@gennextit.com\",\"parent\":\"new-address-buysiktnuk\",\"parentfield\":\"links\",\"parenttype\":\"Address\",\"idx\":1,\"link_doctype\":\"Customer\",\"link_name\":\"Ashutosh\"}],\"address_title\":\"Office Branch Noida\",\"address_line1\":\"Sector 123\",\"city\":\"Great City\"}",
		"action": "Save"
	},
	"btn": {
		"jQuery370079617501432744381": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 1576,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

{
	"exception": "AttributeError: 'ERPNextAddress' object has no attribute 'is_your_company_address'",
	"exc_type": "AttributeError",
	"_exc_source": "erpnext (app)"
}

Please help me with this issue i am unable to create the address.

Check that is_your_company_address field is present in json file at apps/erpnext/erpnext/accounts/custom/address.json

1 Like

That is coming because is_your_company_address field is missing and if that exist in the JSON file do the bench migrate

1 Like

Thank you!
i want to know do it have to do these changes and migrate everytime, when i freshly install ERPNext.

Thank you @Hemil_Sangani