Add user error when create an location from the animals without a warehose.
Task #048049
This commit is contained in:
parent
fdbff2e601
commit
1fc5a8eae0
|
@ -871,6 +871,9 @@ class Female(metaclass=PoolMeta):
|
|||
number = vals.get('number')
|
||||
initial_location = vals.get('initial_location')
|
||||
location = Location(initial_location)
|
||||
if not location.warehouse:
|
||||
raise UserError(gettext('farm.location_without_warehouse',
|
||||
location=location))
|
||||
duplicate = Animal.search([
|
||||
('number', '=', number),
|
||||
('farm', '=', location.warehouse.id),
|
||||
|
|
|
@ -3467,6 +3467,10 @@ msgstr ""
|
|||
"El inventario \"%(inventory)s\" no puede eliminarse porque no está en estado"
|
||||
" \"Borrador\" o \"Cancelado\"."
|
||||
|
||||
msgctxt "model:ir.message,text:location_without_warehouse"
|
||||
msgid "The location \"%(location)s\" don't have a warehouse."
|
||||
msgstr "La ubicación \"%(location)s\" no tiene un almacén."
|
||||
|
||||
msgctxt "model:ir.message,text:missing_previous_inventory"
|
||||
msgid ""
|
||||
"There isn't any Feed Inventory before the feed provisional inventory "
|
||||
|
|
|
@ -68,6 +68,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="tag_must_be_unique">
|
||||
<field name="text">The Name of the Tag must be unique.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="location_without_warehouse">
|
||||
<field name="text">The location "%(location)s" don't have a warehouse.</field>
|
||||
</record>
|
||||
|
||||
<!-- production.py -->
|
||||
<record model="ir.message" id="missing_semen_input">
|
||||
|
|
Loading…
Reference in New Issue