Help

0

Duplicate Rule on Customer

Avatar
Hung Pham

Hi,

We need to set up a duplicate rule on the Customer, base on the mobile field. Could we configure it on Odoo, or we need to customize it?  

4 التعليقات
الصورة الرمزية
تجاهل
Avatar
Chris TRINGHAM
-

If you want to prevent duplicate mobile numbers, this answer should help you to find the solution:

https://www.odoo.com/forum/help-1/question/how-can-i-prevent-users-from-entering-duplicate-vendors-based-on-name-only-134963#answer-134964

Avatar
Hung Pham
-

Thanks Chris. Instead we embedded python code, do we have other ways that end-user could define them?

Avatar
Odoo Tools
-
Avatar
Chris TRINGHAM
-

End users cannot define it, but Automated Actions (as per Ray's solution) allow you to add this checking on an Odoo online database (no customization, no third-party apps).

1 إجابة
2
Avatar
Tugay HATIL
Best Answer

Hi Hung Pham,

I have done a similar study before. I hope this works.

Settings -> Technical -> Automatic Actions


Python Code


if record.mobile != False:

  partner = env['res.partner'].search([('mobile', '=', record.mobile)])

  mobile = record.mobile

  if partner:

    record.update({'mobile': ''})

    raise Warning("Change, please"% mobile)


Thank you, best regards.

الصورة الرمزية
تجاهل