mirror of
https://github.com/NaN-tic/trytond-stock_location_only_child.git
synced 2023-12-14 05:52:54 +01:00
Review code fixes
This commit is contained in:
parent
7502a19562
commit
cb15cf4f47
|
@ -7,5 +7,9 @@ msgid "Unique children"
|
||||||
msgstr "Fill únic"
|
msgstr "Fill únic"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_only_child"
|
msgctxt "model:ir.message,text:msg_only_child"
|
||||||
msgid "The location has the only child mark, cannot have more than one child."
|
msgid ""
|
||||||
msgstr " La ubicació té la marca de fill únic, no pot tenir més d'un fill."
|
"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"
|
msgstr "Hijo único"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_only_child"
|
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 ""
|
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>
|
<tryton>
|
||||||
<data grouped="1">
|
<data grouped="1">
|
||||||
<record model="ir.message" id="msg_only_child">
|
<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>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</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 file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
import functools
|
|
||||||
|
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.model import fields
|
from trytond.model import fields
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
|
@ -21,12 +19,13 @@ class Location(metaclass=PoolMeta):
|
||||||
def validate(cls, locations):
|
def validate(cls, locations):
|
||||||
super(Location, cls).validate(locations)
|
super(Location, cls).validate(locations)
|
||||||
for location in locations:
|
for location in locations:
|
||||||
if location.parent:
|
if (location.parent and location.parent.unique_children and
|
||||||
if (location.parent.unique_children and
|
len(location.parent.childs) > 1):
|
||||||
len(location.parent.childs) > 1):
|
raise UserError(
|
||||||
raise UserError(
|
gettext('stock_location_only_child.msg_only_child',
|
||||||
gettext('stock_location_only_child.msg_only_child'))
|
location=location.rec_name))
|
||||||
|
|
||||||
if location.unique_children and len(location.childs) > 1:
|
if location.unique_children and len(location.childs) > 1:
|
||||||
raise UserError(
|
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:
|
depends:
|
||||||
ir
|
ir
|
||||||
stock
|
stock
|
||||||
stock_location_move
|
|
||||||
xml:
|
xml:
|
||||||
message.xml
|
message.xml
|
||||||
stock.xml
|
stock.xml
|
||||||
|
|
Loading…
Reference in a new issue