-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4337][FIX] stock_picking_auto_create_lot: fix creating lot for 0 qty move lines for serial product #109
Merged
Merged
[4337][FIX] stock_picking_auto_create_lot: fix creating lot for 0 qty move lines for serial product #109
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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,49 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_auto_create_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-11-17 11:36+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_product_product__auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_product_template__auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_stock_picking_type__auto_create_lot | ||
msgid "Auto Create Lot" | ||
msgstr "Creazione automatica lotto" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_picking_type | ||
msgid "Picking Type" | ||
msgstr "Tipologia prelievo" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_product_template | ||
msgid "Product" | ||
msgstr "Prodotto" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_move_line | ||
msgid "Product Moves (Stock Move Line)" | ||
msgstr "Movimenti prodotto (riga movimento di magazzino)" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento di magazzino" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "Trasferimento" |
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,49 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_auto_create_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-10-14 00:45+0000\n" | ||
"Last-Translator: Bosd <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: nl\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_product_product__auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_product_template__auto_create_lot | ||
#: model:ir.model.fields,field_description:stock_picking_auto_create_lot.field_stock_picking_type__auto_create_lot | ||
msgid "Auto Create Lot" | ||
msgstr "Automatisch een partij aanmaken" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_picking_type | ||
msgid "Picking Type" | ||
msgstr "" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_product_template | ||
msgid "Product" | ||
msgstr "Product" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_move_line | ||
msgid "Product Moves (Stock Move Line)" | ||
msgstr "Voorraadverplaatsingen (Voorraadverplaatsingsregels)" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Voorraadverplaatsing" | ||
|
||
#. module: stock_picking_auto_create_lot | ||
#: model:ir.model,name:stock_picking_auto_create_lot.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "transfer" |
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
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 |
---|---|---|
@@ -1,39 +1,12 @@ | ||
# Copyright 2020 ACSONE SA/NV | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
from odoo.fields import first | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
|
||
_inherit = "stock.move.line" | ||
|
||
def _get_value_production_lot(self): | ||
res = super()._get_value_production_lot() | ||
if "name" in res and not res["name"]: | ||
del res["name"] | ||
return res | ||
|
||
def set_lot_auto(self): | ||
""" | ||
Create lots using create_multi to avoid too much queries | ||
As move lines were created by product or by tracked 'serial' | ||
products, we apply the lot with both different approaches. | ||
""" | ||
values = [] | ||
stock_lot_obj = self.env["stock.lot"] | ||
lots_by_product = dict() | ||
for line in self: | ||
# Prepare multi valued lots per line to use multi creation. | ||
values.append(line._get_value_production_lot()) | ||
lots = stock_lot_obj.create(values) | ||
for lot in lots: | ||
if lot.product_id.id not in lots_by_product: | ||
lots_by_product[lot.product_id.id] = lot | ||
else: | ||
lots_by_product[lot.product_id.id] += lot | ||
for line in self: | ||
lot = first(lots_by_product[line.product_id.id]) | ||
line.lot_id = lot | ||
if lot.product_id.tracking == "serial": | ||
lots_by_product[line.product_id.id] -= lot | ||
def _get_lot_sequence(self): | ||
self.ensure_one() | ||
return self.env["ir.sequence"].next_by_code("stock.lot.serial") |
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
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 |
---|---|---|
@@ -1,20 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" /> | ||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" /> | ||
<title>Stock Picking Auto Create Lot</title> | ||
<style type="text/css"> | ||
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Copyright: This stylesheet has been placed in the public domain. | ||
|
||
Default cascading style sheet for the HTML output of Docutils. | ||
|
||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to | ||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
customize this style sheet. | ||
*/ | ||
|
||
|
@@ -366,26 +365,28 @@ <h1 class="title">Stock Picking Auto Create Lot</h1> | |
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:7bd67aa1ef1a59ba07d7a22f56d8d7d066206b34bbcf6d93bf9dc8b6966d2c9c | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | ||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_auto_create_lot"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_auto_create_lot"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/154/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> | ||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_auto_create_lot"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_auto_create_lot"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> | ||
<p>This module extends the functionality of stock module to allow auto create | ||
lots for incoming pickings.</p> | ||
<p><strong>Table of contents</strong></p> | ||
<div class="contents local topic" id="contents"> | ||
<ul class="simple"> | ||
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li> | ||
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li> | ||
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> | ||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> | ||
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li> | ||
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> | ||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> | ||
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li> | ||
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li> | ||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li> | ||
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul> | ||
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li> | ||
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li> | ||
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="section" id="configuration"> | ||
<h1><a class="toc-backref" href="#id1">Configuration</a></h1> | ||
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1> | ||
<p>To configure this module, you need to:</p> | ||
<ol class="arabic simple"> | ||
<li>Go to a <em>Inventory > Configuration > Operation Types</em>.</li> | ||
|
@@ -395,7 +396,7 @@ <h1><a class="toc-backref" href="#id1">Configuration</a></h1> | |
</ol> | ||
</div> | ||
<div class="section" id="usage"> | ||
<h1><a class="toc-backref" href="#id2">Usage</a></h1> | ||
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> | ||
<p>To use this module you need to:</p> | ||
<ol class="arabic simple"> | ||
<li>Go to a <em>Product > Inventory tab</em>.</li> | ||
|
@@ -406,24 +407,24 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1> | |
</ol> | ||
</div> | ||
<div class="section" id="bug-tracker"> | ||
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1> | ||
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1> | ||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_auto_create_lot%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> | ||
<p>Do not contact contributors directly about support or help with technical issues.</p> | ||
</div> | ||
<div class="section" id="credits"> | ||
<h1><a class="toc-backref" href="#id4">Credits</a></h1> | ||
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1> | ||
<div class="section" id="authors"> | ||
<h2><a class="toc-backref" href="#id5">Authors</a></h2> | ||
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2> | ||
<ul class="simple"> | ||
<li>ACSONE SA/NV</li> | ||
<li>Tecnativa</li> | ||
</ul> | ||
</div> | ||
<div class="section" id="contributors"> | ||
<h2><a class="toc-backref" href="#id6">Contributors</a></h2> | ||
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2> | ||
<ul class="simple"> | ||
<li>Carlos Dauden <<a class="reference external" href="mailto:carlos.dauden@tecnativa.com">carlos.dauden@tecnativa.com</a>></li> | ||
<li>Sergio Teruel <<a class="reference external" href="mailto:sergio.teruel@tecnativa.com">sergio.teruel@tecnativa.com</a>></li> | ||
|
@@ -437,14 +438,14 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2> | |
</ul> | ||
</div> | ||
<div class="section" id="maintainers"> | ||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2> | ||
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2> | ||
<p>This module is maintained by the OCA.</p> | ||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> | ||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use.</p> | ||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> | ||
<p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a></p> | ||
<p><a class="reference external image-reference" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a></p> | ||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_auto_create_lot">OCA/stock-logistics-workflow</a> project on GitHub.</p> | ||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> | ||
</div> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already removed in OCA because it is removed this file first in OCA repo by another PR that is proposed by other community member. Then, we added this file again because it is needed for some use case. So, I guess we don't need add in our repo as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AungKoKoLin1997
I understood.