Metadata-Version: 2.1
Name: odoo12-addon-web-widget-google-map-drawing
Version: 12.0.1.0.0.99.dev4
Summary: Add drawing tools to Google Map view in Odoo
Home-page: https://github.com/OCA/geospatial
Author: Yopi Angi, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 12.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Requires-Python: >=3.5
Requires-Dist: odoo12-addon-web-view-google-map
Requires-Dist: odoo <12.1dev,>=12.0a

=============================
Google Map View Drawing Mixin
=============================

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

.. |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%2Fgeospatial-lightgray.png?logo=github
    :target: https://github.com/OCA/geospatial/tree/12.0/web_widget_google_map_drawing
    :alt: OCA/geospatial
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/geospatial-12-0/geospatial-12-0-web_widget_google_map_drawing
    :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/geospatial&target_branch=12.0
    :alt: Try me on Runboat

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

This module extends the Google Map web view in Odoo to allow users to draw
polygons, rectangles, and circles on the map.

[![Demo](https://i.ytimg.com/vi/DDUFT6XP8AU/2.jpg)](https://youtu.be/DDUFT6XP8AU "Demo")    
  
More information about the drawing tools can be found [here](https://developers.google.com/maps/documentation/javascript/examples/drawing-tools)

This module will support three kind of shapes:
- [Rectangle](https://developers.google.com/maps/documentation/javascript/examples/rectangle-simple)
- [Polygon](https://developers.google.com/maps/documentation/javascript/examples/polygon-simple)
- [Circle](https://developers.google.com/maps/documentation/javascript/examples/polygon-simple)

**Table of contents**

.. contents::
   :local:

Usage
=====

This module provides an extendable framework and cannot be used on its own.
The following provides information on how to implement it for your own module.

## Drawing Mixin

To ease the implementation of this feature, a mixin class has been defined that you can use in your model

.. code-block:: python

    class GoogleMapDrawingShapeMixin(models.AbstractModel):
        _name = 'google.map.drawing.shape.mixin'
        _description = 'Google Maps Shape Mixin'
        _rec_name = 'shape_name'

        shape_name = fields.Char(string='Name')
        shape_area = fields.Float(string='Area')
        shape_radius = fields.Float(string='Radius')
        shape_description = fields.Text(string='Description')
        shape_type = fields.Selection([
            ('circle', 'Circle'),
            ('polygon', 'Polygon'),
            ('rectangle', 'Rectangle')],
            string='Type', default='polygon', required=True)
        shape_paths = fields.Text(string='Paths')

        @api.multi
        def decode_shape_paths(self):
            self.ensure_one()
            return safe_eval(self.shape_paths)

How to use the widget

.. code-block:: xml

     <field name="shape_paths" widget="map_drawing_shape"/>

How to load shape(s) on `map` view

.. code-block:: xml

    <record id="view_res_partner_area_map" model="ir.ui.view">
        <field name="name">view.res.partner.area.map</field>
        <field name="model">res.partner.area</field>
        <field name="arch" type="xml">
            <map library="drawing" string="Shape">
                <field name="partner_id"/>
                <field name="shape_name"/>
                <field name="shape_description"/>
                <field name="shape_type"/>
                <field name="shape_radius"/>
                <field name="shape_area"/>
                <field name="shape_paths"/>
                <templates>
                    <t t-name="kanban-box">
                        <div class="oe_kanban_global_click">
                            <div class="oe_kanban_details">
                                <strong class="o_kanban_record_title oe_partner_heading">
                                    <field name="shape_name"/>
                                </strong>
                                <div>
                                    <field name="shape_description"/>
                                </div>
                                <div attrs="{'invisible': [('shape_type', 'not in', ['rectangle', 'polygon'])]}">
                                    Area: <field name="shape_area"/>
                                </div>
                                <div attrs="{'invisible': [('shape_type', '!=', 'circle')]}">
                                    Radius: <field name="shape_radius"/>
                                </div>
                            </div>
                        </div>
                    </t>
                </templates>
            </map>
        </field>
    </record>

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/geospatial/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/geospatial/issues/new?body=module:%20web_widget_google_map_drawing%0Aversion:%2012.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
~~~~~~~

* Yopi Angi

Contributors
~~~~~~~~~~~~

* Yopi Angi <yopiangi@gmail.com>
* Brian McMaster <brian@mcmpest.com>

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-gityopie| image:: https://github.com/gityopie.png?size=40px
    :target: https://github.com/gityopie
    :alt: gityopie
.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px
    :target: https://github.com/brian10048
    :alt: brian10048

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

|maintainer-gityopie| |maintainer-brian10048| 

This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/12.0/web_widget_google_map_drawing>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.


