Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to create a Do Not Call list. When a customer phone number from res.partner or crm.lead is entered, I want to trigger an onchage event that checks a third model (dnc.numbers) to see if that value exist in the field "numbers" and if it exists raise an alert.
I've created dnc.numbers with the field numbers:
_name = 'dnc.numbers'
numbers = fields.Char('Numbers')
And have the field 'phone' to compare against in res.partner and crm.lead, but don't know how to compare?
I've also created a DNC boolean in respartner that will hide the 'phone' field when checked and would like it to also add the phone number to the dnc.numbers number list on_change when changed to True or remove it on_change when changed to False.
I'm sure this is probably easy, but I'm lost.
I am not well versed with the new API. So, please take my answer with a grain of salt. What you can do is to basically perform a query in the on_change to search if the 'phone' of the res.partner is in the 'dnc.numbers' models. You can do a raw SQL query or, I believe, you can also invoke the name_search() method of the model if you set the attribute _name = 'numbers' for 'dnc.numbers', or the search() method of the model for a greater flexibility.
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/16/15, 5:26 AM|
|Seen: 1532 times|
|Last updated: 3/16/15, 8:10 AM|