Author: ananthukrishna

Run Odoo on port 80 instead of 8069

1.) Connect with ssh client to your Ubuntu server
2.) Use your favorite text editor (vim, nano…) to edit /etc/rc.local file

sudo nano /etc/rc.local

3.) Paste this into /etc/rc.local file

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069

4.) Reboot your Ubuntu server to see effect

sudo reboot

5.) Access Odoo on port 80


file permissions for WordPress

When you setup WP you (the webserver) may need write access to the files. So the access rights may need to be loose.

chown www-data:www-data -R /var/www/html/* # Let Apache be owner
find /var/www/html -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find /var/www/html -type f -exec chmod 644 {} \; # Change file permissions rw-r–r–

After the setup you should tighten the access rights, according to Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.

chown : -R * # Let your useraccount be owner
chown www-data:www-data wp-content # Let apache be owner of wp-content

Maybe you want to change the contents in wp-content later on. In this case you could

temporarily change to the user to www-data with su,
give wp-content group write access 775 and join the group www-data or
give your user the access rights to the folder using ACLs.
Whatever you do, make sure the files have rw permissions for www-data.

Redirect to tree view from button click odoo

.py file

from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from odoo import tools

class Project(models.Model):
    _inherit = "project.project"

    def action_view_project_cashflow_report(self):
        project_ids =
            'name'          :   ('Project Cashflow Report'),
            'type'          :   'ir.actions.act_window',
            'view_type'     :   'form',
            'view_mode'     :   'pivot',
            'target'        :   'new', 
            'res_model'     :   '',
            'view_id'       :   False,
            'domain'        :   [('project_id','in',[project_ids])]

.xml file

<xpath expr="//button[@name='attachment_tree_view']" position="after">
<button class="oe_stat_button" name="action_view_project_cashflow_report"
        string="Cash Flow" type="object"

get one2many parent id odoo

<notebook colspan="4">
<page string="Cash Inflow Planning">
<tree editable="bottom">
<field name="period_date"/>
<field name="deliverables_ids" widget="many2many_checkboxes" domain="[('project_id','=',context.get('project_id'))]">
<field name="name"/>

extend t-name in odoo templates

I created the new template file in static/src/xml directory and updated the code like:

<?xml version="1.0" encoding="UTF-8"?>
<t t-extend="FieldMany2ManyCheckBoxes">
<t t-jquery="div"t-operation="replace">
<divt-foreach="widget.get('records')"t-as="record"style="background-color: #efeff8 !important">
<inputt-if="widget.get('value').indexOf(record[0]) !== -1"type="checkbox"t-att-data-record-id="JSON.stringify(record[0])"checked="checked"/>
<inputt-if="widget.get('value').indexOf(record[0]) === -1"type="checkbox"t-att-data-record-id="JSON.stringify(record[0])"/>

and included the file in file

'qweb': [