diff --git a/stock_usability/__manifest__.py b/stock_usability/__manifest__.py index b811465..5a59eeb 100644 --- a/stock_usability/__manifest__.py +++ b/stock_usability/__manifest__.py @@ -35,6 +35,7 @@ This module has been written by Alexis de Lattre from Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ +from odoo import fields, models, _ from odoo.tools import float_compare, float_is_zero diff --git a/stock_usability/models/stock_quant.py b/stock_usability/models/stock_quant.py index e2b7492..1d27ac9 100644 --- a/stock_usability/models/stock_quant.py +++ b/stock_usability/models/stock_quant.py @@ -8,10 +8,21 @@ from odoo import fields, models class StockQuant(models.Model): _inherit = 'stock.quant' - product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode") + product_barcode = fields.Char( + related='product_id.barcode', string="Product Barcode") def action_stock_move_lines_reserved(self): self.ensure_one() - action = self.action_view_stock_moves() - action['context'] = {'search_default_todo': True} + action = self.env["ir.actions.actions"]._for_xml_id( + "stock.stock_move_line_action") + action['domain'] = [ + ('state', 'not in', ('draft', 'done')), + ('product_id', '=', self.product_id.id), + ('location_id', '=', self.location_id.id), + ('lot_id', '=', self.lot_id.id or False), + '|', + ('package_id', '=', self.package_id.id or False), + ('result_package_id', '=', self.package_id.id or False), + ] + action['context'] = {'create': 0} return action diff --git a/stock_usability/views/stock_move.xml b/stock_usability/views/stock_move.xml index 5964e1c..e813976 100644 --- a/stock_usability/views/stock_move.xml +++ b/stock_usability/views/stock_move.xml @@ -64,6 +64,11 @@ + + + {'search_default_done': 1} + + stock_usability.stock.move.line.tree stock.move.line @@ -104,4 +109,19 @@ + + stock.move.line + + + + + + + + + + + {'search_default_done': 1, 'create': 0} + + diff --git a/stock_usability/views/stock_production_lot.xml b/stock_usability/views/stock_production_lot.xml new file mode 100644 index 0000000..d4fd99d --- /dev/null +++ b/stock_usability/views/stock_production_lot.xml @@ -0,0 +1,35 @@ + + + + + + + + + {'display_complete': True, 'default_company_id': allowed_company_ids[0]} + + + + Product Moves + stock.move.line + tree,kanban,pivot,form + [('lot_id', '=', active_id)] + {'search_default_done': 1, 'create': 0} + + + + stock.production.lot + + + + + + + + diff --git a/stock_usability/views/stock_quant.xml b/stock_usability/views/stock_quant.xml index 3a6e750..c5e895a 100644 --- a/stock_usability/views/stock_quant.xml +++ b/stock_usability/views/stock_quant.xml @@ -16,6 +16,29 @@ + + + + + + + 1 + + + 1 + show + + + + + + stock.quant + + + + +