Skip to content

Commit

Permalink
Merge PR #33 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Feb 12, 2025
2 parents 2b4e016 + 761e475 commit 9065814
Show file tree
Hide file tree
Showing 19 changed files with 845 additions and 0 deletions.
77 changes: 77 additions & 0 deletions stock_free_quantity/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
===================
Stock Free Quantity
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2a7f0ed0b42635286e2da7a7e66dc3461a328c810e76b325cffadfea940d52c2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--availability-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-availability/tree/18.0/stock_free_quantity
:alt: OCA/stock-logistics-availability
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-availability-18-0/stock-logistics-availability-18-0-stock_free_quantity
: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/stock-logistics-availability&target_branch=18.0
:alt: Try me on Runboat

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

Add Product variant free quantity in Product form view and add the same
on Product templates.

**Table of contents**

.. contents::
:local:

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

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

* Akretion

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

- Florian da Costa <[email protected]>

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/stock-logistics-availability <https://github.com/OCA/stock-logistics-availability/tree/18.0/stock_free_quantity>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_free_quantity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions stock_free_quantity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Stock Free Quantity",
"version": "18.0.1.0.0",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-availability",
"development_status": "Production/Stable",
"category": "Warehouse",
"depends": ["stock"],
"license": "AGPL-3",
"data": [
"views/product_template_view.xml",
"views/product_product_view.xml",
],
"installable": True,
}
41 changes: 41 additions & 0 deletions stock_free_quantity/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_free_quantity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-21 10:08+0000\n"
"Last-Translator: Ricardoalso <[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 4.17\n"

#. module: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_normal_form_view
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.view_stock_available_form
msgid "<span class=\"o_stat_text\">Free</span>"
msgstr "<span class=\"o_stat_text\">Disponible</span>"

#. module: stock_free_quantity
#: model:ir.model.fields,field_description:stock_free_quantity.field_product_template__free_qty
msgid "Free Quantity"
msgstr "Quantité disponible"

#. module: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_template_kanban_free_qty_view
msgid "Free:"
msgstr "Disponible :"

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

#~ msgid "Product Template"
#~ msgstr "Article"
38 changes: 38 additions & 0 deletions stock_free_quantity/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_free_quantity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-24 16:35+0000\n"
"Last-Translator: mymage <[email protected]>\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: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_normal_form_view
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.view_stock_available_form
msgid "<span class=\"o_stat_text\">Free</span>"
msgstr "<span class=\"o_stat_text\">Libera</span>"

#. module: stock_free_quantity
#: model:ir.model.fields,field_description:stock_free_quantity.field_product_template__free_qty
msgid "Free Quantity"
msgstr "Quantità libera"

#. module: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_template_kanban_free_qty_view
msgid "Free:"
msgstr "Libera:"

#. module: stock_free_quantity
#: model:ir.model,name:stock_free_quantity.model_product_template
msgid "Product"
msgstr "Prodotto"
35 changes: 35 additions & 0 deletions stock_free_quantity/i18n/stock_free_quantity.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_free_quantity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_normal_form_view
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.view_stock_available_form
msgid "<span class=\"o_stat_text\">Free</span>"
msgstr ""

#. module: stock_free_quantity
#: model:ir.model.fields,field_description:stock_free_quantity.field_product_template__free_qty
msgid "Free Quantity"
msgstr ""

#. module: stock_free_quantity
#: model_terms:ir.ui.view,arch_db:stock_free_quantity.product_template_kanban_free_qty_view
msgid "Free:"
msgstr ""

#. module: stock_free_quantity
#: model:ir.model,name:stock_free_quantity.model_product_template
msgid "Product"
msgstr ""
1 change: 1 addition & 0 deletions stock_free_quantity/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template
11 changes: 11 additions & 0 deletions stock_free_quantity/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import models


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

def _prepare_domain_available_not_reserved(self):
domain_quant = [("product_id", "in", self.ids)]
domain_quant_locations = self._get_domain_locations()[0]
domain_quant.extend(domain_quant_locations)
return domain_quant
32 changes: 32 additions & 0 deletions stock_free_quantity/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from odoo import fields, models


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

def _compute_quantities_dict(self):
prod_available = super()._compute_quantities_dict()
for template in self:
free_qty = 0
for p in template.with_context(active_test=False).product_variant_ids:
free_qty += p.free_qty
prod_available[template.id]["free_qty"] = free_qty
return prod_available

def _compute_quantities(self):
super()._compute_quantities()
res = self._compute_quantities_dict()
for template in self:
template.free_qty = res[template.id]["free_qty"]
return

def _search_free_qty(self, operator, value):
return [("product_variant_ids.free_qty", operator, value)]

free_qty = fields.Float(
"Free Quantity",
compute="_compute_quantities",
search="_search_free_qty",
compute_sudo=False,
digits="Product Unit of Measure",
)
3 changes: 3 additions & 0 deletions stock_free_quantity/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions stock_free_quantity/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Florian da Costa \<<[email protected]>\>
2 changes: 2 additions & 0 deletions stock_free_quantity/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add Product variant free quantity in Product form view and add the same
on Product templates.
Binary file added stock_free_quantity/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9065814

Please sign in to comment.