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 have what I think should be an easy question for someone to help me with. When deleting products, the system checks to make sure there are no other objects that reference the product. This is great functionality!
I've made a custom object, and the problem is even if that object is referenced in other places, my system lets me delete it with no warning. How can I have the same functionality like there is in the system for products, sales orders, and purchase orders? I've looked everywhere, including pouring through the source of the product.py file. But I find no code that tells the system to do this integrity check.
Could someone point me in the right direction?
You can either use
You can find many
_constraints usage examples in the OpenERP source base, just search for it.
Here are two:
_constraints = [ (_check_percent, 'Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2%.', ['value_amount']), ]
_sql_constraints = [ ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'), ]
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: 10/4/13, 10:10 PM|
|Seen: 1437 times|
|Last updated: 3/16/15, 8:10 AM|