From 901a0e5816876572da3e68e33fe58ed2f42acb8e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 4 Apr 2024 16:50:52 +0200 Subject: [PATCH] mrp_usability: Allow to change the destination location until 'Mark as done' Native behavior: it is only possible to change the destination stock location of a production order in draft state. --- mrp_usability/models/mrp_production.py | 11 ++++++++++- mrp_usability/views/mrp_production.xml | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mrp_usability/models/mrp_production.py b/mrp_usability/models/mrp_production.py index a69799a..54194fb 100644 --- a/mrp_usability/models/mrp_production.py +++ b/mrp_usability/models/mrp_production.py @@ -3,12 +3,21 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, models +from odoo import api, fields, models class MrpProduction(models.Model): _inherit = 'mrp.production' + # Allow to change the destination location until 'Mark as done'. + # Native behavior: it is only possible to change it in draft state. + location_dest_id = fields.Many2one(states={ + 'draft': [('readonly', False)], # native + 'confirmed': [('readonly', False)], # added + 'progress': [('readonly', False)], # added + 'to_close': [('readonly', False)], # added + }, tracking=True) + # Method used by the report, inherited in this module @api.model def get_stock_move_sold_out_report(self, move): diff --git a/mrp_usability/views/mrp_production.xml b/mrp_usability/views/mrp_production.xml index 0eb9559..4a8d369 100644 --- a/mrp_usability/views/mrp_production.xml +++ b/mrp_usability/views/mrp_production.xml @@ -16,8 +16,9 @@ - - + + +