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.
PLease, how to make a one2many field required at least one element in openerp.
'coefficient_ids' : fields.one2many('schoolem.coefficient','cours_id','Coefficients',required=True),
You can add method similar like this (example in idea module):
def _check_name(self,cr,uid,ids): for idea in self.browse(cr, uid, ids): if 'spam' in idea.name: return False # Can't create ideas with spam! return True
...but instead would check the coefficient_ids field that something was passed.
Then add to constraints (for validation):
_constraints = [(_check_name, 'Please avoid spam in ideas !', ['name'])]
This would be validation for other field types, I'm not exactly sure for one2many or many2one validation. I believe this maybe possible only for many2one.
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 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/24/13, 5:45 PM|
|Seen: 2868 times|
|Last updated: 1/18/16, 6:49 PM|