Skip to content

Commit ac31cce

Browse files
[ADD] website_sale_not_save_address: add new module
1 parent dd9d3de commit ac31cce

17 files changed

Lines changed: 955 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
=============================
2+
Website Sale Not Save Address
3+
=============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:4380ced474aeae5a2124595137ce3a229165290e5bc38877415760efcc0490a3
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
20+
:target: https://github.com/OCA/e-commerce/tree/18.0/website_sale_checkout_address_no_save
21+
:alt: OCA/e-commerce
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_checkout_address_no_save
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Adds a checkbox in /shop/address to avoid having to many address in
32+
/shop/checkout.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
Once module is install you have to go to website edit, an enable
43+
'Archive Address after checkout'. After that, a heckbox will appear on
44+
/shop/address. On the checkout if the payment transaction is valid it
45+
will archive the conctact.
46+
47+
Bug Tracker
48+
===========
49+
50+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
51+
In case of trouble, please check there if your issue has already been reported.
52+
If you spotted it first, help us to smash it by providing a detailed and welcomed
53+
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_checkout_address_no_save%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
54+
55+
Do not contact contributors directly about support or help with technical issues.
56+
57+
Credits
58+
=======
59+
60+
Authors
61+
-------
62+
63+
* Tecnativa
64+
65+
Contributors
66+
------------
67+
68+
- `Tecnativa <https://www.tecnativa.com>`__:
69+
70+
- Eduardo Ezerouali
71+
72+
Maintainers
73+
-----------
74+
75+
This module is maintained by the OCA.
76+
77+
.. image:: https://odoo-community.org/logo.png
78+
:alt: Odoo Community Association
79+
:target: https://odoo-community.org
80+
81+
OCA, or the Odoo Community Association, is a nonprofit organization whose
82+
mission is to support the collaborative development of Odoo features and
83+
promote its widespread use.
84+
85+
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_checkout_address_no_save>`_ project on GitHub.
86+
87+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2026 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
from . import controllers
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2026 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
{
4+
"name": "Website Sale Not Save Address",
5+
"summary": "Avoid having to many address as dropshipping customer",
6+
"version": "18.0.1.0.0",
7+
"category": "Website",
8+
"website": "https://github.com/OCA/e-commerce",
9+
"author": "Tecnativa, Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"application": False,
12+
"installable": True,
13+
"depends": ["website_sale"],
14+
"data": ["views/website_sale_templates.xml"],
15+
"assets": {
16+
"web.assets_tests": [
17+
"website_sale_checkout_address_no_save/static/tests/tours/*.js",
18+
],
19+
},
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2026 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
from . import main
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2026 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
from odoo import http
5+
from odoo.http import request, route
6+
7+
from odoo.addons.payment.controllers import post_processing
8+
from odoo.addons.website_sale.controllers import main
9+
10+
11+
class WebsiteSale(main.WebsiteSale):
12+
@route(
13+
"/shop/address/submit",
14+
type="http",
15+
methods=["POST"],
16+
auth="public",
17+
website=True,
18+
sitemap=False,
19+
)
20+
def shop_address_submit(
21+
self,
22+
partner_id=None,
23+
address_type="billing",
24+
use_delivery_as_billing=None,
25+
callback=None,
26+
required_fields=None,
27+
**form_data,
28+
):
29+
order = request.website.sale_get_order()
30+
parent_partner = order.partner_id
31+
Partner = request.env["res.partner"].sudo().with_context(active_test=False)
32+
domain = [
33+
("active", "=", False),
34+
("parent_id", "=", parent_partner.id),
35+
("type", "=", "other"),
36+
]
37+
if form_data.get("email"):
38+
domain.append(("email", "=", form_data["email"]))
39+
if form_data.get("phone"):
40+
domain.append(("phone", "=", form_data["phone"]))
41+
if form_data.get("street") and form_data.get("zip"):
42+
domain += [
43+
("street", "ilike", form_data.get("street")),
44+
("zip", "=", form_data.get("zip")),
45+
]
46+
archived_child = Partner.search(domain, limit=1)
47+
if archived_child:
48+
archived_child.write({"active": True, **form_data})
49+
partner_id = archived_child.id
50+
if form_data.get("archive_address"):
51+
request.session["archive_address"] = True
52+
return super().shop_address_submit(
53+
partner_id=partner_id,
54+
address_type=address_type,
55+
use_delivery_as_billing=use_delivery_as_billing,
56+
callback=callback,
57+
required_fields=required_fields,
58+
**form_data,
59+
)
60+
61+
62+
class PaymentPostProcessing(post_processing.PaymentPostProcessing):
63+
@http.route(
64+
"/payment/status", type="http", auth="public", website=True, sitemap=False
65+
)
66+
def display_status(self, **kwargs):
67+
result = super().display_status(**kwargs)
68+
archive_address = request.session.pop("archive_address", False)
69+
if archive_address:
70+
sale_order_id = request.session.get("sale_last_order_id")
71+
if sale_order_id:
72+
order = request.env["sale.order"].sudo().browse(sale_order_id)
73+
order.partner_shipping_id.active = False
74+
return result
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * website_sale_checkout_address_no_save
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 18.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2026-02-25 14:15+0000\n"
10+
"PO-Revision-Date: 2026-02-25 14:15+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: website_sale_checkout_address_no_save
19+
#: model_terms:ir.ui.view,arch_db:website_sale_checkout_address_no_save.archive_address
20+
msgid "This address will be archive after checkout"
21+
msgstr "Esta dirección se archivará después de finalizar la compra"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * website_sale_checkout_address_no_save
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 18.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2026-02-25 14:14+0000\n"
10+
"PO-Revision-Date: 2026-02-25 14:14+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: website_sale_checkout_address_no_save
19+
#: model_terms:ir.ui.view,arch_db:website_sale_checkout_address_no_save.archive_address
20+
msgid "This address will be archive after checkout"
21+
msgstr ""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Tecnativa](https://www.tecnativa.com):
2+
- Eduardo Ezerouali
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds a checkbox in /shop/address to avoid having to many address in /shop/checkout.

0 commit comments

Comments
 (0)