Skip to content

Commit

Permalink
Merge PR #1106 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by etobella
  • Loading branch information
OCA-git-bot committed Jan 17, 2024
2 parents 0bf588e + 115bde5 commit f6322d2
Show file tree
Hide file tree
Showing 22 changed files with 1,031 additions and 0 deletions.
107 changes: 107 additions & 0 deletions pos_lot_selection/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
=================
POS Lot Selection
=================

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

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

This module allows to pick between existing lots in POS frontend.

**Table of contents**

.. contents::
:local:

Usage
=====

1. Go to *Inventory > Settings* and set the option *Track lots or serial
numbers*
2. Chose a product that is stockable, go to its *Inventory* tab, and set
*Tracking* to *By Lots*.
3. Go to its *Sales* tab and set it as *Available in the Point of Sale*.
4. Click on *Update Qty On Hand*, chose the same location configured in
the POS you want the lot available in; write a quantity; unfold the
*Lot/Serial Number* field and pick create one if none is available
yet.
5. Create a new lot with the serial number of your choice.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_lot_selection%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
* Camptocamp

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

- Camptocamp

- Iryna Vyshnevska
- Ivan Todorovich
- Maksym Yankin

- Dixmit

- Enric Tobella

- Tecnativa

- David Vidal

- Trobz Consulting

- Nguyen Minh Chien [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/pos <https://github.com/OCA/pos/tree/17.0/pos_lot_selection>`_ 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 pos_lot_selection/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions pos_lot_selection/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2018 Tecnativa S.L. - David Vidal
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "POS Lot Selection",
"version": "17.0.1.0.0",
"category": "Point of Sale",
"author": "Tecnativa, Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": [
"point_of_sale",
],
"assets": {
"point_of_sale._assets_pos": [
"pos_lot_selection/static/src/js/**/*.js",
"pos_lot_selection/static/src/xml/**/*.xml",
],
"web.assets_tests": [
"pos_lot_selection/static/tests/tours/**/*",
],
},
"application": False,
"installable": True,
}
29 changes: 29 additions & 0 deletions pos_lot_selection/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_lot_selection
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-08-22 18:15+0000\n"
"Last-Translator: Ivorra78 <[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 4.17\n"

#. module: pos_lot_selection
#: model:ir.model,name:pos_lot_selection.model_stock_lot
msgid "Lot/Serial"
msgstr "Lote/Número de serie"

#. module: pos_lot_selection
#. odoo-javascript
#: code:addons/pos_lot_selection/static/src/js/EditListPopup.js:0
#, python-format
msgid "Lot/Serial Number(s) Required"
msgstr "Lote/Número(s) de serie Obligatorio"
29 changes: 29 additions & 0 deletions pos_lot_selection/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_lot_selection
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-02 16:37+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: pos_lot_selection
#: model:ir.model,name:pos_lot_selection.model_stock_lot
msgid "Lot/Serial"
msgstr "Lotto/seriale"

#. module: pos_lot_selection
#. odoo-javascript
#: code:addons/pos_lot_selection/static/src/js/EditListPopup.js:0
#, python-format
msgid "Lot/Serial Number(s) Required"
msgstr "Richiesto numero(i) lotto/seriale"
26 changes: 26 additions & 0 deletions pos_lot_selection/i18n/pos_lot_selection.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_lot_selection
#
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: pos_lot_selection
#: model:ir.model,name:pos_lot_selection.model_stock_lot
msgid "Lot/Serial"
msgstr ""

#. module: pos_lot_selection
#. odoo-javascript
#: code:addons/pos_lot_selection/static/src/js/EditListPopup.js:0
#, python-format
msgid "Lot/Serial Number(s) Required"
msgstr ""
4 changes: 4 additions & 0 deletions pos_lot_selection/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import product_product
from . import stock_lot

from . import pos_session
18 changes: 18 additions & 0 deletions pos_lot_selection/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_product_product(self):
result = super()._loader_params_product_product()
result["search_params"]["fields"].append("available_lot_for_pos_ids")
return result

def get_pos_ui_product_product_by_params(self, custom_search_params):
return super(
PosSession, self.with_company(self.company_id.id)
).get_pos_ui_product_product_by_params(custom_search_params)
48 changes: 48 additions & 0 deletions pos_lot_selection/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2022 Camptocamp SA
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import api, fields, models
from odoo.tools import float_compare


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

available_lot_for_pos_ids = fields.Json(
compute="_compute_available_lot_for_pos", prefetch=False
)

@api.depends()
@api.depends_context("company")
def _compute_available_lot_for_pos(self):
for record in self:
record.available_lot_for_pos_ids = record.get_available_lots_for_pos(
self.env.company.id
)

def get_available_lots_for_pos(self, company_id):
self.ensure_one()
if self.type != "product" or self.tracking == "none":
return []
lots = (
self.env["stock.lot"]
.sudo()
.search(
[
"&",
["product_id", "=", self.id],
"|",
["company_id", "=", company_id],
["company_id", "=", False],
]
)
)

lots = lots.filtered(
lambda lot: float_compare(
lot.product_qty, 0, precision_digits=lot.product_uom_id.rounding
)
> 0
)
return [lot._get_pos_info() for lot in lots]
16 changes: 16 additions & 0 deletions pos_lot_selection/models/stock_lot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2022 Camptocamp SA
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import models


class StockLot(models.Model):
_inherit = "stock.lot"

def _get_pos_info(self):
# We will add this as a hook to add more fields if necessary
return {
"id": self.id,
"name": self.name,
}
3 changes: 3 additions & 0 deletions pos_lot_selection/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
10 changes: 10 additions & 0 deletions pos_lot_selection/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- Camptocamp
- Iryna Vyshnevska
- Ivan Todorovich
- Maksym Yankin
- Dixmit
- Enric Tobella
- Tecnativa
- David Vidal
- Trobz Consulting
- Nguyen Minh Chien <[email protected]>
1 change: 1 addition & 0 deletions pos_lot_selection/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to pick between existing lots in POS frontend.
11 changes: 11 additions & 0 deletions pos_lot_selection/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1. Go to *Inventory \> Settings* and set the option *Track lots or
serial numbers*
2. Chose a product that is stockable, go to its *Inventory* tab, and
set *Tracking* to *By Lots*.
3. Go to its *Sales* tab and set it as *Available in the Point of
Sale*.
4. Click on *Update Qty On Hand*, chose the same location configured in
the POS you want the lot available in; write a quantity; unfold the
*Lot/Serial Number* field and pick create one if none is available
yet.
5. Create a new lot with the serial number of your choice.
Binary file added pos_lot_selection/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 f6322d2

Please sign in to comment.