Odoo Hilfe


1 Answer

Ray Carnes

--Ray Carnes--
| 5 2 8
Beaumont, USA - Vereinigte Staaten von Amerika
--Ray Carnes--

Business Analyst - Custom Projects


Ray Carnes
28.09.18, 20:41

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!") 
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:

Fragen Sie
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now