From 9d7236334a01d15596dce4ffd8607e70037113c6 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Fri, 18 Nov 2022 15:51:23 +0000 Subject: [PATCH] [FIX] mrp_subcontracting: relax subcontractor location requirement Previously in https://github.com/odoo/odoo/pull/88644/commits/a57be884ee625ab2d67b65f0ece0b8e9b1620369 we restricted the subcontractor locations (property_stock_subcontractor) to locations with the new setting `is_subcontracting_location=True`. The purpose of this new setting is primilarily to support the mrp_subcontracting dropshipping use case though, therefore we want to keep the previous freedom of allowing users to choose any location as a subcontracting_location. There are some routing and filtering errors/confusion that can occur if a user selects a location that isn't marked as `is_subcontracting_location` (or sets this value to false after already assigning it to a subcontractor), but since this has not been reported as an issue in the past, we expect users to properly configure these fields accordingly. Part of general bugfix task: 2985735 closes odoo/odoo#110200 X-original-commit: d86df2b9cef742b6cadd294f57a855634768d039 Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Tiffany Chang --- addons/mrp_subcontracting/models/res_partner.py | 1 - addons/mrp_subcontracting/models/stock_location.py | 6 ------ addons/mrp_subcontracting/views/res_partner_views.xml | 2 +- addons/mrp_subcontracting/views/stock_location_views.xml | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/mrp_subcontracting/models/res_partner.py b/addons/mrp_subcontracting/models/res_partner.py index 7c46acb5072..e2aa3f1278f 100644 --- a/addons/mrp_subcontracting/models/res_partner.py +++ b/addons/mrp_subcontracting/models/res_partner.py @@ -9,7 +9,6 @@ class ResPartner(models.Model): property_stock_subcontractor = fields.Many2one( 'stock.location', string="Subcontractor Location", company_dependent=True, - domain="[('is_subcontracting_location', '=', True)]", help="The stock location used as source and destination when sending\ goods to this contact during a subcontracting process.") is_subcontractor = fields.Boolean( diff --git a/addons/mrp_subcontracting/models/stock_location.py b/addons/mrp_subcontracting/models/stock_location.py index 9f75af10f3b..9130cf0e026 100644 --- a/addons/mrp_subcontracting/models/stock_location.py +++ b/addons/mrp_subcontracting/models/stock_location.py @@ -23,12 +23,6 @@ class StockLocation(models.Model): if location.is_subcontracting_location and (location.usage != 'internal' or location.warehouse_id): raise ValidationError(_("In order to manage stock accurately, subcontracting locations must be type Internal, linked to the appropriate company and not specific to a warehouse.")) - @api.constrains('is_subcontracting_location') - def _check_is_subcontracting_location(self): - for location in self: - if not location.is_subcontracting_location and location.subcontractor_ids: - raise ValidationError(_("You cannot change the subcontracting location as it is still linked to a subcontractor partner")) - @api.model_create_multi def create(self, vals_list): res = super().create(vals_list) diff --git a/addons/mrp_subcontracting/views/res_partner_views.xml b/addons/mrp_subcontracting/views/res_partner_views.xml index d947a95a9dc..4576141003b 100644 --- a/addons/mrp_subcontracting/views/res_partner_views.xml +++ b/addons/mrp_subcontracting/views/res_partner_views.xml @@ -6,7 +6,7 @@ - + diff --git a/addons/mrp_subcontracting/views/stock_location_views.xml b/addons/mrp_subcontracting/views/stock_location_views.xml index aa3d9a9100c..c0cc743d437 100644 --- a/addons/mrp_subcontracting/views/stock_location_views.xml +++ b/addons/mrp_subcontracting/views/stock_location_views.xml @@ -6,7 +6,7 @@ - +