-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][ADD] stock_picking_lot_send_components:
- Loading branch information
Tu Nombre
committed
Sep 13, 2024
1 parent
50bfce2
commit 182f794
Showing
12 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_picking_lot_send_components/odoo/addons/stock_picking_lot_send_components
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_picking_lot_send_components |
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,31 @@ | ||
.. 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 Picking Lot Send Components | ||
================================= | ||
|
||
When validating a picking, if the serial product to be sent to the customer | ||
has been manufactured by other serial products, the location of those | ||
components will changed, instead of production virtual location, is going | ||
to be customer location, creating a move line to change the location. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/mrp-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 <[email protected]> | ||
* Ana Juaristi <[email protected]> |
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,2 @@ | ||
from . import models | ||
from . import wizard |
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,16 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Stock Picking Lot Send Components", | ||
"version": "14.0.1.0.0", | ||
"author": "Avanzosc", | ||
"category": "Inventory", | ||
"website": "https://github.com/avanzosc/mrp-addons", | ||
"depends": [ | ||
"stock", | ||
"mrp", | ||
], | ||
"data": [], | ||
"license": "AGPL-3", | ||
"installable": 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,75 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_lot_send_components | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-07-06 12:27+0000\n" | ||
"PO-Revision-Date: 2023-07-06 12:27+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,help:stock_picking_lot_send_components.field_stock_quant__location_usage | ||
msgid "" | ||
"* Vendor Location: Virtual location representing the source location for products coming from your vendors\n" | ||
"* View: Virtual location used to create a hierarchical structures for your warehouse, aggregating its child locations ; can't directly contain products\n" | ||
"* Internal Location: Physical locations inside your own warehouses,\n" | ||
"* Customer Location: Virtual location representing the destination location for products sent to your customers\n" | ||
"* Inventory Loss: Virtual location serving as counterpart for inventory operations used to correct stock levels (Physical inventories)\n" | ||
"* Production: Virtual counterpart location for production operations: this location consumes the components and produces finished products\n" | ||
"* Transit Location: Counterpart location that should be used in inter-company or inter-warehouses operations" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer__display_name | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking__display_name | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__display_name | ||
msgid "Display Name" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer__id | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking__id | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_immediate_transfer | ||
msgid "Immediate Transfer" | ||
msgstr "Transferencia inmediata" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer____last_update | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking____last_update | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación en" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__location_usage | ||
msgid "Location Usage" | ||
msgstr "Tipo de ubicación" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_quant | ||
msgid "Quants" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: code:addons/stock_picking_lot_send_components/models/stock_picking.py:0 | ||
#, python-format | ||
msgid "This lot {} has been produced in more than one production order." | ||
msgstr "Este lote {} ha sido producido en más de una órden de producción." | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "Albarán" |
75 changes: 75 additions & 0 deletions
75
stock_picking_lot_send_components/i18n/stock_picking_lot_send_components.pot
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,75 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_lot_send_components | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-07-06 12:26+0000\n" | ||
"PO-Revision-Date: 2023-07-06 12:26+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,help:stock_picking_lot_send_components.field_stock_quant__location_usage | ||
msgid "" | ||
"* Vendor Location: Virtual location representing the source location for products coming from your vendors\n" | ||
"* View: Virtual location used to create a hierarchical structures for your warehouse, aggregating its child locations ; can't directly contain products\n" | ||
"* Internal Location: Physical locations inside your own warehouses,\n" | ||
"* Customer Location: Virtual location representing the destination location for products sent to your customers\n" | ||
"* Inventory Loss: Virtual location serving as counterpart for inventory operations used to correct stock levels (Physical inventories)\n" | ||
"* Production: Virtual counterpart location for production operations: this location consumes the components and produces finished products\n" | ||
"* Transit Location: Counterpart location that should be used in inter-company or inter-warehouses operations" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer__display_name | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking__display_name | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer__id | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking__id | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_immediate_transfer | ||
msgid "Immediate Transfer" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_immediate_transfer____last_update | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_picking____last_update | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model.fields,field_description:stock_picking_lot_send_components.field_stock_quant__location_usage | ||
msgid "Location Usage" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_quant | ||
msgid "Quants" | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: code:addons/stock_picking_lot_send_components/models/stock_picking.py:0 | ||
#, python-format | ||
msgid "This lot {} has been produced in more than one production order." | ||
msgstr "" | ||
|
||
#. module: stock_picking_lot_send_components | ||
#: model:ir.model,name:stock_picking_lot_send_components.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "" |
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,2 @@ | ||
from . import stock_quant | ||
from . import stock_picking |
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,60 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import _, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
def _action_change_location_production_serial(self): | ||
for picking in self: | ||
for line in picking.move_line_ids_without_package: | ||
if ( | ||
line.product_id | ||
and (line.product_id.tracking) == "serial" | ||
and (line.lot_id) | ||
): | ||
production = self.env["mrp.production"].search( | ||
[ | ||
("lot_producing_id", "=", line.lot_id.id), | ||
("product_id", "=", line.product_id.id), | ||
("company_id", "=", line.company_id.id), | ||
] | ||
) | ||
if len(production) > 1: | ||
raise ValidationError( | ||
_( | ||
"This lot {} has been produced in more " | ||
+ "than one production order." | ||
).format(line.product_id.name) | ||
) | ||
if len(production) == 1: | ||
for component in production.move_line_raw_ids: | ||
if component.product_id.tracking == "serial": | ||
quant = self.env["stock.quant"].search( | ||
[ | ||
("lot_id", "=", component.lot_id.id), | ||
("location_usage", "=", "production"), | ||
] | ||
) | ||
if quant and len(quant) == 1: | ||
move = self.env["stock.move"].create( | ||
{ | ||
"product_id": quant.product_id.id, | ||
"product_uom": (quant.product_id.uom_id.id), | ||
"quantity_done": quant.quantity, | ||
"name": quant.product_id.name, | ||
"location_id": quant.location_id.id, | ||
"location_dest_id": ( | ||
line.location_dest_id.id | ||
), | ||
"company_id": line.company_id.id, | ||
} | ||
) | ||
moveline = move._get_move_lines() | ||
moveline.lot_id = quant.lot_id.id | ||
move._quantity_done_set() | ||
move._action_confirm() | ||
move._action_assign() | ||
move._action_done() |
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,11 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class StockQuant(models.Model): | ||
_inherit = "stock.quant" | ||
|
||
location_usage = fields.Selection( | ||
string="Location Usage", related="location_id.usage", store=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_immediate_transfer |
13 changes: 13 additions & 0 deletions
13
stock_picking_lot_send_components/wizard/stock_immediate_transfer.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,13 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import models | ||
|
||
|
||
class StockImmediateTransfer(models.TransientModel): | ||
_inherit = "stock.immediate.transfer" | ||
|
||
def process(self): | ||
result = super(StockImmediateTransfer, self).process() | ||
for picking in self.pick_ids: | ||
picking._action_change_location_production_serial() | ||
return result |