Skip to content

Commit 738eef7

Browse files
committed
[MIG] product_lot_sequence: Migration to 17.0
1 parent 3b9382f commit 738eef7

File tree

9 files changed

+29
-9
lines changed

9 files changed

+29
-9
lines changed

product_lot_sequence/README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ Contributors
127127

128128
- Yoshi Tashiro
129129

130+
- `Apik <https://www.apik.cloud>`__:
131+
132+
- Frederic Grall
133+
130134
Maintainers
131135
-----------
132136

product_lot_sequence/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Product Lot Sequence",
66
"summary": """
77
Adds ability to define a lot sequence from the product""",
8-
"version": "16.0.1.0.2",
8+
"version": "17.0.1.0.0",
99
"license": "AGPL-3",
1010
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/product-attribute",

product_lot_sequence/models/stock_lot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create(self, vals_list):
5252
lot_vals["name"] = self.env["ir.sequence"].next_by_code(
5353
"stock.lot.serial"
5454
)
55-
return super(StockLot, self).create(vals_list)
55+
return super().create(vals_list)
5656

5757
@api.model
5858
def _get_next_serial(self, company, product):

product_lot_sequence/models/stock_move.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ class StockMove(models.Model):
99
def action_show_details(self):
1010
"""Avoid calling and incrementing the sequence if not needed or already done"""
1111
seq_policy = self.env["stock.lot"]._get_sequence_policy()
12+
1213
if seq_policy in ("product", "global"):
1314
# If move is not supposed to assign serial pass empty string for next serial
1415
if not self.display_assign_serial:
1516
self = self.with_context(force_next_serial="")
1617
# If the sequence was already called once, avoid calling it another time
1718
elif self.next_serial:
1819
self = self.with_context(force_next_serial=self.next_serial)
19-
return super(StockMove, self).action_show_details()
20+
elif self.product_id.tracking == "serial" and self.state == "assigned":
21+
self.next_serial = self.env["stock.lot"]._get_next_serial(
22+
self.company_id, self.product_id
23+
)
24+
return super().action_show_details()

product_lot_sequence/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
- Vincent Van Rossem \<<vincent.vanrossem@camptocamp.com>\>
66
- [Quartile](https://www.quartile.co):
77
- Yoshi Tashiro
8+
- [Apik](https://www.apik.cloud):
9+
- Frederic Grall

product_lot_sequence/static/description/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ <h2><a class="toc-backref" href="#toc-entry-9">Contributors</a></h2>
477477
<li>Yoshi Tashiro</li>
478478
</ul>
479479
</li>
480+
<li><a class="reference external" href="https://www.apik.cloud">Apik</a>:<ul>
481+
<li>Frederic Grall</li>
482+
</ul>
483+
</li>
480484
</ul>
481485
</div>
482486
<div class="section" id="maintainers">

product_lot_sequence/tests/test_product_lot_sequence.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import logging
2+
13
from odoo.tests import Form
24
from odoo.tests.common import TransactionCase
35

6+
_logger = logging.getLogger(__name__)
7+
48

59
class TestProductLotSequence(TransactionCase):
610
"""Test product lot sequence."""
711

812
def setUp(self):
9-
super(TestProductLotSequence, self).setUp()
13+
super().setUp()
1014
self.product_product = self.env["product.product"]
1115
self.stock_production_lot = self.env["stock.lot"]
1216
self.receipt_type = self.env.ref("stock.picking_type_in")

product_lot_sequence/views/product_views.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@
1010
<field name="display_lot_sequence_fields" invisible="1" />
1111
<field
1212
name="lot_sequence_prefix"
13-
attrs="{'invisible': ['|', '|', ('tracking', 'not in', ['lot', 'serial']), ('display_lot_sequence_fields', '=', False), ('lot_sequence_id', '!=', False)]}"
13+
invisible="tracking not in ['lot', 'serial'] or not display_lot_sequence_fields or lot_sequence_id"
1414
/>
1515
<field
1616
name="lot_sequence_padding"
17-
attrs="{'invisible': ['|', '|', ('tracking', 'not in', ['lot', 'serial']), ('display_lot_sequence_fields', '=', False), ('lot_sequence_id', '!=', False)]}"
17+
invisible="tracking not in ['lot', 'serial'] or not display_lot_sequence_fields or lot_sequence_id"
1818
/>
1919
<field
2020
name="lot_sequence_number_next"
21-
attrs="{'readonly': [('lot_sequence_id', '!=', False)], 'invisible': ['|', ('tracking', 'not in', ['lot', 'serial']), ('display_lot_sequence_fields', '=', False)]}"
21+
readonly="lot_sequence_id"
22+
invisible="tracking not in ['lot', 'serial'] or not display_lot_sequence_fields"
2223
/>
2324
<field
2425
name="lot_sequence_id"
25-
attrs="{'invisible': ['|', ('tracking', 'not in', ['lot', 'serial']), ('display_lot_sequence_fields', '=', False)]}"
26+
invisible="tracking not in ['lot', 'serial'] or not display_lot_sequence_fields"
2627
/>
2728
</field>
2829
</field>

product_lot_sequence/views/res_config_settings_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<field name="model">res.config.settings</field>
66
<field name="inherit_id" ref="stock.res_config_settings_view_form" />
77
<field name="arch" type="xml">
8-
<xpath expr="//div[@id='production_lot_info']" position="inside">
8+
<xpath expr="//block[@id='production_lot_info']" position="inside">
99
<div class="col-12 col-lg-6 o_setting_box">
1010
<div class="o_setting_right_pane">
1111
<label for="lot_sequence_padding" />

0 commit comments

Comments
 (0)