<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ubay Abdelgadir on Medium]]></title>
        <description><![CDATA[Stories by Ubay Abdelgadir on Medium]]></description>
        <link>https://medium.com/@obayit?source=rss-2a8840983b5c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5ezwEYYk8bL7taJJ</url>
            <title>Stories by Ubay Abdelgadir on Medium</title>
            <link>https://medium.com/@obayit?source=rss-2a8840983b5c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:23:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@obayit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to display a form inside a form in Odoo (Workaround)]]></title>
            <link>https://obayit.medium.com/how-to-display-a-form-inside-a-form-in-odoo-workaround-42aa83e74a6a?source=rss-2a8840983b5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/42aa83e74a6a</guid>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[odoo-customization]]></category>
            <category><![CDATA[odoo-technical]]></category>
            <dc:creator><![CDATA[Ubay Abdelgadir]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 18:52:20 GMT</pubDate>
            <atom:updated>2025-03-24T18:52:20.705Z</atom:updated>
            <content:encoded><![CDATA[<p>I have this requirement: Display the partner form inside the sales form. In default Odoo this is not possible, and I really don’t want to mess with the Javascript code. Is this even possible?</p><p>The short answer is <strong>no. </strong>Not without customizing with javascript.</p><p>But if you only want to display the partner info here is a workaround.</p><p>Create a computed many2many field for the partner record:</p><pre>    display_form_partner_ids = fields.Many2many(&#39;res.partner&#39;, compute=&#39;_compute_display_form_partner_ids&#39;)<br>    def _compute_display_form_partner_ids(self):<br>        # this will only be used in form view, and self will always be one record only.<br>        # and the many2many field will always be one record too<br>        self.display_form_partner_ids = self.partner_id</pre><p>Then display this many2many field in the form as a kanban view. The kanban view gives us the freedom to customize the appearance as we like, and you can be creative in making it look like a form or anything else.</p><pre>&lt;notebook&gt;<br>    &lt;page string=&quot;Partner Data&quot;&gt;<br>        &lt;field name=&quot;display_form_partner_ids&quot;&gt;<br>            &lt;kanban class=&quot;o_kanban_mobile&quot;&gt;<br>                &lt;templates&gt;<br>                    &lt;t t-name=&quot;kanban-box&quot;&gt;<br>                        &lt;!-- since we only have one card, we will give it 100% width--&gt;<br>                        &lt;div t-attf-class=&quot;oe_kanban_content oe_kanban_global_click o_kanban_get_form&quot; style=&quot;width: 100%;&quot;&gt;<br>                            &lt;div class=&quot;row&quot;&gt;<br>                                &lt;div class=&quot;col-xs-12&quot;&gt;<br>                                    &lt;strong&gt;&lt;field name=&quot;name&quot; string=&quot;Name&quot;/&gt;&lt;/strong&gt;<br>                                &lt;/div&gt;<br>                            &lt;/div&gt;<br>                            &lt;div class=&quot;row&quot;&gt;<br>                                &lt;div class=&quot;col-xs-12&quot;&gt;<br>                                    &lt;field name=&quot;age&quot;/&gt;<br>                                &lt;/div&gt;<br>                            &lt;/div&gt;<br>                        &lt;/div&gt;<br>                    &lt;/t&gt;<br>                &lt;/templates&gt;<br>            &lt;/kanban&gt;<br>        &lt;/field&gt;<br>    &lt;/page&gt;<br>&lt;/notebook&gt;</pre><p>You will have to be creative in CSSclasses and styles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42aa83e74a6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Odoo DevOps: Continuous Delivery (Part 1)]]></title>
            <link>https://obayit.medium.com/odoo-devops-continuous-delivery-part-2-f0f4567c7ee4?source=rss-2a8840983b5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0f4567c7ee4</guid>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ubay Abdelgadir]]></dc:creator>
            <pubDate>Sun, 24 Oct 2021 12:25:33 GMT</pubDate>
            <atom:updated>2021-10-24T12:25:52.403Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuous delivery might mean different things for different projects/teams. In this article it is testing your new code changes in a real database (recent copy from production). These are the steps:</p><ol><li>Create a backup from production database</li><li>Create a staging Odoo server</li><li>Restore production database in that server</li></ol><p>The tools that will be used are:</p><ol><li>Github (source control)</li><li>Jenkins (automation)</li><li>Doodba or <strong>Od</strong>oo <strong>Do</strong>cker <strong>Ba</strong>se (Odoo Docker Solution)</li><li>Docker Swarm (orchestration)</li><li>Ansible (Deployment)</li><li>Github Action (trigger cleanup job)</li></ol><p><strong>When to create a staging environment?</strong></p><p>It depends on how much resources are available, and how often the project needs a staging environment. If there is a lot of computing power (CPU, RAM, and storage), a staging environment should be created whenever a pull request (PR) has been created from any branch to the main/production branch, for example lets consider the branch 12.0 to be the production one.</p><p><strong>Note:</strong> Jenkins has a problem with triggering actions based on pull request, whenever a PR is created the env.CHANGE_ID will be true, but every time a commit is pushed to the target/main branch, it will also be true. This way the staging environment will be created for all open PRs, whenever a commit is pushed to the target/main branch. Of course this is not good, and will consume too much resource. <strong>That is why I recommend making the creation of a staging environment a manual process.</strong></p><p>(recommended) But if computing resources are limited, or the project doesn’t need a staging environment for every pull request. The staging environment should be triggered manually for a specific pull request.</p><p><strong>Jenkins Pipeline</strong></p><p>The following pipeline will do the staging process</p><pre>pipeline {<br>    environment {<br>        GIT_HASH_7 = &quot;${env.GIT_COMMIT.take(7)}&quot;<br>        STAGING_DOMAIN = &quot;stg-${env.GIT_HASH_7}&quot;<br>        STAGING_URL = &quot;<a href="https://${staging_domain}.stage.gsk-erp.com/web/login">https://${STAGING_DOMAIN}.mydomain.com/web/login</a>&quot;<br>        STAGING_BRANCH = &#39;12.0&#39;<br>        IMAGE_NAME = &quot;odoo-proj&quot;<br>        PR_NUMBER = &quot;${env.CHANGE_ID}&quot;<br>        IMAGE_TAG = &quot;${env.GIT_HASH_7}&quot;<br>        PATH = &quot;${env.PATH}:/var/lib/jenkins/.local/bin&quot;<br>    }<br>    agent any<br>    stages {<br>stage(&#39;Staging Environment: Build Image&#39;) {<br>            steps {<br>                checkout([$class: &#39;GitSCM&#39;, branches: [[name: &#39;*/main&#39;]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: &#39;RelativeTargetDirectory&#39;, relativeTargetDir: &#39;doodba-copier-template&#39;]], submoduleCfg: [],<br>                userRemoteConfigs: [[url: &#39;<a href="/service/mailto:git@github.com">git@github.com</a>:your-account/doodba-template.git&#39;]]])<br>                dir(&#39;doodba-copier-template&#39;){<br>                    sh &quot;mkdir -p .docker&quot;<br>                    sh &quot;rsync -av ~/.ssh/ odoo/custom/ssh/&quot;<br>                    sh &quot;echo &#39;PASSPHRASE=example-backup-passphrase&#39; &gt; .docker/backup.env&quot;<br>                    sh &quot;echo &#39;PGPASSWORD=example-db-password&#39; &gt; .docker/db-access.env&quot;<br>                    sh &quot;echo &#39;POSTGRES_PASSWORD=example-db-password&#39; &gt; .docker/db-creation.env&quot;<br>                    sh &quot;echo &#39;ADMIN_PASSWORD=example-admin-password&#39; &gt; .docker/odoo.env&quot;</pre><pre>sh &quot;sed -i &#39;s/TEST_PR/${PR_NUMBER}/g&#39; odoo/custom/src/repos.yaml&quot;<br>                    sh &quot;docker-compose -f swarm-test.yaml build --no-cache&quot;<br>                }<br>            }<br>            when {<br>                expression { env.CHANGE_TARGET == env.STAGING_BRANCH &amp;&amp; env.CHANGE_ID }<br>            }<br>        }</pre><pre>stage(&#39;Staging Environment: Push Image&#39;) {<br>            steps {<br>                dir(&#39;doodba-copier-template&#39;){<br>                    sh &quot;docker-compose -f swarm-test.yaml push&quot;<br>                }<br>            }<br>            when {<br>                expression { env.CHANGE_TARGET == env.STAGING_BRANCH &amp;&amp; env.CHANGE_ID }<br>            }<br>        }<br>        stage(&#39;Staging Environment: Deploy&#39;) {<br>            steps {<br>                dir(&#39;doodba-copier-template&#39;){<br>                    sh &#39;sudo ansible-playbook /&lt;path-to-script&gt;/doodba-staging-playbook.yaml --extra-vars &quot;db_user=postgres db_name=&lt;db_name&gt; db_filename_path=/tmp/${STAGING_DOMAIN}.stg.dump.sql target_host=&lt;swarm-manager-hostname&gt; copier_path=${WORKSPACE}/doodba-copier-template/ image_name=${IMAGE_NAME} image_tag=${IMAGE_TAG} staging_domain=${STAGING_DOMAIN}&quot;&#39;<br>                }<br>            }<br>            when {<br>                expression { env.CHANGE_TARGET == env.STAGING_BRANCH &amp;&amp; env.CHANGE_ID }<br>            }<br>        }<br>    }<br>    post {<br>        success {<br>            script {<br>                if (env.CHANGE_TARGET == env.STAGING_BRANCH &amp;&amp; env.CHANGE_ID) {<br>                    pullRequest.comment(&#39;🌞 Staging database here &#39; + env.STAGING_URL)<br>                }<br>            }<br>        }<br>        failure {<br>            script {<br>                if (env.CHANGE_TARGET == env.STAGING_BRANCH &amp;&amp; env.CHANGE_ID) {<br>                    pullRequest.comment(&#39;Staging job completed with errors 🤔&#39;)<br>                }<br>            }<br>        }</pre><pre>}<br>}</pre><p>Now lets see what every part in the Jenkinsfile does.</p><p>First we have the environment part which defines environment variables that can be used later, generally make a variable for every thing used more than once, and for every project-specific value, so that it will be easier to copy/paste the same pipeline in new projects (ideally you will only need to change the environment section).</p><p>OK the environment section is as follows:</p><pre>environment {<br>        GIT_HASH_7 = &quot;${env.GIT_COMMIT.take(7)}&quot;<br>        STAGING_DOMAIN = &quot;stg-${env.GIT_HASH_7}&quot;<br>        STAGING_URL = &quot;<a href="https://${staging_domain}.stage.gsk-erp.com/web/login">https://${STAGING_DOMAIN}.mydomain.com/web/login</a>&quot;<br>        STAGING_BRANCH = &#39;12.0&#39;<br>        IMAGE_NAME = &quot;odoo-proj&quot;<br>        PR_NUMBER = &quot;${env.CHANGE_ID}&quot;<br>        IMAGE_TAG = &quot;${env.GIT_HASH_7}&quot;<br>        PATH = &quot;${env.PATH}:/var/lib/jenkins/.local/bin&quot;<br>    }</pre><p><strong>GIT_HASH_7</strong> is the first 7 characters of the current commit, we will use this as the docker image tag later, and it is a good ID to identify this environment.</p><p><strong>STAGING_DOMAIN</strong> is the subdomain for accessing the Odoo server, it will be something like stg-a90522a , so the url for the server will be <a href="https://stg-a90522a.mydomain.com/web/login">https://stg-a90522a.mydomain.com/web/login</a></p><p>I will stop here, and continue in the next part, which will include the ansbile playbook.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0f4567c7ee4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I setup my Linux for Odoo development]]></title>
            <link>https://obayit.medium.com/how-i-setup-my-linux-for-odoo-development-6a751bcd695a?source=rss-2a8840983b5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a751bcd695a</guid>
            <category><![CDATA[odoo]]></category>
            <dc:creator><![CDATA[Ubay Abdelgadir]]></dc:creator>
            <pubDate>Fri, 01 Oct 2021 07:17:37 GMT</pubDate>
            <atom:updated>2021-10-01T07:17:37.942Z</atom:updated>
            <content:encoded><![CDATA[<p>I worked with Odoo since version 9, and now version 15 is almost out. And most of the time I have to work on multiple projects with different versions of Odoo.</p><p>Usingvirtualenv and pip the correct way can make things easier.</p><p>1. You need to pick a python version for every Odoo version. I prefer python 3.7 since it is compatible with most of Odoo recent versions. But this might change if you want to match the version of python that is running in production server.</p><p>2. Clone the Odoo versions you need with shallow clone. I put all Odoo source in the directory ~/src/vs/ , for example to clone version 14.0, run:</p><pre>cd ~/src/vs  # make the directories if necessary with $ mkdir -p ~/src/vs<br>git clone --depth 1 <a href="/service/mailto:git@github.com">https://github.com</a>/odoo/odoo -b 14.0 odoo14</pre><p>The directory structure will be like:</p><pre>src<br>└── vs<br>    ├── odoo11<br>    ├── odoo12<br>    ├── odoo13<br>    └── odoo14<br>        ├── requirements.txt<br>        ├── odoo-bin<br>        └── ...</pre><p>3. Create a directory for virtual environments, and create an environment for every Odoo version you need.</p><p>For example run the following commands to create a virtual environment for version 14.0</p><pre>mkdir ~/.virtualenvs  # I prefer to put the envs here, but it can be anywhere<br>cd ~/.virtualenvs<br>python3.7 -m pip install virtualenv  # you can change the python versions to what you need<br>python3.7 -m virtualenv odoo14-37  # notice that the name of the virtual environment &quot;odoo14-37&quot; reflects the version of Odoo and the version of python, this information will come in handy in certain situations.</pre><pre>source ~/.virtualenvs/odoo14-37/bin/activate  # this will activate the environment for the current terminal, (more info about this <a href="https://realpython.com/python-virtual-environments-a-primer/">here</a>)<br>python3 -m pip install -r ~/src/vs/odoo14/requirements.txt  # this command may fail in new machines, make sure you run this successfully, by install all the dependencies of odoo first. e.g: libxml2-dev and python3.7-dev<br>python3 -m pip install -e ~/src/vs/odoo14/  # this will install odoo itself in the virtual environment, it will allow you to run odoo as a command, and can be used in vscode to recognize odoo imports :)</pre><p>Finally you should be able to run Odoo from the terminal simply with odoo , you don’t need to change directory into where odoo source exists and run odoo-bin from there, just run odoo</p><p>You will have to repeat step 3 for every Odoo version you are working with. Make sure to open a new terminal, also you don’t have to run python3.7 -m pip install virtualenv since it is already installed.</p><h3>Databases</h3><p>Another problem we have to deal with, is using different databases for different version of Odoo.</p><p>Create a directory to put all Odoo config files in it, I prefer ~/.config/odoo/ since it adheres to the existing approach used by many programs, and sudo is not needed.</p><p>In the directory ~/.config/odoo/ create a config file for every project, the name of the file should start with the version of Odoo used, for example v14project_x will be used for a project x that is using version 14.0 .</p><p>In the config file, you need to set 3 parameters: addons_path , dbfilter , and http_port . For example, a config file for version 14.0 should look like</p><pre>[options]<br>addons_path = /home/obay/src/vs/odoo14/addons,/home/obay/src/custom-addons14<br>dbfilter = ^v14.*$ <br>http_port = 8014</pre><p>The http_pord should be different for each version, and maybe for each project.</p><p>The addons_path should at least include the path of Odoo addons for the specific version, ~/src/vs/odoo14/addons (btw, the ~ will not work in the config file)</p><p>The dbfilter: database names should be prefixed with the version of Odoo used, for example: instead of naming the database project1, use v14project1, this way it can be filtered in the config file. Also a project prefix can be used if you are working on multiple projects on the same Odoo version.</p><p>5. You can add an alias to the source command in your ~/.bashrc like this:</p><pre>alias source14=&#39;source ~/.virtualenvs/odoo14–37/bin/activate&#39;</pre><p>This way you can switch the environment more easily, buy just running source14</p><p>Finally run Odoo like:</p><pre>source ~/.virtualenvs/odoo14–37/bin/activate # make sure you activated the environment (or just run source14 you created the alias)<br>odoo -c ~/.config/odoo/v14project_x</pre><h3>Logging with different users in the same browser</h3><p>Adding multiple hostnames to point to 127.0.0.1 so that we can one for each user. In /etc/hosts add the following</p><pre>127.0.0.1   usr1<br>127.0.0.1   usr2<br>127.0.0.1   usr3</pre><p>Add as many as you like, I have till 10 :O</p><p>The in the browser you can use a different url for every user, e.g: http://usr1:8014/</p><h3>Conclusion</h3><p>Multiple Odoo versions can be run at the same time, and each one targeting different databases that are compatible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a751bcd695a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Postman Odoo Authentication]]></title>
            <link>https://obayit.medium.com/postman-odoo-authentication-ca9f5a476cd?source=rss-2a8840983b5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca9f5a476cd</guid>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Ubay Abdelgadir]]></dc:creator>
            <pubDate>Sat, 13 Feb 2021 15:46:34 GMT</pubDate>
            <atom:updated>2021-02-13T15:46:34.085Z</atom:updated>
            <content:encoded><![CDATA[<p>Authentication in Odoo is achieved with a simple http header or a cookie.</p><p>To authenticate you need set the cookie session_id, postman is smart enough to do that for you just like a normal browser.</p><p>First create a new request with the following:</p><p>method: GET</p><p>url: <a href="http://localhost:8069/web/session/authenticate">http://localhost:8069/web/session/authenticate</a><br>headers: Content-Type: application/json<br>body:</p><pre>{<br>    &quot;jsonrpc&quot;: &quot;2.0&quot;, <br>    &quot;params&quot;: {<br>        &quot;db&quot;: &quot;db_name&quot;, <br>        &quot;login&quot;: &quot;username&quot;, <br>        &quot;password&quot;: &quot;password&quot;<br>    }<br>}</pre><p>The body type should be raw in postman.</p><p>Of courser change the db, login, and password to your values.</p><p>Send the request, and if successful Odoo will response with information about the user, and the response header will include “Set-Cookie” which tells postman to set the session_id cookie.</p><p>Finally you can call any other url that requires authentication. Just make sure the base url is the same as the authentication request, so that postman will send the session_id cookie in the request.</p><p>Here is a screenshot of the request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5AzyUwQRxJLKS6G-Jdlsw.png" /><figcaption>Authentication Request</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca9f5a476cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>