-
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
17 changed files
with
739 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_lot_filter_available/odoo/addons/stock_lot_filter_available
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_lot_filter_available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
========================== | ||
Stock Lot Filter 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%2Fstock--logistics--warehouse-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_lot_filter_available | ||
:alt: OCA/stock-logistics-warehouse | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_lot_filter_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/153/13.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows us to filter lots by available on our stock. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module: | ||
|
||
#. Go to Inventory > Master Data > Lots/Serial Numbers. | ||
#. Press Filters > On hand. | ||
|
||
Now you will see just the lots with stock. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20stock_lot_filter_available%0Aversion:%2013.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 | ||
|
||
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. | ||
|
||
.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px | ||
:target: https://github.com/CarlosRoca13 | ||
:alt: CarlosRoca13 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-CarlosRoca13| | ||
|
||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_lot_filter_available>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2021 Tecnativa - Carlos Roca | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
{ | ||
"name": "Stock Lot Filter Available", | ||
"summary": "Allow to filter lots by available on stock", | ||
"version": "15.0.1.0.0", | ||
"category": "Warehouse", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["stock"], | ||
"data": ["views/stock_production_lot_views.xml"], | ||
"website": "https://github.com/OCA/stock-logistics-warehouse", | ||
"installable": True, | ||
"maintainers": ["CarlosRoca13"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_lot_available | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-05-07 06:58+0000\n" | ||
"PO-Revision-Date: 2021-05-07 09:00+0200\n" | ||
"Last-Translator: Carlos <[email protected]>\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: Poedit 2.0.6\n" | ||
|
||
#. module: stock_lot_filter_available | ||
#: model:ir.model,name:stock_lot_filter_available.model_stock_production_lot | ||
msgid "Lot/Serial" | ||
msgstr "Lote/Número de serie" | ||
|
||
#. module: stock_lot_filter_available | ||
#: model_terms:ir.ui.view,arch_db:stock_lot_filter_available.search_product_lot_filter | ||
msgid "On hand" | ||
msgstr "A mano" | ||
|
||
#. module: stock_lot_filter_available | ||
#: model:ir.model.fields,field_description:stock_lot_filter_available.field_stock_production_lot__product_qty | ||
msgid "Quantity" | ||
msgstr "Cantidad" | ||
|
||
#. module: stock_lot_filter_available | ||
#: code:addons/stock_lot_filter_available/models/stock_production_lot.py:0 | ||
#, python-format | ||
msgid "Unsupported search" | ||
msgstr "Búsqueda no soportada" |
35 changes: 35 additions & 0 deletions
35
stock_lot_filter_available/i18n/stock_lot_filter_available.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_lot_filter_available | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.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_lot_filter_available | ||
#: model:ir.model,name:stock_lot_filter_available.model_stock_production_lot | ||
msgid "Lot/Serial" | ||
msgstr "" | ||
|
||
#. module: stock_lot_filter_available | ||
#: model_terms:ir.ui.view,arch_db:stock_lot_filter_available.search_product_lot_filter | ||
msgid "On hand" | ||
msgstr "" | ||
|
||
#. module: stock_lot_filter_available | ||
#: model:ir.model.fields,field_description:stock_lot_filter_available.field_stock_production_lot__product_qty | ||
msgid "Quantity" | ||
msgstr "" | ||
|
||
#. module: stock_lot_filter_available | ||
#: code:addons/stock_lot_filter_available/models/stock_production_lot.py:0 | ||
#, python-format | ||
msgid "Unsupported search" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_production_lot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2021 Tecnativa - Carlos Roca | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
import operator as operator_lib | ||
|
||
from odoo import _, fields, models | ||
|
||
|
||
class StockProductionLot(models.Model): | ||
_inherit = "stock.production.lot" | ||
|
||
product_qty = fields.Float(search="_search_product_qty") | ||
|
||
def _search_product_qty(self, operator, value): | ||
operator_mapping = { | ||
">": operator_lib.gt, | ||
">=": operator_lib.ge, | ||
"<": operator_lib.lt, | ||
"<=": operator_lib.le, | ||
"=": operator_lib.eq, | ||
"!=": operator_lib.ne, | ||
} | ||
if operator not in operator_mapping: | ||
raise ValueError(_("Unsupported search")) | ||
ids = [] | ||
domain = [ | ||
("location_id.usage", "in", ["internal", "transit"]), | ||
("lot_id", "!=", False), | ||
] | ||
groups = self.env["stock.quant"].read_group( | ||
domain, ["lot_id", "quantity"], ["lot_id"] | ||
) | ||
involved_lot_ids = [group["lot_id"][0] for group in groups] | ||
if ( | ||
(operator == "=" and value == 0) | ||
or (operator == "<" and value > 0) | ||
or (operator == "<=" and value >= 0) | ||
): | ||
ids.extend( | ||
self.env["stock.production.lot"] | ||
.search([("id", "not in", involved_lot_ids)]) | ||
.ids | ||
) | ||
for group in groups: | ||
if operator_mapping[operator](group["quantity"], value): | ||
ids.append(group["lot_id"][0]) | ||
return [("id", "in", ids)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Carlos Roca |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows us to filter lots by available on our stock. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
To use this module: | ||
|
||
#. Go to Inventory > Products > Lots/Serial Numbers. | ||
#. Press Filters > On hand. | ||
|
||
Now you will see just the lots with stock. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.