Odoo Help


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 719 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.

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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