mirror of https://github.com/OCA/web.git
[IMP] web_widget_one2many_product_picker: more detailed message error
parent
aca8ae4217
commit
51b3ee10f5
|
@ -31,21 +31,14 @@ class BaseModel(models.BaseModel):
|
||||||
field_obj = self[relation_field]
|
field_obj = self[relation_field]
|
||||||
if field_obj:
|
if field_obj:
|
||||||
relation_id = relation_id.id
|
relation_id = relation_id.id
|
||||||
has_product = (
|
db_sol = self.search(
|
||||||
self.search(
|
[(relation_field, "=", relation_id), (product_field, "in", product_ids)],
|
||||||
[
|
|
||||||
(relation_field, "=", relation_id),
|
|
||||||
(product_field, "in", product_ids),
|
|
||||||
],
|
|
||||||
count=True,
|
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
!= 0
|
if db_sol:
|
||||||
)
|
|
||||||
if has_product:
|
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("Can't create the %s: Duplicated product! (Already in database)")
|
_("Can't create the %s: Duplicated product (%s)! (Already in database)")
|
||||||
% relation
|
% (relation, db_sol[product_field].display_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
|
|
Loading…
Reference in New Issue