diff --git a/website_sale_donation/README.rst b/website_sale_donation/README.rst index bdf2e4c..807e379 100644 --- a/website_sale_donation/README.rst +++ b/website_sale_donation/README.rst @@ -29,6 +29,14 @@ Helper module to manage donations in the e-commerce platform. .. contents:: :local: +Changelog +========= + +14.0.1.1.0 +---------- + +- [ADD] Automatically match partner during checkout. + Bug Tracker =========== diff --git a/website_sale_donation/__init__.py b/website_sale_donation/__init__.py index 31660d6..f4a659e 100644 --- a/website_sale_donation/__init__.py +++ b/website_sale_donation/__init__.py @@ -1,3 +1,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import models +from . import controllers diff --git a/website_sale_donation/__manifest__.py b/website_sale_donation/__manifest__.py index 55f8c4a..16f7494 100644 --- a/website_sale_donation/__manifest__.py +++ b/website_sale_donation/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Website - Sale donation", "summary": "Allows to have a product considered as a donation", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "development_status": "Beta", "category": "Website", "website": "https://github.com/CompassionCH/compassion-website", @@ -19,6 +19,7 @@ "website_sale", "mass_mailing", "base_automation", + "partner_auto_match", ], "data": [ "data/base_automation.xml", diff --git a/website_sale_donation/controllers/__init__.py b/website_sale_donation/controllers/__init__.py new file mode 100644 index 0000000..bdae4cc --- /dev/null +++ b/website_sale_donation/controllers/__init__.py @@ -0,0 +1 @@ +from . import website_sale diff --git a/website_sale_donation/controllers/website_sale.py b/website_sale_donation/controllers/website_sale.py new file mode 100644 index 0000000..75d70c5 --- /dev/null +++ b/website_sale_donation/controllers/website_sale.py @@ -0,0 +1,17 @@ +from odoo.http import request + +from odoo.addons.website_sale.controllers.main import WebsiteSale + + +class WebsiteSaleDonation(WebsiteSale): + def _checkout_form_save(self, mode, checkout, all_values): + # Try to match existing partner if possible + if mode[0] == "new": + partner = ( + request.env["res.partner.match"] + .sudo() + .match_values_to_partner(checkout, match_create=False) + ) + if partner: + return partner[:1].id + return super()._checkout_form_save(mode, checkout, all_values) diff --git a/website_sale_donation/readme/HISTORY.md b/website_sale_donation/readme/HISTORY.md new file mode 100644 index 0000000..ec99155 --- /dev/null +++ b/website_sale_donation/readme/HISTORY.md @@ -0,0 +1,3 @@ +## 14.0.1.1.0 + +- [ADD] Automatically match partner during checkout. diff --git a/website_sale_donation/static/description/index.html b/website_sale_donation/static/description/index.html index 7c3300b..de42546 100644 --- a/website_sale_donation/static/description/index.html +++ b/website_sale_donation/static/description/index.html @@ -373,17 +373,30 @@

Website - Sale donation

Table of contents

+
+

Changelog

+
+

14.0.1.1.0

+ +
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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 @@ -391,21 +404,21 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

Current maintainer:

ecino

This module is part of the CompassionCH/compassion-website project on GitHub.