Whenever I want to filter the list in many2many field, I just need to add a domain into that field in Python file or in XML side. For example, I want to show only locations used for internal purposes. So I add domain=[(’usage’, ‘=’, 'internal’)] into Python field or domain=”[(’usage’, ‘=’, ‘internal’)]” into XML field. But that is just one simple/plain filtering. What if I want to filter more than one condition AND based on value of another field, can Odoo handle it easily too?
Unfortunately, it can’t. Odoo can’t handle dynamic filtering based on another field. At least not in provided syntax template. But, it turns out there is a way to get the job done. …
The more complex the system I created, the more complex the way I need to get my data. This also happens when I need to create/write data because its field relation has too complicated. This sort of problem often just appears in the middle of development. Many frameworks have poor handling template syntaxes. So what I need to do?! Thank god, Odoo syntax is completely readable. I just need to type one-or-two word to do it. Let me show you the ease.
Basic operation starts with Create as it is the first letter in CRUD (Create Read Update Delete). When I want to call create method of a model from its own model, I just have to type self.create(vals_list) …
For you that have been work in a computer-related field, certainly feel familiar with debugging term. It is the process of finding where and how bugs ‘accidentally’ created in the system so then we can resolve it. We can use the manual way or the automatic way. For the latter, there are so many tools to do it, usually be distinguished by its programming language base.
In Odoo (that uses Python as its base), there are few tricks we can use.
Odoo has provided us a series of tools like: check metadata of a record, view UI (form, list) id, showing field name while hovering until it can show some part of the XML code that responsible for viewing. All of that can be accessed by activating debugging mode. …
Odoo has provided us an easy way to import data from excel or CSV file. It can be accessed from all of existing tree’s menu. I just need to click import button, select a file, and then import. Just like that.
There are two easy ways to create Smart Button in Odoo. Object type and Action type. The difference is just the place of the logic code will be written. This button is created to call records of selected database table from the current place. Also when I call it, I can filter the records so the shown list will be just the one that accept a few condition.
Smart button is located in the top-right form Odoo.
In a rapid development, I often use the existing template/framework and then modify/create new only if the existing feature doesn’t meet the requirement. This way can be applied to Odoo too. But how? Let’s take an example to modify a form and a report.
I want to add new field in existing form of Transfer. First, I write this code in existing model (or can be in new model).
_inherit = 'stock.picking'
send_by = fields.Char(
Create new object that inherit stock.picking then define new field (i.e. send_by) .
For XML view, same with model, I write in existing view (or can be in new view). …
Burning Jono (Jono Terbakar) is a band/soloist from Yogyakarta, Indonesia that initiated on 2013 by Nihan Lanisy. So far, he has released 22 albums. So it’s not too exaggerated if I call him as the most productive musician, whether is good or not. But hey, the music is limitless. If you can’t see the unique side or the catchy/funny song of him, maybe you are not the targetted market.
He dedicated himself as the rich unemployment (translate: pengangguran berpenghasilan tinggi), not the freelancer musician. …
In the beginning, I’m developing Odoo modul with my basic IDE VS Code. But when I know that there is a better way to do with PyCharm Python IDE, I try it immediately. This is how I done.
If you need to know how I install odoo 12 in ubuntu 18.04, you can check my previous story.
In daily basis, I often to run stop re-run my Odoo to see the change that i made. If I did it with manual way in terminal, it will be too much time consuming. Luckily there is easy way to do.