Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] website_sale_stock_available: Migration to 15.0 #714

Merged
merged 13 commits into from
Feb 7, 2023
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
6 changes: 6 additions & 0 deletions setup/website_sale_stock_available/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,
)
120 changes: 120 additions & 0 deletions website_sale_stock_available/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
============================
Website Sale Stock Available
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/15.0/website_sale_stock_available
: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-15-0/e-commerce-15-0-website_sale_stock_available
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/113/15.0
:alt: Try me on Runbot

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

This module extends the functionality of the *Product Availability* module
(technical name: ``website_sale_stock``) so that for the eCommerce the *Available*
quantity of a product is taken into account instead of the *free* quantity.

Note that in the past the eCommerce availability was based in *Forecasted quantity*. This
isn't true anymore from version 15.0.

If a product is configured to *prevent sales if not enough stock*
(see configuration section) and its page is accessed in the Website Shop,
the availability messages will be based on the *Available* quantity instead of
*Free* quantity. And also, the eCommerce won't allow you to buy more products than
*Available* quantity (not *Free* quantity isn't taken into account).

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

#. Go to *Inventory > Master Data > Products* and edit a product that
you only want to sell in the eCommerce if there is enough stock.
#. Navigate to *Out-of-stock (continue selling)* field in the *Sales* tab and unset it.
#. Go to *Inventory > Configuration > Settings*, navigate to *Stock available
to promise* section and set the desired option (you might need extra modules). If you
do not choose any, the value of *Available* quantity will be equal to *Forecasted*
quantity.

Usage
=====

To use this module, you need to:

#. Go to your eCommerce.
#. Select a product that you has been previously configured to *prevent sales
if not enough stock* for the web product page.
#. Odoo doesn't allow you to add the product to the cart if *Available*
quantity (not *Free to use* quantity) is equal or less than zero.
Besides, availability messages will be based on the *Available*
quantity instead of the *Free to use* quantity.

.. image:: https://raw.githubusercontent.com/OCA/e-commerce/15.0/website_sale_stock_available/static/description/availability_message.png
:width: 600 px
:alt: Availability message

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_stock_available%0Aversion:%2015.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>`_:

* Ernesto Tejeda
* Pedro M. Baeza
* David Vidal

* Iván Todorovich

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/15.0/website_sale_stock_available>`_ 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_available/__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
from . import models
18 changes: 18 additions & 0 deletions website_sale_stock_available/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Stock Available",
"summary": "Display 'Available to promise' in shop online instead "
"of 'Free To Use Quantity'",
"version": "15.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"stock_available",
"website_sale_stock",
],
"data": [],
"installable": True,
}
1 change: 1 addition & 0 deletions website_sale_stock_available/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
15 changes: 15 additions & 0 deletions website_sale_stock_available/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.http import request, route

from odoo.addons.website_sale_stock.controllers.main import PaymentPortal


class PaymentPortal(PaymentPortal):
@route()
def shop_payment_transaction(self, *args, **kwargs):
"""Inject a context when potencial or promised stock is set"""
request.website = request.website.with_context(
website_sale_stock_available=True
)
return super().shop_payment_transaction(*args, **kwargs)
32 changes: 32 additions & 0 deletions website_sale_stock_available/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-01-20 20:45+0000\n"
"Last-Translator: claudiagn <[email protected]>\n"
"Language-Team: none\n"
"Language: ca\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"
"X-Generator: Weblate 4.3.2\n"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Producte"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Plantilla de producte"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sale Order"
msgstr "Comanda de venda"
32 changes: 32 additions & 0 deletions website_sale_stock_available/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-11-03 13:08+0000\n"
"Last-Translator: claudiagn <[email protected]>\n"
"Language-Team: none\n"
"Language: es\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"
"X-Generator: Weblate 3.10\n"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sale Order"
msgstr "Pedido de venta"
53 changes: 53 additions & 0 deletions website_sale_stock_available/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-09-11 19:33+0000\n"
"Last-Translator: Ignacio Buioli <[email protected]>\n"
"Language-Team: none\n"
"Language: es_AR\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"
"X-Generator: Weblate 4.3.2\n"

#. module: website_sale_stock_available
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_product__display_name
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_template__display_name
#: model:ir.model.fields,field_description:website_sale_stock_available.field_sale_order__display_name
msgid "Display Name"
msgstr "Mostrar Nombre"

#. module: website_sale_stock_available
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_product__id
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_template__id
#: model:ir.model.fields,field_description:website_sale_stock_available.field_sale_order__id
msgid "ID"
msgstr "ID"

#. module: website_sale_stock_available
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_product____last_update
#: model:ir.model.fields,field_description:website_sale_stock_available.field_product_template____last_update
#: model:ir.model.fields,field_description:website_sale_stock_available.field_sale_order____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Plantilla de Producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sales Order"
msgstr "Pedidos de Ventas"
32 changes: 32 additions & 0 deletions website_sale_stock_available/i18n/es_CL.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-05-30 05:19+0000\n"
"Last-Translator: Nelson Ramírez Sánchez <[email protected]>\n"
"Language-Team: none\n"
"Language: es_CL\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"
"X-Generator: Weblate 3.10\n"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Plantilla de Producto"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sale Order"
msgstr "Nota de Venta"
32 changes: 32 additions & 0 deletions website_sale_stock_available/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-11-23 15:36+0000\n"
"Last-Translator: Yann Papouin <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\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"
"X-Generator: Weblate 3.10\n"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Article"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sale Order"
msgstr "Commande client"
32 changes: 32 additions & 0 deletions website_sale_stock_available/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-12-15 13:19+0000\n"
"Last-Translator: Bosd <[email protected]>\n"
"Language-Team: none\n"
"Language: nl\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"
"X-Generator: Weblate 4.3.2\n"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_product
msgid "Product"
msgstr "Product"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_product_template
msgid "Product Template"
msgstr "Product Sjabloon"

#. module: website_sale_stock_available
#: model:ir.model,name:website_sale_stock_available.model_sale_order
msgid "Sale Order"
msgstr "Verkoop order"
Loading