From 4cc7fddc5b8a94801ce049e3145887c31da9c3ae Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 24 Apr 2024 15:01:23 +0200 Subject: [PATCH] [FIX] mrp_subcontracting: relax constraint on subcontracting location Some people want to manage the subcontractor stock the same way than a classic stock. It will then impact the on hand value but it's the behavior they want. I keep the constraint on internal location since it will impact valuation. closes odoo/odoo#163262 X-original-commit: be8e1da9d9dc3b82479b1560c9d5e780c8ecb36b Signed-off-by: Quentin Wolfs (quwo) --- addons/mrp_subcontracting/i18n/mrp_subcontracting.pot | 2 +- addons/mrp_subcontracting/models/stock_location.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mrp_subcontracting/i18n/mrp_subcontracting.pot b/addons/mrp_subcontracting/i18n/mrp_subcontracting.pot index e285eadda38..b9a7d853a2c 100644 --- a/addons/mrp_subcontracting/i18n/mrp_subcontracting.pot +++ b/addons/mrp_subcontracting/i18n/mrp_subcontracting.pot @@ -166,7 +166,7 @@ msgstr "" #, python-format msgid "" "In order to manage stock accurately, subcontracting locations must be type " -"Internal, linked to the appropriate company and not specific to a warehouse." +"Internal, linked to the appropriate company." msgstr "" #. module: mrp_subcontracting diff --git a/addons/mrp_subcontracting/models/stock_location.py b/addons/mrp_subcontracting/models/stock_location.py index 9130cf0e026..27a45356067 100644 --- a/addons/mrp_subcontracting/models/stock_location.py +++ b/addons/mrp_subcontracting/models/stock_location.py @@ -20,8 +20,8 @@ class StockLocation(models.Model): for location in self: if location == location.company_id.subcontracting_location_id: raise ValidationError(_("You cannot alter the company's subcontracting location")) - 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.")) + if location.is_subcontracting_location and location.usage != 'internal': + raise ValidationError(_("In order to manage stock accurately, subcontracting locations must be type Internal, linked to the appropriate company.")) @api.model_create_multi def create(self, vals_list):