تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
8214 أدوات العرض

We have Account Numbers assigned to every Customer and Vendor, and this happens during onboarding (outside Odoo).

We are finding users entering Customers and/or Vendors into Odoo when they are already there - they are not checking properly before adding the information.

How can we build a check into Odoo so that the same Customer and/or Vendor doesn't get created more than once.

Customer Account Numbers start with "C" and Vendor Account Numbers start with "S".

الصورة الرمزية
إهمال
أفضل إجابة

One way is to create an Automated Action that is triggered to run when you create and update Contacts:

You may need to install the Automated Action Rules module (if it isn't already installed).


Create a new Automated Action that works on the res.partner (Contact) model.

  • Action To Do is Execute Python Code

  • Trigger Condition is On Creation and Update

  • Code is:

if not record.ref:  
raise Warning("Account Number can't be blank!") 
else: 
existing_partner = env['res.partner'].search([('id','!=',record.id),('ref','=',record.ref)]) 
if existing_partner:   
raise Warning("You can't have the same Account Number in Odoo twice!\n\nAccount Number: " + \
record.ref + " is already in Odoo, assigned to:" + existing_partner.name+ ".")



Given these Contacts in the database:



This is the Warning you will get if you try to save a Contact with an already used Internal Reference:


الصورة الرمزية
إهمال

How can I avoid duplicating in contact?

This post is about Contacts, if you have a different question, please post a different question instead of a comment on a post that is already answered.

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
مايو 15
13707
2
سبتمبر 21
4378
2
مارس 15
7288
0
مارس 15
3147
1
مايو 23
5390