Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions fieldservice_base_location/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
=============================
Field Service - Base location
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6b800e15ce2d6d2ff13ba4364f50a8106f52f7fb2f27c9c69a103a05fbc5302a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github
:target: https://github.com/OCA/field-service/tree/17.0/fieldservice_base_location
:alt: OCA/field-service
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_base_location
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the zip_id field to the fsm.location form, enabling
automatic address completion based on the ZIP code entered in the
location’s completion field.

**Table of contents**

.. contents::
:local:

Usage
=====

1. Go to Contacts → Configuration → ZIPs.

2. Create a new ZIP entry. (Tip: You can enhance this step by using the
base_location_geonames_import module.)

3. Navigate to Field Service → Master Data → Locations.

Select an existing location or create a new one.

In the address section, you’ll now see the ZIP code autocomplete field.
Simply enter the ZIP code, and the system will automatically fill in all
related address fields.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_base_location%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Apsl - Nagarro

Contributors
------------

- `APSL <https://apsl.tech>`__:

- Bernat Obrador <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-BernatObrador| image:: https://github.com/BernatObrador.png?size=40px
:target: https://github.com/BernatObrador
:alt: BernatObrador

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-BernatObrador|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/17.0/fieldservice_base_location>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions fieldservice_base_location/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions fieldservice_base_location/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2025 Bernat Obrador (APSL - Nagarro)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Field Service - Base location",
"summary": "Autocomplete address in field service locations",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"category": "Field Service",
"author": "Apsl - Nagarro, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/field-service",
"depends": ["fieldservice", "base_location"],
"data": [
"views/fsm_location.xml",
],
"auto_install": True,
"maintainers": ["BernatObrador"],
}
21 changes: 21 additions & 0 deletions fieldservice_base_location/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fieldservice_base_location
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-03 12:26+0000\n"
"PO-Revision-Date: 2025-04-03 12:26+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: fieldservice_base_location
#: model_terms:ir.ui.view,arch_db:fieldservice_base_location.fsm_location_form_view_address_autocomplete_inherit
msgid "Location completion"
msgstr "Finalització de la ubicació"
21 changes: 21 additions & 0 deletions fieldservice_base_location/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fieldservice_base_location
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-03 12:27+0000\n"
"PO-Revision-Date: 2025-04-03 12:27+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: fieldservice_base_location
#: model_terms:ir.ui.view,arch_db:fieldservice_base_location.fsm_location_form_view_address_autocomplete_inherit
msgid "Location completion"
msgstr "Completado de ubicación"
1 change: 1 addition & 0 deletions fieldservice_base_location/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import fsm_location
46 changes: 46 additions & 0 deletions fieldservice_base_location/models/fsm_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from odoo import models


class FsmLocation(models.Model):
_inherit = "fsm.location"

def write(self, vals):
for record in self:
partner = record.partner_id
if not partner:
continue

vals = vals.copy()

zip_id = vals.get("zip_id") or (record.zip_id.id or False)
zip_rec = self.env["res.city.zip"].browse(zip_id) if zip_id else False
new_zip = vals.get("zip", record.zip)

if zip_rec and zip_rec.exists() and zip_rec.name != new_zip:
vals["zip_id"] = False
if partner.zip_id:
partner.zip_id = False

partner_updates = {
key: vals[key]
for key in [
"zip",
"city",
"state_id",
"country_id",
"street",
"street2",
]
if key in vals
and vals[key]
!= (
getattr(partner, key).id
if key.endswith("_id")
else getattr(partner, key)
)
}

if partner_updates:
partner.write(partner_updates)

return super().write(vals)
3 changes: 3 additions & 0 deletions fieldservice_base_location/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions fieldservice_base_location/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [APSL](https://apsl.tech):
- Bernat Obrador \<<[email protected]>\>
1 change: 1 addition & 0 deletions fieldservice_base_location/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the zip_id field to the fsm.location form, enabling automatic address completion based on the ZIP code entered in the location’s completion field.
11 changes: 11 additions & 0 deletions fieldservice_base_location/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1. Go to Contacts → Configuration → ZIPs.

2. Create a new ZIP entry.
(Tip: You can enhance this step by using the base_location_geonames_import module.)

3. Navigate to Field Service → Master Data → Locations.

Select an existing location or create a new one.

In the address section, you’ll now see the ZIP code autocomplete field.
Simply enter the ZIP code, and the system will automatically fill in all related address fields.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading