Skip to content

Commit

Permalink
[ADD] shopinvader_sale_cart_anonymous_partner
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Oct 7, 2024
1 parent bd2e83c commit 16eea14
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/shopinvader_sale_cart_anonymous_partner/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
67 changes: 67 additions & 0 deletions shopinvader_sale_cart_anonymous_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
=======================================
Shopinvader Sale Cart Anonymous Partner
=======================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:15dad0d01a3a47679d57889051cb873eeca00abd11fe1a8cc65987193c321499
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github
:target: https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_sale_cart_anonymous_partner
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

This module plugs in the cart resolution when an anonymous user sign in.

**Table of contents**

.. contents::
:local:

Usage
=====

Installation is automatic.

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_sale_cart_anonymous_partner%0Aversion:%2016.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
~~~~~~~

* Akretion

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

* `Akretion <https://www.akretion.com>`_:

* Florian Mounier

Maintainers
~~~~~~~~~~~

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

You are welcome to contribute.
1 change: 1 addition & 0 deletions shopinvader_sale_cart_anonymous_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions shopinvader_sale_cart_anonymous_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
"name": "Shopinvader Sale Cart Anonymous Partner",
"summary": "Glue module between shopinvader_sale_cart and "
"shopinvader_anonymous_partner. This module solves cart conflicts "
"when an anonymous user sign in.",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"depends": [
"shopinvader_sale_cart",
"shopinvader_anonymous_partner",
],
"auto_install": True,
}
1 change: 1 addition & 0 deletions shopinvader_sale_cart_anonymous_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
24 changes: 24 additions & 0 deletions shopinvader_sale_cart_anonymous_partner/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class ResPartner(models.Model):
_inherit = "res.partner"

def _promote_from_anonymous_partner(self, anonymous_partner):
"""
Promote an anonymous partner to a real partner
"""
rv = super()._promote_from_anonymous_partner(anonymous_partner)

anonymous_cart = (
self.env["sale.order"].sudo()._find_open_cart(anonymous_partner.id)
)
if anonymous_cart:
anonymous_cart._transfer_cart(self.id)
anonymous_cart.unlink()

return rv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Akretion <https://www.akretion.com>`_:

* Florian Mounier
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module plugs in the cart resolution when an anonymous user sign in.
1 change: 1 addition & 0 deletions shopinvader_sale_cart_anonymous_partner/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Installation is automatic.
Loading

0 comments on commit 16eea14

Please sign in to comment.