From 8a3a13d8216848bbe006c36583afe5bca67b19be Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Tue, 29 Aug 2023 12:46:42 +0200 Subject: [PATCH] [FIX] mrp,purchase,repair,stock: cleanup of modifier refactoring Minor cleanup after odoo/odoo#104741 thanks to edge-cases and the fun complexity of logistics code. Fixes include: - removing some readonly=False that were added on computed/stored fields that already have an inverse func or were already not readonly (i.e. redundant => cleanup) - fixed visibility of qty to prod in subcontractor portal view of a MO (i.e. yay they know how much they're supposed to make again) - remove unused imports - adding back in readonly functionality of default dest of repair operation type (and removing the now useless field override that used to add in the readonly functionality) - adding back in the `_set_product_qty` inverse function since it was probably removed by mistake (and is still important to have) unrelated to viewpocolypse change, also fixed: - mobile view of PO was for some reason allowing products to be changed in already confirmed/done POs, which could lead to some inconsistent data => made this consistent with existing desktop view behavior closes odoo/odoo#133502 Signed-off-by: Arnold Moyaux (arm) --- addons/mrp/models/mrp_workorder.py | 2 -- addons/mrp_subcontracting/views/mrp_production_views.xml | 1 + addons/purchase/views/purchase_views.xml | 1 + addons/purchase_stock/models/purchase.py | 3 --- addons/repair/models/stock_picking.py | 1 - addons/repair/views/stock_picking_views.xml | 3 +++ addons/stock/models/stock_move.py | 2 +- addons/stock/models/stock_picking.py | 1 - addons/stock_picking_batch/models/stock_picking_batch.py | 7 +++---- 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 05cc4dcecd5..7bf52f06b62 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -71,13 +71,11 @@ class MrpWorkorder(models.Model): 'Start', compute='_compute_dates', inverse='_set_dates', - readonly=False, store=True, copy=False) date_finished = fields.Datetime( 'End', compute='_compute_dates', inverse='_set_dates', - readonly=False, store=True, copy=False) duration_expected = fields.Float( 'Expected Duration', digits=(16, 2), compute='_compute_duration_expected', diff --git a/addons/mrp_subcontracting/views/mrp_production_views.xml b/addons/mrp_subcontracting/views/mrp_production_views.xml index 91e69cd3d4c..274cd6efdec 100644 --- a/addons/mrp_subcontracting/views/mrp_production_views.xml +++ b/addons/mrp_subcontracting/views/mrp_production_views.xml @@ -69,6 +69,7 @@ True + False [('id', '=', False)] diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml index 02b5d0d5a09..001c03eee1d 100644 --- a/addons/purchase/views/purchase_views.xml +++ b/addons/purchase/views/purchase_views.xml @@ -275,6 +275,7 @@ context="{'partner_id': parent.partner_id}" widget="many2one_barcode" domain="[('purchase_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" + readonly="state in ('purchase', 'to approve', 'done', 'cancel')" />