Metadata-Version: 2.1
Name: odoo-addon-shopinvader_anonymous_partner
Version: 18.0.1.0.0.2
Requires-Python: >=3.10
Requires-Dist: odoo-addon-queue_job==18.0.*
Requires-Dist: odoo==18.0.*
Summary: Manage anonymous partners with a cookie.
Home-page: https://github.com/shopinvader/odoo-shopinvader
License: LGPL-3
Author: ACSONE SA/NV
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

=============================
Shopinvader Anonymous Partner
=============================

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

.. |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/license-LGPL--3-blue.png
    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
    :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github
    :target: https://github.com/shopinvader/odoo-shopinvader/tree/18.0/shopinvader_anonymous_partner
    :alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

This module allows the creation of temporary partners for anonymous
visitors, and set a cookie to establish a session for these partners.

**Table of contents**

.. contents::
   :local:

Usage
=====

The following model methods are added in a helper model:

``_create_anonymous_partner__cookie(response)``

   Create a new anonymous partner and set the
   ``shopinvader-anonymous-partner`` cookie. Return the newly created
   partner record.

   ``response`` is typically the http response, it must have a
   ``set_cookie()`` method. It is known to work with
   ``odoo.http.request.future_response`` and FastAPI ``Response``
   objects.

``_get_anonymous_partner__cookie(cookies)``

   Return the partner record corresponding to the
   ``shopinvader-anonymous-partner`` cookie in the current request, if
   any. Returns an empty record set if the cookie is not set or if the
   corresponding partner was not found.

   ``cookies`` is the cookies dictionary from the http request.

Note the record sets returned by these methods are in a sudo'ed
environment, so handle with care.

Known issues / Roadmap
======================

- some cron to remove old anonymous partners

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

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader/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/shopinvader/odoo-shopinvader/issues/new?body=module:%20shopinvader_anonymous_partner%0Aversion:%2018.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
-------

* ACSONE SA/NV

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

This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/18.0/shopinvader_anonymous_partner>`_ project on GitHub.

You are welcome to contribute.
