Skip to content

Commit

Permalink
[16.0][ADD] stock_move_line_generate_lot_name: It generates the move …
Browse files Browse the repository at this point in the history
…lines lot name by sequence when dividing the line.
  • Loading branch information
Berezi committed Dec 18, 2024
1 parent 9105e41 commit 3980ea1
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_move_line_divide_generate_lot_name/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
28 changes: 28 additions & 0 deletions stock_move_line_divide_generate_lot_name/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

========================================
Stock Move Line Divide Generate Lot Name
========================================

* When dividing stock move lines, it generates the name of lots by sequence.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Contributors
------------

* Berezi Amubieta <bereziamubieta@avanzosc.es>
* Ana Juaristi <anajuaristi@avanzosc.es>
1 change: 1 addition & 0 deletions stock_move_line_divide_generate_lot_name/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions stock_move_line_divide_generate_lot_name/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Move Line Divide Generate Lot Name",
"version": "16.0.1.0.0",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/odoo-addons",
"category": "Inventory",
"depends": [
"stock_move_line_divide",
"stock_picking_automatic_lot",
],
"data": [],
"license": "AGPL-3",
"installable": True,
"auto_install": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move_line
20 changes: 20 additions & 0 deletions stock_move_line_divide_generate_lot_name/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


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

def action_divide(self):
result = super().action_divide()
if (
self.product_id
and self.product_id.tracking != "none"
and self.picking_id
and self.picking_id.picking_type_id
and self.picking_id.picking_type_id.use_create_lots
):
for line in self.move_id.move_line_ids:
line.lot_name = self.env["ir.sequence"].next_by_code("stock.lot.serial")
return result

0 comments on commit 3980ea1

Please sign in to comment.