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] pos_lot_selection: Migration to 17.0 #1106

Merged
merged 29 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0b3c0dc
[10.0][ADD] pos_lot_selection: New module (#256)
chienandalu Mar 14, 2018
8ec08fe
[UPD] Update pos_lot_selection.pot
oca-travis Jun 22, 2018
bcdf4ad
[MIG] pos_lot_selection: Migration to 11.0
NachoAlesLopez Aug 30, 2018
587e5db
[IMP] pos_lot_selection: clone control no longer needed
chienandalu Mar 16, 2018
1ab45ad
[UPD] Update pos_lot_selection.pot
oca-travis Oct 27, 2018
cccb9eb
[FIX] pos_lot_selection: ES6 code breaks phantomjs tests
kirca Feb 13, 2019
0f45849
Added translation using Weblate (Catalan)
danimv5 Mar 26, 2021
110da6b
Translated using Weblate (Catalan)
danimv5 Mar 26, 2021
4c4440e
[MIG] pos_lot_selection
i-vyshnevska Aug 26, 2022
add5bdc
[UPD] Update pos_lot_selection.pot
Sep 26, 2022
12e073f
[UPD] README.rst
OCA-git-bot Sep 26, 2022
b6105b5
[FIX] pos_lot_selection: proper module name in js definition
ivantodorovich Sep 28, 2022
ecc1cb8
[FIX] pos_lot_selection: access rights
ivantodorovich Sep 28, 2022
f6c6e6c
[IMP] pos_lot_selection: bump js to es6
ivantodorovich Sep 28, 2022
51200fb
[IMP] pos_lot_selection: avoid replace in xml views, simplify code
ivantodorovich Sep 28, 2022
89459d8
[UPD] Update pos_lot_selection.pot
Sep 29, 2022
49b052e
pos_lot_selection 15.0.1.0.1
OCA-git-bot Sep 29, 2022
601355d
[MIG] pos_lot_selection: Migration to 16.0
yankinmax Feb 28, 2023
33a03ce
[UPD] Update pos_lot_selection.pot
Feb 28, 2023
2221f88
Added translation using Weblate (Italian)
mymage Mar 9, 2023
96f4c69
Translated using Weblate (Italian)
mymage Mar 9, 2023
2052617
Added translation using Weblate (Spanish)
FLNerea Mar 31, 2023
8de976e
Translated using Weblate (Italian)
mymage Apr 17, 2023
a7698f6
Translated using Weblate (Spanish)
Ivorra78 Aug 22, 2023
ada368e
[UPD] README.rst
OCA-git-bot Sep 3, 2023
cff55df
Translated using Weblate (Italian)
mymage Nov 2, 2023
273888f
[IMP] pos_lot_selection: pre-commit auto fixes
nguyenminhchien Nov 30, 2023
5f4f759
[MIG] pos_lot_selection: Migration to 17.0
nguyenminhchien Dec 1, 2023
115bde5
[REF] pos_lot_selection: Make it work properly on offline mode
etobella Jan 8, 2024
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
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
Loading