Añadidos módulos de OCA/e-commerce para la tienda online

This commit is contained in:
santiky 2021-09-14 14:07:34 +02:00
parent 10bfdb5a49
commit c14ed5b4ef
Signed by: snt
GPG key ID: A9FD34930EADBE71
99 changed files with 5359 additions and 0 deletions

View file

@ -0,0 +1,91 @@
====================================
Website Sale Stock Available Display
====================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/12.0/website_sale_stock_available_display
: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-12-0/e-commerce-12-0-website_sale_stock_available_display
: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/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of website sale stock module to allow to
display available stock in website products and allow to buy if not enough
stock.
Also re-use the field Custom Message for inform to customer of any message
when stock is less than 0.0 units.
**Table of contents**
.. contents::
:local:
Usage
=====
#. Go to *'Sale > Catalog > Product'*.
#. Set *Show inventory on website and allow sales if not enough stock* in
inventory availability field.
#. You can set a custom message that appears when available stock is less than
0.0 units.
#. Go to Website Shop.
#. Click in any product that you know that no stock available.
#. You will see '*0 units in stock*' but you will buy this product.
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_display%0Aversion:%2012.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>`_:
* Sergio Teruel <sergio.teruel@tecnativa.com>
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/12.0/website_sale_stock_available_display>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models

View file

@ -0,0 +1,23 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Website Sale Stock Available Display',
'summary': 'Display stock in shop online and allow to sell with no stock '
'available',
'version': '12.0.1.2.1',
'development_status': 'Beta',
'category': 'Website',
'website': 'https://github.com/OCA/e-commerce',
'author': 'Tecnativa, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': [
'website_sale_stock',
],
'data': [
'views/assets.xml',
'views/product_template_views.xml',
'views/templates.xml',
],
}

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_template_wo_qty" model="product.template">
<field name="name">Computer Motherboard</field>
<field name="type">product</field>
<field name="inventory_availability">always_no_lock</field>
<field name="website_published" eval="True"/>
<field name="custom_message">Available in 10 days</field>
</record>
<record id="product_product_w_qty" model="product.product">
<field name="name">Special Mouse</field>
<field name="type">product</field>
<field name="inventory_availability">always_no_lock</field>
<field name="website_published" eval="True"/>
</record>
<record id="product_product_w_qty_quant" model="stock.quant">
<field name="product_id" ref="website_sale_stock_available_display.product_product_w_qty"/>
<field name="product_uom_id" ref="product.product_uom_unit"/>
<field name="location_id" ref="stock.stock_location_stock"/>
<field name="quantity">10.0</field>
</record>
</odoo>

View file

@ -0,0 +1,91 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available_display
#
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 <claudia.gargallo@qubiq.es>\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_display
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_template__inventory_availability
msgid "Adds an inventory availability status on the web product page."
msgstr ""
"Afegeix un estat de disponibilitat dinventari a la pàgina del producte web."
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Block sales on website and display a message custom"
msgstr "Bloqueja les vendes al lloc web i mostra un missatge personalitzat"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_res_config_settings
msgid "Config Settings"
msgstr "Paràmetres de configuració"
#. module: website_sale_stock_available_display
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_template__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_res_config_settings__inventory_availability
msgid "Inventory Availability"
msgstr "Disponibilitat d'inventari"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_product_template
msgid "Product Template"
msgstr "Plantilla de producte"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Sell regardless of inventory"
msgstr "Vendre independenment del inventari"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory below a threshold and prevent sales if not enough stock"
msgstr ""
"Mostra l'inventari per sota d'un llindar i evita les vendes si no hi ha prou "
"existències"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and allow sales if not enough stock"
msgstr ""
"Mostra l'inventari al lloc web i permet les vendes si no hi ha prou "
"existències"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and prevent sales if not enough stock"
msgstr ""
"Mostra l'inventari al lloc web i evita les vendes si no hi ha prou "
"existències"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show product-specific notifications"
msgstr "Mostra les notificacions específiques del producte"
#. module: website_sale_stock_available_display
#. openerp-web
#: code:addons/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml:10
#: model_terms:ir.ui.view,arch_db:website_sale_stock_available_display.stock_info
#, python-format
msgid "in stock"
msgstr "en estoc"

View file

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available_display
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-08-11 17:59+0000\n"
"Last-Translator: André Volksdorf <volksdorf@smartpage.de>\n"
"Language-Team: none\n"
"Language: de\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_display
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_template__inventory_availability
msgid "Adds an inventory availability status on the web product page."
msgstr ""
"Fügt einen Bestandsverfügbarkeitsstatus auf der Produktseite der Website "
"hinzu."
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Block sales on website and display a message custom"
msgstr ""
"Verkäufe auf der Website blockieren und eine benutzerdefinierte Nachricht "
"anzeigen"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_res_config_settings
msgid "Config Settings"
msgstr "Konfigurationseinstellungen"
#. module: website_sale_stock_available_display
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_template__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_res_config_settings__inventory_availability
msgid "Inventory Availability"
msgstr "Verfügbarkeit der Bestände"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_product_template
msgid "Product Template"
msgstr "Produkt-Vorlage"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Sell regardless of inventory"
msgstr "Verkaufen unabhängig vom Bestand"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory below a threshold and prevent sales if not enough stock"
msgstr ""
"Lagerbestand unter einem Schwellenwert anzeigen und Verkäufe verhindern, "
"wenn nicht genügend Bestand vorhanden ist"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and allow sales if not enough stock"
msgstr ""
"Lagerbestand auf der Website anzeigen und Verkäufe zulassen, wenn nicht "
"genug Bestand vorhanden ist"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and prevent sales if not enough stock"
msgstr ""
"Lagerbestand auf der Website anzeigen und Verkäufe verhindern, wenn nicht "
"genügend Bestand vorhanden ist"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show product-specific notifications"
msgstr "Produktspezifische Benachrichtigungen anzeigen"
#. module: website_sale_stock_available_display
#. openerp-web
#: code:addons/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml:10
#: model_terms:ir.ui.view,arch_db:website_sale_stock_available_display.stock_info
#, python-format
msgid "in stock"
msgstr "Auf Lager"

View file

@ -0,0 +1,99 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available_display
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-07 21:58+0000\n"
"PO-Revision-Date: 2020-11-03 13:08+0000\n"
"Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
#. module: website_sale_stock_available_display
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_template__inventory_availability
msgid "Adds an inventory availability status on the web product page."
msgstr ""
"Añade un estado de disponibilidad en inventario en la página web del "
"producto."
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Block sales on website and display a message custom"
msgstr "Bloquear la venta en la tienda y mostrar el mensaje personalizado"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_res_config_settings
msgid "Config Settings"
msgstr "Opciones de Configuración"
#. module: website_sale_stock_available_display
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_template__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_res_config_settings__inventory_availability
msgid "Inventory Availability"
msgstr "Disponibilidad del inventario"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Sell regardless of inventory"
msgstr "Vender independientemente del inventario"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory below a threshold and prevent sales if not enough stock"
msgstr ""
"Mostrar el inventario por debajo de un determinado umbral y bloquear las "
"ventas si no hay suficientes existencias"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and allow sales if not enough stock"
msgstr ""
"Mostrar el inventario en el sitio web y no bloquear las ventas si no hay \n"
"suficientes existencias"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and prevent sales if not enough stock"
msgstr ""
"Mostrar el inventario en el sitio web y bloquear las ventas si no hay "
"suficientes existencias"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show product-specific notifications"
msgstr "Mostrar notificaciones sobre el producto"
#. module: website_sale_stock_available_display
#. openerp-web
#: code:addons/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml:10
#: model_terms:ir.ui.view,arch_db:website_sale_stock_available_display.stock_info
#, python-format
msgid "in stock"
msgstr "en stock"
#~ msgid "Computer Motherboard"
#~ msgstr "Placa base"
#~ msgid "Special Mouse"
#~ msgstr "Ratón especial"

View file

@ -0,0 +1,91 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available_display
#
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 <y.papouin@dec-industrie.com>\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_display
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_template__inventory_availability
msgid "Adds an inventory availability status on the web product page."
msgstr "Ajoute une information de disponibilité sur la page Web du produit."
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Block sales on website and display a message custom"
msgstr "Bloquer les ventes sur le site Web et afficher un message personnalisé"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de config"
#. module: website_sale_stock_available_display
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_template__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_res_config_settings__inventory_availability
msgid "Inventory Availability"
msgstr "Disponibilité"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Sell regardless of inventory"
msgstr "Vente sans tenir compte du stock"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory below a threshold and prevent sales if not enough stock"
msgstr ""
"Indiquer si l'inventaire est inférieur à un certain seuil et bloquer les "
"ventes en cas de stock insuffisant"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and allow sales if not enough stock"
msgstr ""
"Afficher l'inventaire sur le site Web et autoriser les ventes en cas de "
"stock insuffisant"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and prevent sales if not enough stock"
msgstr ""
"Afficher l'inventaire sur le site Web et bloquer les ventes en cas de stock "
"insuffisant"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show product-specific notifications"
msgstr ""
"Afficher un message de disponibilité personnalisé et spécique au produit"
#. module: website_sale_stock_available_display
#. openerp-web
#: code:addons/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml:10
#: model_terms:ir.ui.view,arch_db:website_sale_stock_available_display.stock_info
#, python-format
msgid "in stock"
msgstr "en stock"

View file

@ -0,0 +1,86 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_available_display
#
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 <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\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_display
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,help:website_sale_stock_available_display.field_product_template__inventory_availability
msgid "Adds an inventory availability status on the web product page."
msgstr ""
"Voegt een beschikbare voorraad status toe aan de product pagina op de "
"website."
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Block sales on website and display a message custom"
msgstr "Blokkeer verkopen op de website en geef een aangepaste boodschap weer"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: website_sale_stock_available_display
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_product__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_product_template__inventory_availability
#: model:ir.model.fields,field_description:website_sale_stock_available_display.field_res_config_settings__inventory_availability
msgid "Inventory Availability"
msgstr "Beschikbare voorraad"
#. module: website_sale_stock_available_display
#: model:ir.model,name:website_sale_stock_available_display.model_product_template
msgid "Product Template"
msgstr "Product Sjabloon"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Sell regardless of inventory"
msgstr "Verkoop ongeacht de voorraad"
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory below a threshold and prevent sales if not enough stock"
msgstr ""
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and allow sales if not enough stock"
msgstr ""
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show inventory on website and prevent sales if not enough stock"
msgstr ""
#. module: website_sale_stock_available_display
#: selection:product.template,inventory_availability:0
#: selection:res.config.settings,inventory_availability:0
msgid "Show product-specific notifications"
msgstr ""
#. module: website_sale_stock_available_display
#. openerp-web
#: code:addons/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml:10
#: model_terms:ir.ui.view,arch_db:website_sale_stock_available_display.stock_info
#, python-format
msgid "in stock"
msgstr ""

View file

@ -0,0 +1,2 @@
from . import product_template
from . import res_config_settings

View file

@ -0,0 +1,12 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
inventory_availability = fields.Selection(selection_add=[
('always_no_lock',
'Show inventory on website and allow sales if not enough stock'),
])

View file

@ -0,0 +1,13 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
inventory_availability = fields.Selection(selection_add=[
('always_no_lock',
'Show inventory on website and allow sales if not enough stock'),
])

View file

@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Sergio Teruel <sergio.teruel@tecnativa.com>

View file

@ -0,0 +1,5 @@
This module extends the functionality of website sale stock module to allow to
display available stock in website products and allow to buy if not enough
stock.
Also re-use the field Custom Message for inform to customer of any message
when stock is less than 0.0 units.

View file

@ -0,0 +1,8 @@
#. Go to *'Sale > Catalog > Product'*.
#. Set *Show inventory on website and allow sales if not enough stock* in
inventory availability field.
#. You can set a custom message that appears when available stock is less than
0.0 units.
#. Go to Website Shop.
#. Click in any product that you know that no stock available.
#. You will see '*0 units in stock*' but you will buy this product.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

@ -0,0 +1,443 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Website Sale Stock Available Display</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="website-sale-stock-available-display">
<h1 class="title">Website Sale Stock Available Display</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/e-commerce/tree/12.0/website_sale_stock_available_display"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/e-commerce-12-0/e-commerce-12-0-website_sale_stock_available_display"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/113/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of website sale stock module to allow to
display available stock in website products and allow to buy if not enough
stock.
Also re-use the field Custom Message for inform to customer of any message
when stock is less than 0.0 units.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <em>Sale &gt; Catalog &gt; Product</em>.</li>
<li>Set <em>Show inventory on website and allow sales if not enough stock</em> in
inventory availability field.</li>
<li>You can set a custom message that appears when available stock is less than
0.0 units.</li>
<li>Go to Website Shop.</li>
<li>Click in any product that you know that no stock available.</li>
<li>You will see <em>0 units in stock</em> but you will buy this product.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/e-commerce/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_stock_available_display%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
<ul class="simple">
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/12.0/website_sale_stock_available_display">OCA/e-commerce</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,15 @@
odoo.define('website_sale_stock_available_display.load', function (require) {
'use strict';
var ajax = require('web.ajax');
var core = require('web.core');
var ProductConfiguratorMixin = require(
'website_sale_stock.ProductConfiguratorMixin');
var QWeb = core.qweb;
var load_xml = ajax.loadXML(
'/website_sale_stock_available_display/static/src/xml/website_sale_stock_product_availability.xml',
QWeb
);
load_xml.then(function() {
$('.oe_website_sale').find('input[name="add_qty"]').trigger('change');
});
});

View file

@ -0,0 +1,59 @@
/* Copyright 2019 Sergio Teruel
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
odoo.define("website_sale_stock_available_display.tour", function (require) {
"use strict";
var tour = require("web_tour.tour");
var base = require("web_editor.base");
var steps = [
{
trigger: "a:contains('Computer Motherboard')",
},
{
trigger: "a#add_to_cart",
extra_trigger: ".availability_messages:has(span:contains('0 Unit(s) in stock')):has(div:contains('Available in 10 days'))",
},
{
trigger: "span:contains('Process Checkout')",
extra_trigger: ".availability_messages:has(span:contains('0 Unit(s) in stock'))",
},
{
trigger: ".btn-primary:contains('Confirm Order')",
},
{
trigger: "a[href='/shop']",
extra_trigger: ".availability_messages:has(span:contains('0 Unit(s) in stock'))",
},
{
trigger: "a:contains('Special Mouse')",
},
{
trigger: "a#add_to_cart",
extra_trigger: ".availability_messages:has(span:contains('10 Unit(s) in stock'))",
},
{
trigger: "span:contains('Process Checkout')",
extra_trigger: ".availability_messages:has(span:contains('10.0 Unit(s) in stock'))",
},
{
trigger: ".btn-primary:contains('Confirm Order')",
},
{
trigger: "a[href='/shop']",
extra_trigger: ".availability_messages:has(span:contains('10.0 Unit(s) in stock'))",
},
];
tour.register("website_sale_stock_available_display",
{
url: "/shop",
test: true,
wait_for: base.ready(),
},
steps
);
return {
steps: steps,
};
});

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="website_sale_stock.product_availability">
<t t-jquery="t:eq(0)" t-operation="after">
<t t-if="product_type == 'product' and _.contains(['always_no_lock'], inventory_availability)">
<div t-attf-class="availability_message_#{product_template} text-#{virtual_available gt 0.0 and 'success' or 'danger'} mt16">
<span>
<t t-if="virtual_available gt 0.0" t-esc="virtual_available"/>
<t t-else="1" t-esc="0.0"/> <t t-esc="uom_name"/> in stock</span>
</div>
<div t-if="virtual_available &lt;= 0.0">
<!-- Re-use this core field -->
<t t-esc="custom_message" />
</div>
</t>
</t>
</t>
</templates>

View file

@ -0,0 +1 @@
from . import test_website_sale_stock_available_display

View file

@ -0,0 +1,57 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests.common import HttpCase
class websiteSaleStockAvailableDisplay(HttpCase):
def setUp(self):
super().setUp()
# For testing with website_sale_vat_required module, I avoid
# address step to fill partner vat
self.env.ref('base.user_admin').partner_id.write({
'vat': 'BE0477472701',
'phone': '9999999999',
})
self.ProductTemplate = self.env['product.template']
# The website_sequence is set quite high to display this products in
# first page.
# Set list price to 0.0 to avoid payment step because this step has an
# asynchronous call
common_vals = {
'type': 'product',
'website_published': True,
'inventory_availability': 'always_no_lock',
'website_sequence': 5000,
'list_price': 0.0,
}
vals = common_vals.copy()
vals.update({
'name': 'Computer Motherboard',
'custom_message': 'Available in 10 days',
})
self.product_template_wo_qty = self.ProductTemplate.create(vals)
vals = common_vals.copy()
vals.update({
'name': 'Special Mouse',
})
self.product_product_w_qty = self.ProductTemplate.create(vals)
self.env['stock.quant'].create({
'product_id': self.product_product_w_qty.product_variant_ids.id,
'product_uom_id': self.product_product_w_qty.uom_id.id,
'location_id': self.env.ref('stock.stock_location_stock').id,
'quantity': 10.0,
})
def test_ui_website(self):
"""Test frontend tour."""
tour = (
"odoo.__DEBUG__.services['web_tour.tour']",
"website_sale_stock_available_display",
)
self.browser_js(
url_path="/shop",
code="%s.run('%s')" % tour,
ready="%s.tours['%s'].ready" % tour,
login="admin"
)

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="website.assets_frontend">
<xpath expr=".">
<script type="text/javascript"
src="/website_sale_stock_available_display/static/src/js/website_sale_stock_available_display.js"/>
<script type="text/javascript"
src="/website_sale_stock_available_display/static/src/js/website_sale_stock_available_display_tour.js"/>
</xpath>
</template>
</odoo>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="product_template_form_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="website_sale_stock.product_template_form_view_inherit_website_sale_stock" />
<field name="arch" type="xml">
<field name="custom_message" position="after">
<field name="custom_message"
attrs="{'invisible': ['|', ('type', 'in', ['service', 'consu']), ('inventory_availability', '!=', 'always_no_lock')]}"/>
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="stock_info">
<t t-if="line.product_id.inventory_availability == 'always_no_lock'">
<!--
Compute virtual_available with context key added by
website_sale_stock_available module. Is not needed dependency of it.
-->
<t t-set="virtual_available"
t-value="line.product_id.with_context(website_sale_stock_available=True).virtual_available"/>
<div t-attf-class="availability_messages text-#{virtual_available &gt; 0.0 and 'success' or 'danger'}">
<t t-set="virtual_available" t-value="virtual_available if virtual_available > 0.0 else 0.0"/>
<span><t t-esc="virtual_available"/> <t t-esc="line.product_uom.name"/> in stock</span>
</div>
</t>
</template>
<!-- Shopping Cart Lines -->
<template id="cart_lines" inherit_id="website_sale.cart_lines">
<xpath expr="//td[hasclass('td-qty')]" position="inside">
<t t-call="website_sale_stock_available_display.stock_info"/>
</xpath>
</template>
<!-- Cart Summary -->
<template id="cart_summary" inherit_id="website_sale.cart_summary">
<xpath expr="//table[@id='cart_products']//td[hasclass('td-qty')]" position="inside">
<t t-call="website_sale_stock_available_display.stock_info"/>
</xpath>
</template>
</odoo>