Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions website_sale_stock_list_preview/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
===============================
Website Sale Stock List Preview
===============================

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

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

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

This module extends the functionality of e-Commerce to give the buyer
the information about the stock on the preview of the products.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Edit some products on the option Availability of e-commerce
- Go to the shop on the website and active Add to Cart button on web
editor options.
- You can see on your products the results of the options that you had
choose.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/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/e-commerce/issues/new?body=module:%20website_sale_stock_list_preview%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
-------

* Tecnativa

Contributors
------------

- ``Tecnativa <https://www.tecnativa.com>``\ \_\_:

- Carlos Roca <carlos.roca@tecnativa.com>
- Sergio Teruel <sergio.teruel@tecnativa.com>
- Carlos Dauden <carlos.dauden@tecnativa.com>
- Pilar Vargas

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.

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_stock_list_preview>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions website_sale_stock_list_preview/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import controllers
21 changes: 21 additions & 0 deletions website_sale_stock_list_preview/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 Tecnativa - Carlos Roca
# Copyright 2020 Tecnativa - Sergio Teruel
# Copyright 2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Stock List Preview",
"summary": "Show the stock of products on the product previews",
"version": "18.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["website_sale_stock"],
"data": ["views/templates.xml"],
"assets": {
"web.assets_tests": [
"/website_sale_stock_list_preview/static/src/tests/*.esm.js",
],
},
}
3 changes: 3 additions & 0 deletions website_sale_stock_list_preview/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import main
39 changes: 39 additions & 0 deletions website_sale_stock_list_preview/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2020 Tecnativa - Carlos Roca
# Copyright 2020 Tecnativa - Carlos Dauden
# Copyright 2025 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSaleStockListPreview(WebsiteSale):
def _get_additional_shop_values(self, values):
res = super()._get_additional_shop_values(values)

products = values.get("products") or request.env["product.template"]
if not products:
return res
website = request.env["website"].get_current_website()
products_sudo = products.sudo().with_context(
warehouse=website.sudo().warehouse_id.id,
website_sale_stock_available=True,
)
products_stock = {}
for tmpl in products_sudo:
if not tmpl.show_availability:
continue
variants = tmpl.product_variant_ids
products_stock[tmpl.id] = {
"product_template": tmpl.id,
"product_type": tmpl.type,
"free_qty": sum(variants.mapped("free_qty")),
"out_of_stock_message": tmpl.out_of_stock_message,
"allow_out_of_stock_order": tmpl.allow_out_of_stock_order,
"show_availability": tmpl.show_availability,
"available_threshold": tmpl.available_threshold,
"uom_name": tmpl.uom_name,
"uom_rounding": tmpl.uom_id.rounding,
}
res["products_stock"] = products_stock
return res
Empty file.
14 changes: 14 additions & 0 deletions website_sale_stock_list_preview/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
3 changes: 3 additions & 0 deletions website_sale_stock_list_preview/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions website_sale_stock_list_preview/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- `Tecnativa <https://www.tecnativa.com>`__:
- Carlos Roca \<carlos.roca@tecnativa.com\>
- Sergio Teruel \<sergio.teruel@tecnativa.com\>
- Carlos Dauden \<carlos.dauden@tecnativa.com\>
- Pilar Vargas
2 changes: 2 additions & 0 deletions website_sale_stock_list_preview/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of e-Commerce to give the buyer the information
about the stock on the preview of the products.
5 changes: 5 additions & 0 deletions website_sale_stock_list_preview/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

- Edit some products on the option Availability of e-commerce
- Go to the shop on the website and active Add to Cart button on web editor options.
- You can see on your products the results of the options that you had choose.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading