-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][ADD] stock_move_line_generate_lot_name: It generates the move …
…lines lot name by sequence when dividing the line.
- Loading branch information
Berezi
committed
Dec 18, 2024
1 parent
9105e41
commit 3980ea1
Showing
7 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...k_move_line_divide_generate_lot_name/odoo/addons/stock_move_line_divide_generate_lot_name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_move_line_divide_generate_lot_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_move_line |
20 changes: 20 additions & 0 deletions
20
stock_move_line_divide_generate_lot_name/models/stock_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |