This gist are moved to the repository here. I will leave this gist and will update new notes directly to the repository. You can easily contribute if you want!
Welcome to OCA (Odoo Cheatsheet Akhmad 😛). Here are my notes and some useful links that i usually face them on my day-to-day working with Odoo.
- Some useful links
- PDF Reporting thingies
- Backup and Restore DB
- Odoo unit test
- Many2many field, and how to use them
- Run odoo with vscode debugger with debugpy
UPDATE ir_config_parameter SET value = value::DATE + INTERVAL '1 month' WHERE key = 'database.expiration_date';
If you want to give access like edit a specific field for only specific group, and you can't use attribute groups
for that field since you want it shown to another group too. Then for this case, you need to make that field readonly first with readonly="1"
, then create a new inherited view from that view, and add attribute groups
to that inherited view so that this view can only be rendered if user have that group, and just change attribute readonly
on field before with False
. Now you get what you wanted. Source
- Qweb t-esc and t-field; t-esc will print the key of Selection, while t-field will print the label of the selection.
- Restrict kanban from moving records; while Odoo 13 and up have new attribute
records_draggable="1"
, odoo 12 and below don't have that attribute. So, you need this custom module or create your field widget by yourself. - It seems
widget="selection"
have some limitation on how many data can be shown. So if the data is too much, consider refactor that one with many2one field (and it's an improvement since you now have that search functionality). - When you use sql_constraints, keep in mind that you can't easily remove the constraints by removing the line of code, because it's already applied to db. If you don't have access to the database directly, this is the workaround to "remove" that SQL constraints.