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.
bit of a newbie here so sorry if this question isn't good.
There are many fields in odoo that I would like to enforce unique data - eg Product Name, Category, Internal Ref etc...may other fields and modules.
Do I have to modify all the python object modules throughout odoo with SQL Contraints???? I was expecting just to check a box against a field to make it unique!
If I do have to add a python SQL constraints in python modules am I best to modify the odoo modules, or should I inherit the standard odoo object into a new object with my added constraints thereby keeping the odoo module un-modified? eg if a standard odoo module is updated then my added constraints will still apply?
Hope this is a sensible question!
Yes, you must unfortunately bring in custom code and (SQL) constraints for this. That is nearly always a given.
Due to the modular setup of Odoo the best way to modify code is as you suggested in your second statement, by using the way of inheriting models and adding/removing code in your own custom module. It is really simple to do, so you should have no trouble doing so.
Example for "old" (read: current) ORM is like so:
_name = "res.partner"
_inherit = "res.partner"
<<SQL constraint here>>
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: 7/31/14, 10:28 PM|
|Seen: 1042 times|
|Last updated: 4/21/17, 8:41 AM|