[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) <quwo@odoo.com>
This commit is contained in:
Arnold Moyaux
2024-04-25 11:21:56 +00:00
parent ce345b5947
commit 4cc7fddc5b
2 changed files with 3 additions and 3 deletions
@@ -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
@@ -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):