Skip to content

Commit

Permalink
Merge PR #501 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Apr 4, 2023
2 parents dc05282 + 2bb3e4e commit a7cdb68
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions product_multi_barcode/models/product_barcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ def _check_duplicates(self):
[("id", "!=", record.id), ("name", "=", record.name)]
)
if barcodes:
# by default barcode 'shared' between all company (no ir.rule)
# so we may not have the access right on the product
# note: if you do not want to share the barcode between company
# you just need to add a custom ir.rule
product = barcodes[0].sudo().product_id
raise UserError(
_('The Barcode "%s" already exists for product ' '"%s"')
% (record.name, barcodes[0].product_id.name)
_(
'The Barcode "%(barcode_name)s" already exists for '
'product "%(product_name)s" in the company %(company_name)s'
)
% dict(
barcode_name=record.name,
product_name=product.name,
company_name=product.company_id.name,
)
)

0 comments on commit a7cdb68

Please sign in to comment.