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

[17.0][MIG] website_sale_stock_provisioning_date: Migration to 17.0 #949

Open
wants to merge 16 commits into
base: 17.0
Choose a base branch
from
Open
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
103 changes: 103 additions & 0 deletions website_sale_stock_provisioning_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
====================================
Website Sale Stock Provisioning Date
====================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/17.0/website_sale_stock_provisioning_date
: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-17-0/e-commerce-17-0-website_sale_stock_provisioning_date
: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=17.0
:alt: Try me on Runboat

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

This module extends the functionality of website to show you the future
provisioning date closest to the current date for a product in the
eCommerce.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Go to *Sales > Products > Products*, create a new product or edit an
existing one.
2. Check 'Show Next Provisioning Date' field under eCommerce tab.
3. Go to Website Shop.
4. Click on a product that have 'Show Next Provisioning Date' checked.
5. If it is true for that product that 'quantity on hand' - 'outgoing
quantity' <= 0, then you will see the future provisioning date
closest to the current date for this product under the 'Add to Cart'
button (If there is such a date).

Note: The closest future provisioning date is the date of the future
stock movement and the closest to the current date. This can be
generated after confirming a purchase order to receive the product on a
date after the current date.

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_provisioning_date%0Aversion:%2017.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
- Sergio Teruel
- Carlos Roca

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/17.0/website_sale_stock_provisioning_date>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions website_sale_stock_provisioning_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
26 changes: 26 additions & 0 deletions website_sale_stock_provisioning_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Stock Provisioning Date",
"summary": "Display provisioning date for a product in shop online",
"version": "17.0.1.0.0",
"development_status": "Production/Stable",
"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/product_template_views.xml"],
"assets": {
"web.assets_frontend": [
"website_sale_stock_provisioning_date/static/src/xml/"
"website_sale_stock_product_availability.xml",
],
"web.assets_tests": [
"/website_sale_stock_provisioning_date/static/src/js/"
"website_sale_stock_provisioning_date_tour.js",
],
},
}
58 changes: 58 additions & 0 deletions website_sale_stock_provisioning_date/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_provisioning_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-23 20:14+0000\n"
"PO-Revision-Date: 2023-10-08 22:54+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.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 4.17\n"

#. module: website_sale_stock_provisioning_date
#. odoo-javascript
#: code:addons/website_sale_stock_provisioning_date/static/src/xml/website_sale_stock_product_availability.xml:0
#, python-format
msgid "Next provisioning date:"
msgstr "Fecha de aprovisionamiento:"

#. module: website_sale_stock_provisioning_date
#: model:ir.model,name:website_sale_stock_provisioning_date.model_product_template
msgid "Product"
msgstr "Producto"

#. module: website_sale_stock_provisioning_date
#: model:ir.model,name:website_sale_stock_provisioning_date.model_product_product
msgid "Product Variant"
msgstr "Variante del Producto"

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid "Show Next Provisioning Date"
msgstr "Mostrar fecha de aprovisionamiento"

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid ""
"Shows the next provisioning date in the website shop if the product is out "
"of stock. This option may not make sense if you don't select an "
"'Availability' option that shows the inventory of the product in the website "
"shop."
msgstr ""
"Muestra en la tienda online la fecha de aprovisionamiento prevista si el "
"producto está sin existencias. Esta opción puede no tener sentido si usted "
"no selecciona una opción de disponibilidad que muestre el inventario del "
"producto en la tienda online."

#~ msgid "Product Template"
#~ msgstr "Plantilla de producto"
54 changes: 54 additions & 0 deletions website_sale_stock_provisioning_date/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_provisioning_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-05-08 16:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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"
"X-Generator: Weblate 4.17\n"

#. module: website_sale_stock_provisioning_date
#. odoo-javascript
#: code:addons/website_sale_stock_provisioning_date/static/src/xml/website_sale_stock_product_availability.xml:0
#, python-format
msgid "Next provisioning date:"
msgstr "Data prossima fornitura:"

#. module: website_sale_stock_provisioning_date
#: model:ir.model,name:website_sale_stock_provisioning_date.model_product_template
msgid "Product"
msgstr "Prodotto"

#. module: website_sale_stock_provisioning_date
#: model:ir.model,name:website_sale_stock_provisioning_date.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid "Show Next Provisioning Date"
msgstr "Visualizza prossima data fornitura"

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid ""
"Shows the next provisioning date in the website shop if the product is out "
"of stock. This option may not make sense if you don't select an "
"'Availability' option that shows the inventory of the product in the website"
" shop."
msgstr ""
"Visualizza la prossima data fornitura nel negosio del sito web se il "
"prodotto è esaurito. Questa opzione può non avere senso se non si seleziona "
"una opzione 'Disponibilità\" che visualizza la giacenza del prodotto nel "
"negozio del sito web."
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_stock_provisioning_date
#
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"

#. module: website_sale_stock_provisioning_date
#. odoo-javascript
#: code:addons/website_sale_stock_provisioning_date/static/src/xml/website_sale_stock_product_availability.xml:0
#, python-format
msgid "Next provisioning date:"
msgstr ""

#. module: website_sale_stock_provisioning_date
#: model:ir.model,name:website_sale_stock_provisioning_date.model_product_template
msgid "Product"
msgstr ""

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

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,field_description:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid "Show Next Provisioning Date"
msgstr ""

#. module: website_sale_stock_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_product__show_next_provisioning_date
#: model:ir.model.fields,help:website_sale_stock_provisioning_date.field_product_template__show_next_provisioning_date
msgid ""
"Shows the next provisioning date in the website shop if the product is out "
"of stock. This option may not make sense if you don't select an "
"'Availability' option that shows the inventory of the product in the website"
" shop."
msgstr ""
3 changes: 3 additions & 0 deletions website_sale_stock_provisioning_date/models/__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 product_product
from . import product_template
19 changes: 19 additions & 0 deletions website_sale_stock_provisioning_date/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models


class ProductProduct(models.Model):
_inherit = "product.product"

def _get_next_provisioning_date(self, company):
domain = [
("company_id", "=", company.id),
("product_id", "in", self.ids),
("state", "not in", ["draft", "done", "cancel"]),
("location_id.usage", "=", "supplier"),
("location_dest_id.usage", "=", "internal"),
("date", ">=", fields.Datetime.now()),
]
move = self.env["stock.move"].sudo().search(domain, order="date", limit=1)
return move and move.date.date() or False
53 changes: 53 additions & 0 deletions website_sale_stock_provisioning_date/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2019 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tools.misc import format_date


class ProductTemplate(models.Model):
_inherit = "product.template"

show_next_provisioning_date = fields.Boolean(
help="Shows the next provisioning date in the website shop "
"if the product is out of stock. This option may not make "
"sense if you don't select an 'Availability' option that "
"shows the inventory of the product in the website shop."
)

def _get_next_provisioning_date(self, company):
return self.product_variant_ids._get_next_provisioning_date(company)

def _get_combination_info(
self,
combination=False,
product_id=False,
add_qty=1,
parent_combination=False,
only_template=False,
):
combination_info = super()._get_combination_info(
combination=combination,
product_id=product_id,
add_qty=add_qty,
parent_combination=parent_combination,
only_template=only_template,
)
if combination_info["product_id"]:
product = (
self.env["product.product"]
.sudo()
.browse(combination_info["product_id"])
)
else:
product = self.sudo()
provisioning_date = False
if (
product.show_next_provisioning_date
and product.qty_available - product.outgoing_qty <= 0
):
website_id = self.env.context.get("website_id")
company = self.env["website"].browse(website_id).company_id
provisioning_date = product._get_next_provisioning_date(company)
provisioning_date = format_date(self.env, provisioning_date)
combination_info.update(provisioning_date=provisioning_date)
return combination_info
3 changes: 3 additions & 0 deletions website_sale_stock_provisioning_date/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_provisioning_date/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Pedro M. Baeza
- Sergio Teruel
- Carlos Roca
3 changes: 3 additions & 0 deletions website_sale_stock_provisioning_date/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module extends the functionality of website to show you the future
provisioning date closest to the current date for a product in the
eCommerce.
Loading
Loading