Skip to content
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

[15.0][FW][FIX] stock_picking_filter_lot made configurable PR #894 #1821

Open
wants to merge 3 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stock_picking_filter_lot/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Credits
Authors
~~~~~~~

* Le Filament
* Agile Business Group

Contributors
Expand All @@ -71,6 +72,7 @@ Contributors
* Alan Ramos <[email protected]> (www.jarsa.com.mx)
* Tharathip Chaweewongphan <[email protected]> (www.ecosoft.co.th)
* Jesus Alcala <[email protected]> (www.jarsa.com.mx)
* Le Filament (le-filament.com)

Maintainers
~~~~~~~~~~~
Expand Down
8 changes: 6 additions & 2 deletions stock_picking_filter_lot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
"version": "15.0.1.0.1",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"author": "Le Filament, Agile Business Group, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["stock"],
"data": ["views/stock_move_line_view.xml", "views/stock_scrap_view.xml"],
"data": [
"views/stock_move_line_view.xml",
"views/stock_picking_type_view.xml",
"views/stock_scrap_view.xml",
],
}
2 changes: 2 additions & 0 deletions stock_picking_filter_lot/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from . import stock_move_line
from . import stock_picking_type
from . import stock_production_lot
13 changes: 13 additions & 0 deletions stock_picking_filter_lot/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2021 Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import fields, models


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

picking_type_use_filter_lots = fields.Boolean(
related="picking_id.picking_type_id.use_filter_lots"
)
15 changes: 15 additions & 0 deletions stock_picking_filter_lot/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class StockPickingType(models.Model):
_inherit = "stock.picking.type"

use_filter_lots = fields.Boolean(
"Use only available lots",
default=True,
help="If this is checked, only lots available in source location \
would be displayed in drop down list for selecting lot.",
)
5 changes: 5 additions & 0 deletions stock_picking_filter_lot/readme/CONFIGURATION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
By default, all operation types use filter on lots, should you want to disable this for a particular operation type, follow the next steps :
- Go to Inventory > Configuration > Operation Types.
- Unselect "Use only available lots" for all the operation types on which you want to disable filtering.

In case you can receive a second time the same lot number (from supplier for instance), this filter should not be applied on Reception.
1 change: 1 addition & 0 deletions stock_picking_filter_lot/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
* Alan Ramos <[email protected]> (www.jarsa.com.mx)
* Tharathip Chaweewongphan <[email protected]> (www.ecosoft.co.th)
* Jesus Alcala <[email protected]> (www.jarsa.com.mx)
* Le Filament (le-filament.com)
Copy link
Contributor

@rousseldenis rousseldenis Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the place for individuals

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @remi-filament Do you want to provide your informations or shall I remove it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @leemannd, it comes from my mistake on v14 PR. If you do not mind, you can set :
Remi Cazenave <remi-filament> (https://le-filament.com)

Thanks !

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated. @remi-filament your review is welcome

3 changes: 2 additions & 1 deletion stock_picking_filter_lot/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?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>
Expand Down Expand Up @@ -407,6 +406,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Le Filament</li>
<li>Agile Business Group</li>
</ul>
</div>
Expand All @@ -418,6 +418,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Alan Ramos &lt;<a class="reference external" href="mailto:alan.ramos&#64;jarsa.com.mx">alan.ramos&#64;jarsa.com.mx</a>&gt; (www.jarsa.com.mx)</li>
<li>Tharathip Chaweewongphan &lt;<a class="reference external" href="mailto:tharathipc&#64;ecosoft.co.th">tharathipc&#64;ecosoft.co.th</a>&gt; (www.ecosoft.co.th)</li>
<li>Jesus Alcala &lt;<a class="reference external" href="mailto:jesus.alcala&#64;jarsa.com.mx">jesus.alcala&#64;jarsa.com.mx</a>&gt; (www.jarsa.com.mx)</li>
<li>Le Filament (le-filament.com)</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
21 changes: 14 additions & 7 deletions stock_picking_filter_lot/views/stock_move_line_view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Simone Rubino - Agile Business Group
<!-- Copyright 2021 Le Filament
Copyright 2018 Simone Rubino - Agile Business Group
Copyright 2018 ForgeFlow S.L.
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
Expand All @@ -10,10 +11,13 @@
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
<field name="arch" type="xml">
<field name="picking_id" position="after">
<field name="picking_type_use_filter_lots" invisible="1" />
</field>
<field name="lot_id" position="attributes">
<attribute
name="domain"
>[('product_id','=', parent.product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)]</attribute>
<attribute name="domain">
picking_type_use_filter_lots and [('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] or [('product_id','=', product_id), ('company_id', '=', company_id)]
</attribute>
</field>
</field>
</record>
Expand All @@ -27,10 +31,13 @@
ref="stock.view_stock_move_line_detailed_operation_tree"
/>
<field name="arch" type="xml">
<field name="picking_id" position="after">
<field name="picking_type_use_filter_lots" invisible="1" />
</field>
<field name="lot_id" position="attributes">
<attribute
name="domain"
>[('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)]</attribute>
<attribute name="domain">
picking_type_use_filter_lots and [('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] or [('product_id','=', product_id), ('company_id', '=', company_id)]
</attribute>
</field>
</field>
</record>
Expand Down
15 changes: 15 additions & 0 deletions stock_picking_filter_lot/views/stock_picking_type_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="stock_picking_type_add_filter_form" model="ir.ui.view">
<field name="name">stock_picking_type_add_filter_form</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form" />
<field name="arch" type="xml">
<field name="use_existing_lots" position="after">
<field name="use_filter_lots" />
</field>
</field>
</record>
</odoo>
Loading