diff --git a/locale/ca.po b/locale/ca.po index 599a132..1b905a2 100644 --- a/locale/ca.po +++ b/locale/ca.po @@ -7,5 +7,9 @@ msgid "Unique children" msgstr "Fill únic" msgctxt "model:ir.message,text:msg_only_child" -msgid "The location has the only child mark, cannot have more than one child." -msgstr " La ubicació té la marca de fill únic, no pot tenir més d'un fill." +msgid "" +"The location \"%(location)s\" has the only child mark, cannot have more than" +" one child." +msgstr "" +"La ubicació \"%(location)s\" té la marca de fill únic, no pot tenir més " +"d'un fill." diff --git a/locale/es.po b/locale/es.po index 2edf0f1..91c322a 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,6 +7,9 @@ msgid "Unique children" msgstr "Hijo único" msgctxt "model:ir.message,text:msg_only_child" -msgid "The location has the only child mark, cannot have more than one child." +msgid "" +"The location \"%(location)s\" has the only child mark, cannot have more than" +" one child." msgstr "" -" La ubicación tiene la marca de hijo único, no puede tener más de un hijo." +"La ubicación \"%(location)s\" tiene la marca de hijo único, no puede tener " +"más de un hijo." diff --git a/message.xml b/message.xml index e7e08fb..5ac1bb9 100644 --- a/message.xml +++ b/message.xml @@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. --> - The location has the only child mark, cannot have more than one child. + The location "%(location)s" has the only child mark, cannot have more than one child. diff --git a/stock.py b/stock.py index f326809..d520a39 100644 --- a/stock.py +++ b/stock.py @@ -1,7 +1,5 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import functools - from trytond.i18n import gettext from trytond.model import fields from trytond.pool import PoolMeta @@ -21,12 +19,13 @@ class Location(metaclass=PoolMeta): def validate(cls, locations): super(Location, cls).validate(locations) for location in locations: - if location.parent: - if (location.parent.unique_children and - len(location.parent.childs) > 1): - raise UserError( - gettext('stock_location_only_child.msg_only_child')) + if (location.parent and location.parent.unique_children and + len(location.parent.childs) > 1): + raise UserError( + gettext('stock_location_only_child.msg_only_child', + location=location.rec_name)) if location.unique_children and len(location.childs) > 1: raise UserError( - gettext('stock_location_only_child.msg_only_child')) + gettext('stock_location_only_child.msg_only_child', + location=location.rec_name)) diff --git a/tryton.cfg b/tryton.cfg index a057532..03b8b61 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -3,7 +3,6 @@ version=5.4.0 depends: ir stock - stock_location_move xml: message.xml stock.xml