Skip to content

Commit

Permalink
[ADD] event_calendar_res_partner_map_view
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis committed Sep 20, 2024
1 parent 62404a8 commit c35bb8c
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
78 changes: 78 additions & 0 deletions event_calendar_res_partner_map_view/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://opensource.org/licenses/LGPL-3.0
:alt: License: LGPL-3

===================================
Event Calendar Res Partner Map View
===================================

Overview
========

The **Event Calendar Res Partner Map View** module adds a map view to calendar events, allowing users to link a visit address to `res.partner`. This enhancement provides a visual representation of event locations, making it easier to plan visits.

Features
========

- **Visit Address**: Allows the selection of a partner as the visit address for calendar events.
- **Map View**: Displays a map showing the location of the selected visit address.

Usage
=====

1. **Install the Module**:

- Install the module through the Odoo apps interface or by placing it in your Odoo addons directory.

2. **Access Calendar Events**:

- Navigate to **Calendar** > **Events**.

3. **View Visit Address**:

- Open any calendar event to select a visit address.

4. **Map Display**:

- Access the map view to see the location of the selected visit address.

Configuration
=============

- **User Permissions**:

- Ensure that users have the necessary permissions to view calendar events and partner records.

Testing
=======

Test the following scenarios:

- **Field Visibility**:

- Verify that the `Visit Address` field is correctly displayed in the calendar event form view.

- **Map Functionality**:

- Check that the map view displays the correct location based on the selected visit address.

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

For bugs and issues, please visit `GitHub Issues <https://github.com/avanzosc/event-addons/issues>`_ to report or track issues.

Credits
=======

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

* Unai Beristain <[email protected]>

* Ana Juaristi <[email protected]>

Please contact contributors for module-specific questions, but direct support requests should be made through the official channels.

License
=======
This project is licensed under the LGPL-3 License. For more details, please refer to the LICENSE file or visit <https://opensource.org/licenses/LGPL-3.0>.
1 change: 1 addition & 0 deletions event_calendar_res_partner_map_view/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions event_calendar_res_partner_map_view/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Event Calendar Res Partner Map View",
"version": "16.0.1.0.0",
"author": "Avanzosc",
"summary": "Add a map view to calendar events with a visit address linked to res.partner.",
"website": "https://github.com/avanzosc/odoo-addons",
"license": "LGPL-3",
"depends": [
"calendar",
"base",
"web_map",
],
"data": [
"views/calendar_event_view.xml",
],
"installable": True,
"application": False,
}
1 change: 1 addition & 0 deletions event_calendar_res_partner_map_view/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_event
11 changes: 11 additions & 0 deletions event_calendar_res_partner_map_view/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class CalendarEvent(models.Model):
_inherit = "calendar.event"

visit_address_id = fields.Many2one(
"res.partner",
string="Visit Address",
help="Select the partner for the visit address.",
)
23 changes: 23 additions & 0 deletions event_calendar_res_partner_map_view/views/calendar_event_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_calendar_event_form_inherit_map" model="ir.ui.view">
<field name="name">calendar.event.form.inherit.map</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_ids']" position="after">
<field name="visit_address_id" />
</xpath>
</field>
</record>

<record id="view_calendar_event_map" model="ir.ui.view">
<field name="name">calendar.event.map</field>
<field name="model">calendar.event</field>
<field name="arch" type="xml">
<map string="Event Location" zoom="12" center="40.712776,-74.005974">
<marker lat="40.712776" lon="-74.005974" name="Visit Address" />
</map>
</field>
</record>
</odoo>

0 comments on commit c35bb8c

Please sign in to comment.