Odoo Help


This community 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.


How can I make it so an order can't add order lines if the partner doesn't have an email?

Kit Sunde
on 10/31/14, 9:35 AM 454 views

Because saving an order where an order_line has an email campaign set shouldn't be possible if the partner doesn't have an email address set. How can I validate that?


Ludo - Neobis

--Ludo - Neobis--
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--


Ludo - Neobis
On 10/31/14, 9:58 AM

You should be able to relate back fron an order line to any of the following 3:

  • The partner in question
  • The pricelist
  • The sale order on which this line is created

If you have any of the three, write a method on the partner object to check for an email. Then, in your order line, overwrite the on_change method for product_id on you sale order line, where you could check for a certain product for the email campaign. Then validate against the information about the partner (has email yes/no?) and provide the user with a usefull error (You selected a campaign but partner %s has no email set) and leave the product_id blanc.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 10/31/14, 9:35 AM
Seen: 454 times
Last updated: 3/16/15, 8:10 AM