Skip to content

Commit c685df9

Browse files
committed
[MIG] stock_tracking_integrity: Migration to 18.0
1 parent a9f086c commit c685df9

File tree

11 files changed

+84
-70
lines changed

11 files changed

+84
-70
lines changed

stock_tracking_integrity/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Credits
4646
Authors
4747
-------
4848

49-
* NuoBiT Solutions
50-
* S.L.
49+
* NuoBiT Solutions SL
5150

5251
Contributors
5352
------------
5453

5554
- `NuoBiT <https://www.nuobit.com>`__:
5655

57-
- Frank Cespedes <fcespedes@nuobit.com>
58-
- Eric Antones <eatones@nuobit.com>
56+
- Frank Cespedes fcespedes@nuobit.com
57+
- Eric Antones eatones@nuobit.com
58+
- Deniz Gallo dgallo@nuobit.com
5959

6060
Maintainers
6161
-----------
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
2-
# Frank Cespedes <fcespedes@nuobit.com>
3-
# Eric Antones <eatones@nuobit.com>
1+
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
2+
# Copyright NuoBiT Solutions - Eric Antones <eatones@nuobit.com>
3+
# Copyright 2025 NuoBiT Solutions - Deniz Gallo <dgallo@nuobit.com>
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
55

66
{
77
"name": "Stock Tracking Integrity",
88
"summary": "This module ensures the integrity of the product according"
99
" to the type of tracking.",
10-
"author": "NuoBiT Solutions, S.L.",
10+
"author": "NuoBiT Solutions SL",
1111
"category": "Warehouse",
12-
"version": "14.0.1.0.0",
12+
"version": "18.0.1.0.0",
1313
"license": "AGPL-3",
1414
"website": "https://github.com/NuoBiT/odoo-addons",
1515
"depends": ["stock"],
16-
"data": ["views/stock_inventory_views.xml"],
1716
}

stock_tracking_integrity/i18n/es.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 14.0\n"
7+
"Project-Id-Version: Odoo Server 18.0\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2024-04-03 14:35+0000\n"
1010
"PO-Revision-Date: 2024-04-03 14:35+0000\n"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from . import stock_inventory
1+
from . import stock_quant
22
from . import stock_move_line
33
from . import product_template

stock_tracking_integrity/models/product_template.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
2-
# Frank Cespedes <fcespedes@nuobit.com>
3-
# Eric Antones <eatones@nuobit.com>
1+
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
2+
# Copyright NuoBiT Solutions - Eric Antones <eatones@nuobit.com>
43
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
54

5+
66
from odoo import api, models
77

88

stock_tracking_integrity/models/stock_inventory.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

stock_tracking_integrity/models/stock_move_line.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
2-
# Frank Cespedes <fcespedes@nuobit.com>
3-
# Eric Antones <eatones@nuobit.com>
1+
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
2+
# Copyright NuoBiT Solutions - Eric Antones <eatones@nuobit.com>
3+
# Copyright 2025 NuoBiT Solutions - Deniz Gallo <dgallo@nuobit.com>
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
55

6+
67
from odoo import _, api, models
78
from odoo.exceptions import ValidationError
89

@@ -21,16 +22,24 @@ def _check_lot_id_by_tracking(self):
2122
if not rec.lot_id and rec.product_id.tracking != "none":
2223
raise ValidationError(
2324
_(
24-
"The product %s with tracking '%s' only "
25+
"The product %(product_name)s with tracking "
26+
"'%(tracking)s' only "
2527
"can have movements with a lot number."
2628
)
27-
% (rec.product_id.display_name, tracking_label)
29+
% {
30+
"product_name": rec.product_id.display_name,
31+
"tracking": tracking_label,
32+
}
2833
)
2934
if rec.lot_id and rec.product_id.tracking == "none":
3035
raise ValidationError(
3136
_(
32-
"The product %s with tracking '%s' only "
37+
"The product %(product_name)s with tracking "
38+
"'%(tracking)s' only "
3339
"can have movements without a lot number."
3440
)
35-
% (rec.product_id.display_name, tracking_label)
41+
% {
42+
"product_name": rec.product_id.display_name,
43+
"tracking": tracking_label,
44+
}
3645
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
2+
# Copyright NuoBiT Solutions - Eric Antones <eatones@nuobit.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
4+
5+
6+
from odoo import _, api, models
7+
from odoo.exceptions import ValidationError
8+
9+
10+
class StockQuant(models.Model):
11+
_inherit = "stock.quant"
12+
13+
@api.constrains("product_id", "lot_id", "quantity")
14+
def _check_lot_id_by_tracking(self):
15+
tracking_selection = dict(
16+
self.env["product.template"].fields_get(allfields=["tracking"])["tracking"][
17+
"selection"
18+
]
19+
)
20+
for rec in self.filtered(lambda q: q.quantity > 0):
21+
tracking_label = tracking_selection.get(
22+
rec.product_id.tracking, rec.product_id.tracking
23+
)
24+
if not rec.lot_id and rec.product_id.tracking != "none":
25+
raise ValidationError(
26+
_(
27+
"The product %(product_name)s with tracking "
28+
"'%(tracking)s' only "
29+
"can have quants with a lot number."
30+
)
31+
% {
32+
"product_name": rec.product_id.display_name,
33+
"tracking": tracking_label,
34+
}
35+
)
36+
if rec.lot_id and rec.product_id.tracking == "none":
37+
raise ValidationError(
38+
_(
39+
"The product %(product_name)s with tracking "
40+
"'%(tracking)s' only "
41+
"can have quants without a lot number."
42+
)
43+
% {
44+
"product_name": rec.product_id.display_name,
45+
"tracking": tracking_label,
46+
}
47+
)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- [NuoBiT](https://www.nuobit.com):
2-
- Frank Cespedes \<fcespedes@nuobit.com\>
3-
- Eric Antones \<eatones@nuobit.com\>
2+
- Frank Cespedes <fcespedes@nuobit.com>
3+
- Eric Antones <eatones@nuobit.com>
4+
- Deniz Gallo <dgallo@nuobit.com>

stock_tracking_integrity/static/description/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,16 @@ <h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
397397
<div class="section" id="authors">
398398
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
399399
<ul class="simple">
400-
<li>NuoBiT Solutions</li>
401-
<li>S.L.</li>
400+
<li>NuoBiT Solutions SL</li>
402401
</ul>
403402
</div>
404403
<div class="section" id="contributors">
405404
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
406405
<ul class="simple">
407406
<li><a class="reference external" href="https://www.nuobit.com">NuoBiT</a>:<ul>
408-
<li>Frank Cespedes &lt;<a class="reference external" href="mailto:fcespedes&#64;nuobit.com">fcespedes&#64;nuobit.com</a>&gt;</li>
409-
<li>Eric Antones &lt;<a class="reference external" href="mailto:eatones&#64;nuobit.com">eatones&#64;nuobit.com</a>&gt;</li>
407+
<li>Frank Cespedes <a class="reference external" href="mailto:fcespedes&#64;nuobit.com">fcespedes&#64;nuobit.com</a></li>
408+
<li>Eric Antones <a class="reference external" href="mailto:eatones&#64;nuobit.com">eatones&#64;nuobit.com</a></li>
409+
<li>Deniz Gallo <a class="reference external" href="mailto:dgallo&#64;nuobit.com">dgallo&#64;nuobit.com</a></li>
410410
</ul>
411411
</li>
412412
</ul>

0 commit comments

Comments
 (0)