connector-telephony icon indicating copy to clipboard operation
connector-telephony copied to clipboard

[17.0] AttributeError in phone_validation – 'res.country' object has no attribute 'get'

Open flowersofpepper opened this issue 5 months ago • 1 comments

Odoo Version

  • [ ] 16.0
  • [x] 17.0
  • [ ] 18.0
  • [ ] Other (specify)

Steps to Reproduce

Trigger a phone validation process (e.g., submit a form like for example shipping address that uses phone_validation, the shipping address will not get saved and it will show an error)

Versions Affected This issue was identified with the following Odoo Docker versions:

17.0-20250218: No error observed. 17.0-20250311: The error in the phone validation module is present. 17.0-20250320: The error in the phone validation module persists.

Upon checking, I noticed that in version 17.0-20250311 Odoo has now added similar functionality directly into the core (phone_validation module), which makes the extension redundant or potentially conflicting.

The same error mentioned below happens, but the error message is related to the phone_validation module.

https://github.com/odoo/odoo/issues/149428

Log Output

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1788, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 154, in retrying
env.cr.flush() # submit the changes to the database
File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 137, in flush
self.transaction.flush()
File "/usr/lib/python3/dist-packages/odoo/api.py", line 879, in flush
env_to_flush.flush_all()
File "/usr/lib/python3/dist-packages/odoo/api.py", line 737, in flush_all
self._recompute_all()
File "/usr/lib/python3/dist-packages/odoo/api.py", line 733, in _recompute_all
self[field.model_name]._recompute_field(field)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6978, in _recompute_field
field.recompute(records)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1379, in recompute
apply_except_missing(self.compute_value, recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1352, in apply_except_missing
func(records)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1401, in compute_value
records._compute_field_value(self)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 424, in _compute_field_value
return super()._compute_field_value(field)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4924, in _compute_field_value
fields.determine(field.compute, self)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 102, in determine
return needle(*args)
File "/usr/lib/python3/dist-packages/odoo/addons/phone_validation/models/mail_thread_phone.py", line 155, in _compute_phone_sanitized
sanitized = record._phone_format(fname=fname)
File "/usr/lib/python3/dist-packages/odoo/addons/phone_validation/models/models.py", line 84, in _phone_format
country = self._phone_get_country().get(self.id)
AttributeError: 'res.country' object has no attribute 'get'

Support Ticket

No response

flowersofpepper avatar Jul 21 '25 12:07 flowersofpepper

I'm using asterisk_click2dial addon, and it needs the base_phone. base_phone is mandatory so once I uninstall base_pbone asterisk_click2dial also gets uninstalled. Is there any way out of this? So I'm not able to just uninstall base_phone app, which some people can do and which seems to solve the issue for some people.

flowersofpepper avatar Jul 25 '25 17:07 flowersofpepper