odoo-addon-stock-restrict-lot 17.0.1.0.0.2__py3-none-any.whl → 17.0.1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-stock-restrict-lot might be problematic. Click here for more details.

@@ -7,7 +7,7 @@ Stock Restrict Lot
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:f42681cf63a0bc262bf9007e36dc6e42f7c8b2ac92b69c06f73fa4eef122d0d6
10
+ !! source digest: sha256:a234c164abefbf570af402e26ce332bdfb4e5b91c47a8cb46046c22d2a8f3777
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "Stock Restrict Lot",
3
3
  "summary": "Base module that add back the concept of restrict lot on stock move",
4
- "version": "17.0.1.0.0",
4
+ "version": "17.0.1.1.0",
5
5
  "category": "Warehouse Management",
6
6
  "website": "https://github.com/OCA/stock-logistics-workflow",
7
7
  "author": "Akretion, Odoo Community Association (OCA)",
@@ -13,8 +13,8 @@ msgstr ""
13
13
  "MIME-Version: 1.0\n"
14
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
15
  "Content-Transfer-Encoding: \n"
16
- "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
17
- "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
16
+ "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
17
+ "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
18
18
  "X-Generator: Weblate 4.17\n"
19
19
 
20
20
  #. module: stock_restrict_lot
@@ -26,6 +26,11 @@ msgstr ""
26
26
  msgid "Lot"
27
27
  msgstr ""
28
28
 
29
+ #. module: stock_restrict_lot
30
+ #: model:ir.model,name:stock_restrict_lot.model_product_product
31
+ msgid "Product Variant"
32
+ msgstr ""
33
+
29
34
  #. module: stock_restrict_lot
30
35
  #: model:ir.model.fields,field_description:stock_restrict_lot.field_stock_move__restrict_lot_id
31
36
  #: model:ir.model.fields,field_description:stock_restrict_lot.field_stock_picking__restrict_lot_id
@@ -42,6 +47,15 @@ msgstr ""
42
47
  msgid "Stock Rule"
43
48
  msgstr ""
44
49
 
50
+ #. module: stock_restrict_lot
51
+ #. odoo-python
52
+ #: code:addons/stock_restrict_lot/models/stock_move.py:0
53
+ #, python-format
54
+ msgid ""
55
+ "The lot(s) %(move_line_lot)s being moved is inconsistent with the "
56
+ "restriction on lot %(move_restrict_lot)s set on the move"
57
+ msgstr ""
58
+
45
59
  #. module: stock_restrict_lot
46
60
  #: model:ir.model,name:stock_restrict_lot.model_stock_picking
47
61
  msgid "Transfer"
@@ -1,3 +1,4 @@
1
1
  from . import stock_move
2
2
  from . import stock_rule
3
3
  from . import stock_picking
4
+ from . import product_product
@@ -0,0 +1,22 @@
1
+ # Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from odoo import models
4
+
5
+
6
+ class ProductProduct(models.Model):
7
+ _inherit = "product.product"
8
+
9
+ # To be able to get the outgoing and incoming qty by the restrict_lot_id
10
+ # the odoo standard method _compute_quantities_dict is hookable
11
+ # therefore the domain is already here changed
12
+ def _get_domain_locations(self):
13
+ res = super()._get_domain_locations()
14
+ lot_id = self.env.context.get("lot_id")
15
+ if not lot_id:
16
+ return res
17
+
18
+ domain_quant_loc, domain_move_in_loc, domain_move_out_loc = res
19
+ lot_domain = [("restrict_lot_id", "=", lot_id)]
20
+ domain_move_in_loc += lot_domain
21
+ domain_move_out_loc += lot_domain
22
+ return domain_quant_loc, domain_move_in_loc, domain_move_out_loc
@@ -1,4 +1,5 @@
1
1
  from odoo import _, api, exceptions, fields, models
2
+ from odoo.exceptions import UserError
2
3
 
3
4
 
4
5
  class StockMove(models.Model):
@@ -7,7 +8,9 @@ class StockMove(models.Model):
7
8
  # seems better to not copy this field except when a move is splitted, because a move
8
9
  # can be copied in multiple different occasions and could even be copied with a
9
10
  # different product...
10
- restrict_lot_id = fields.Many2one("stock.lot", string="Restrict Lot", copy=False)
11
+ restrict_lot_id = fields.Many2one(
12
+ "stock.lot", string="Restrict Lot", copy=False, index=True
13
+ )
11
14
 
12
15
  def _prepare_procurement_values(self):
13
16
  vals = super()._prepare_procurement_values()
@@ -88,3 +91,28 @@ class StockMove(models.Model):
88
91
  if vals_list and self.restrict_lot_id:
89
92
  vals_list[0]["restrict_lot_id"] = self.restrict_lot_id.id
90
93
  return vals_list
94
+
95
+ def _action_done(self, cancel_backorder=False):
96
+ res = super()._action_done(cancel_backorder=cancel_backorder)
97
+ self._check_lot_consistent_with_restriction()
98
+ return res
99
+
100
+ def _check_lot_consistent_with_restriction(self):
101
+ """
102
+ Check that the lot set on move lines
103
+ is the same as the restricted lot set on the move
104
+ """
105
+ for move in self:
106
+ if not (move.restrict_lot_id and move.move_line_ids):
107
+ continue
108
+ move_line_lot = move.mapped("move_line_ids.lot_id")
109
+ if move.restrict_lot_id != move_line_lot:
110
+ raise UserError(
111
+ _(
112
+ "The lot(s) %(move_line_lot)s being moved is "
113
+ "inconsistent with the restriction on "
114
+ "lot %(move_restrict_lot)s set on the move",
115
+ move_line_lot=", ".join(move_line_lot.mapped("display_name")),
116
+ move_restrict_lot=move.restrict_lot_id.display_name,
117
+ )
118
+ )
@@ -367,7 +367,7 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:f42681cf63a0bc262bf9007e36dc6e42f7c8b2ac92b69c06f73fa4eef122d0d6
370
+ !! source digest: sha256:a234c164abefbf570af402e26ce332bdfb4e5b91c47a8cb46046c22d2a8f3777
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_restrict_lot"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-17-0/stock-logistics-workflow-17-0-stock_restrict_lot"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>This module add a field to restrict a stock move to a specific lot. It
@@ -1,3 +1,4 @@
1
+ from odoo.exceptions import UserError
1
2
  from odoo.tests.common import TransactionCase
2
3
 
3
4
 
@@ -226,3 +227,77 @@ class TestRestrictLot(TransactionCase):
226
227
  assert_move_line_per_lot_and_location(
227
228
  pick.move_line_ids_without_package, lot2, location_2, 25
228
229
  )
230
+
231
+ def test_compute_quantites(self):
232
+ move = self.env["stock.move"].create(
233
+ {
234
+ "product_id": self.product.id,
235
+ "location_id": self.output_loc.id,
236
+ "location_dest_id": self.customer_loc.id,
237
+ "product_uom_qty": 1,
238
+ "product_uom": self.product.uom_id.id,
239
+ "name": "test",
240
+ "procure_method": "make_to_order",
241
+ "warehouse_id": self.warehouse.id,
242
+ "route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
243
+ "restrict_lot_id": self.lot.id,
244
+ }
245
+ )
246
+ move._action_confirm()
247
+
248
+ lot2 = self.lot.copy({"name": "lot2"})
249
+ move2 = move.copy()
250
+ move2.restrict_lot_id = lot2.id
251
+ move2._action_confirm()
252
+
253
+ product = move.product_id
254
+ self.assertEqual(product.outgoing_qty, 2)
255
+ product.invalidate_recordset()
256
+ product = product.with_context(lot_id=self.lot.id)
257
+ self.assertEqual(product.outgoing_qty, 1)
258
+
259
+ product.invalidate_recordset()
260
+ product = product.with_context(lot_id=lot2.id)
261
+ self.assertEqual(product.outgoing_qty, 1)
262
+
263
+ def test_move_validation_inconsistent_lot(self):
264
+ """
265
+ Check that an error is raised when performing a move _action_done()
266
+ if the lot restriction on the move is inconsistent with the
267
+ lot in the move line
268
+ """
269
+ lot2 = self.env["stock.lot"].create(
270
+ {
271
+ "name": "lot2",
272
+ "product_id": self.product.id,
273
+ "company_id": self.warehouse.company_id.id,
274
+ }
275
+ )
276
+ self._update_product_stock(1, lot2.id)
277
+
278
+ move = self.env["stock.move"].create(
279
+ {
280
+ "product_id": self.product.id,
281
+ "location_id": self.warehouse.lot_stock_id.id,
282
+ "location_dest_id": self.customer_loc.id,
283
+ "product_uom_qty": 1,
284
+ "product_uom": self.product.uom_id.id,
285
+ "name": "test",
286
+ "warehouse_id": self.warehouse.id,
287
+ "restrict_lot_id": self.lot.id,
288
+ }
289
+ )
290
+ move_line = self.env["stock.move.line"].create(
291
+ {
292
+ "move_id": move.id,
293
+ "product_id": move.product_id.id,
294
+ "quantity": 1,
295
+ "product_uom_id": move.product_uom.id,
296
+ "location_id": move.location_id.id,
297
+ "location_dest_id": move.location_dest_id.id,
298
+ "lot_id": lot2.id,
299
+ }
300
+ )
301
+ self.assertRaises(UserError, move._action_done)
302
+ move_line.lot_id = self.lot
303
+ move._action_done()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-stock_restrict_lot
3
- Version: 17.0.1.0.0.2
3
+ Version: 17.0.1.1.0
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: odoo>=17.0a,<17.1dev
6
6
  Summary: Base module that add back the concept of restrict lot on stock move
@@ -22,7 +22,7 @@ Stock Restrict Lot
22
22
  !! This file is generated by oca-gen-addon-readme !!
23
23
  !! changes will be overwritten. !!
24
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
- !! source digest: sha256:f42681cf63a0bc262bf9007e36dc6e42f7c8b2ac92b69c06f73fa4eef122d0d6
25
+ !! source digest: sha256:a234c164abefbf570af402e26ce332bdfb4e5b91c47a8cb46046c22d2a8f3777
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,23 +1,24 @@
1
- odoo/addons/stock_restrict_lot/README.rst,sha256=6CNw3on9XiAZmE4UKqQitJwLEnhRH-ig-NmwHrDoaxI,3496
1
+ odoo/addons/stock_restrict_lot/README.rst,sha256=w7qOB5IiIZ93y2RGF1vLqZE1pDtJTOw3JCr5bSnBk6Y,3496
2
2
  odoo/addons/stock_restrict_lot/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
- odoo/addons/stock_restrict_lot/__manifest__.py,sha256=ukpvsm_zam-lzizWQWdhJlgYbu8JJWSwx_YFQWBGUGA,506
3
+ odoo/addons/stock_restrict_lot/__manifest__.py,sha256=93X2PEQ9wjPS6YZodEQnC3MMRkRHxWExiTTtsXpvWB8,506
4
4
  odoo/addons/stock_restrict_lot/i18n/es.po,sha256=MZ60J56zGSarAYFXtDyIuji7j8P7aTmWICTuGqwKpDs,1672
5
- odoo/addons/stock_restrict_lot/i18n/hr.po,sha256=Tqcd15MAg7zkAXyDo1yIi1_Kr0LXAQZWuJu0LNmo1jM,1715
5
+ odoo/addons/stock_restrict_lot/i18n/hr.po,sha256=IriQ7a0dMLlBP2wcBAlFEw6R1uO-PJt4XDoJFG3II0Q,1715
6
6
  odoo/addons/stock_restrict_lot/i18n/it.po,sha256=2c6_gI6hkHJvcpJM_6LDX2678Ks2iE15Sfj88lp8yTg,1652
7
- odoo/addons/stock_restrict_lot/i18n/stock_restrict_lot.pot,sha256=FH3WGxhSbC2yvZ1CBc_UgHnNCjzcA9Rvhq4Pt8g2Aa4,1333
8
- odoo/addons/stock_restrict_lot/models/__init__.py,sha256=-gOtTg2qvw-MfS94T9alCWy4d-mQ09XYbPf8UeOA3MU,78
9
- odoo/addons/stock_restrict_lot/models/stock_move.py,sha256=dYtvFKACy4yC_S6qqJGLVqOa1U6lBPt-aU5vL9gmQQU,2906
7
+ odoo/addons/stock_restrict_lot/i18n/stock_restrict_lot.pot,sha256=AhJ4X9RXaEtapVvWPhQk3dHKAIADrVe5fT6Z8mBkpGY,1729
8
+ odoo/addons/stock_restrict_lot/models/__init__.py,sha256=3nhRO6ipFBMbcrlWXMEMR62djB3_7q2TxcUM42xYMGg,108
9
+ odoo/addons/stock_restrict_lot/models/product_product.py,sha256=CzzvEF2pv0wjVHor1KAUeFYSHlk5aqf5HNR0dC3MJfY,888
10
+ odoo/addons/stock_restrict_lot/models/stock_move.py,sha256=stXDy4srK6L2qTNQ6bHfoO24v3ZdmgGCJeq8RBvKxi8,4047
10
11
  odoo/addons/stock_restrict_lot/models/stock_picking.py,sha256=0l60llnOb3tnmk-3pNF21kP1aR8vO0qu5BbbeqD3T6A,417
11
12
  odoo/addons/stock_restrict_lot/models/stock_rule.py,sha256=NXXjB8rooKS0kpG3zvqpDDpLkmh7mvbnHLItDwdCec0,236
12
13
  odoo/addons/stock_restrict_lot/readme/CONTRIBUTORS.md,sha256=JBjjiC74D-iWs-cRLAY7BTnLuOA83Nh0fCtABQTadHs,98
13
14
  odoo/addons/stock_restrict_lot/readme/DESCRIPTION.md,sha256=5PwOcvRp7HF_bK6A2P20xcbXvvFZaCj6BYY7moybpO4,281
14
15
  odoo/addons/stock_restrict_lot/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
15
- odoo/addons/stock_restrict_lot/static/description/index.html,sha256=Nyw1svoLBwVfBX93yGENu8SFblEOqnTlkHn6lkTrxmA,12933
16
+ odoo/addons/stock_restrict_lot/static/description/index.html,sha256=0P7Swlc6hnetv-ddgH362_p0pqeFSAXESO2SwzxC-F4,12933
16
17
  odoo/addons/stock_restrict_lot/tests/__init__.py,sha256=5RimjaqBd8kD55SNoLqh-g9sCmmI28hPx7IQMUX6AOQ,32
17
- odoo/addons/stock_restrict_lot/tests/test_restrict_lot.py,sha256=lxbJarh0gLSO_T07r-5QkTIS4fbRowxRYOyYUrobp0w,9082
18
+ odoo/addons/stock_restrict_lot/tests/test_restrict_lot.py,sha256=k2dsPmHa3IctRAr46SUpsBwhH9HS9lxZU-uD8hcLc98,11840
18
19
  odoo/addons/stock_restrict_lot/views/stock_move_views.xml,sha256=unNYn0AuYyBhxSnnPN6xf6X7J7S-G1KbXJVYF20scA4,1191
19
20
  odoo/addons/stock_restrict_lot/views/stock_picking.xml,sha256=X1N9S5g09NREC_DJAlM1CjZuV21nJgBxTANn_6kC64o,1299
20
- odoo_addon_stock_restrict_lot-17.0.1.0.0.2.dist-info/METADATA,sha256=uO0zY2aGN41aSlSqXL4fyd4-xoJY9tMMOQIg0CoixuY,4068
21
- odoo_addon_stock_restrict_lot-17.0.1.0.0.2.dist-info/WHEEL,sha256=8Rd4enx1PCuyDWP4SABqO5Fv8rpaknqp3VzjoFFLa6c,83
22
- odoo_addon_stock_restrict_lot-17.0.1.0.0.2.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
23
- odoo_addon_stock_restrict_lot-17.0.1.0.0.2.dist-info/RECORD,,
21
+ odoo_addon_stock_restrict_lot-17.0.1.1.0.dist-info/METADATA,sha256=jk4Qs8RMkvzvX5H9R1YR1_w85XBu23qKCzSPrk5MRog,4066
22
+ odoo_addon_stock_restrict_lot-17.0.1.1.0.dist-info/WHEEL,sha256=8Rd4enx1PCuyDWP4SABqO5Fv8rpaknqp3VzjoFFLa6c,83
23
+ odoo_addon_stock_restrict_lot-17.0.1.1.0.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
24
+ odoo_addon_stock_restrict_lot-17.0.1.1.0.dist-info/RECORD,,