Skip to content

Commit

Permalink
Merge PR #1616 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Jun 24, 2024
2 parents 6556f40 + e4f1710 commit 492e068
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions stock_picking_auto_create_lot/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from . import stock_picking
from . import stock_picking_type
from . import stock_move
from . import stock_move_line
12 changes: 12 additions & 0 deletions stock_picking_auto_create_lot/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

def _get_lot_sequence(self):
self.ensure_one()
return self.env["ir.sequence"].next_by_code("stock.lot.serial")
8 changes: 2 additions & 6 deletions stock_picking_auto_create_lot/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2018 Tecnativa - Sergio Teruel
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo import models


class StockPicking(models.Model):
Expand All @@ -21,7 +21,7 @@ def _set_auto_lot(self):
)
)
for line in lines:
line.lot_name = self._get_lot_sequence()
line.lot_name = line._get_lot_sequence()

def _action_done(self):
self._set_auto_lot()
Expand All @@ -30,7 +30,3 @@ def _action_done(self):
def button_validate(self):
self._set_auto_lot()
return super().button_validate()

@api.model
def _get_lot_sequence(self):
return self.env["ir.sequence"].next_by_code("stock.lot.serial")

0 comments on commit 492e068

Please sign in to comment.