Review code fixes
This commit is contained in:
parent
7502a19562
commit
cb15cf4f47
|
@ -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."
|
||||
|
|
|
@ -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."
|
||||
|
|
|
@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_only_child">
|
||||
<field name="text">The location has the only child mark, cannot have more than one child.</field>
|
||||
<field name="text">The location "%(location)s" has the only child mark, cannot have more than one child.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
15
stock.py
15
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))
|
||||
|
|
|
@ -3,7 +3,6 @@ version=5.4.0
|
|||
depends:
|
||||
ir
|
||||
stock
|
||||
stock_location_move
|
||||
xml:
|
||||
message.xml
|
||||
stock.xml
|
||||
|
|
Loading…
Reference in New Issue