Oct 1, 2019

RDS backup database with template

problems :

ERROR:  source database "targetDB" is being accessed by other users
DETAIL:  There are 6 other sessions using the database.


postgres=> REVOKE CONNECT ON DATABASE targetDB FROM public;
postgres=> SELECT pg_terminate_backend(pg_stat_activity.pid)
postgres-> FROM pg_stat_activity
postgres-> WHERE pg_stat_activity.datname = 'targetDB';
(6 rows)

postgres=> create database backutargetDB_oct template targetDB owner odoo;
postgres=> create database eisr template targetDB owner odoo;
postgres=> GRANT CONNECT ON DATABASE solusi TO public;


Read more ...

Sep 9, 2019

SOLVED auth_session_timeout redirection looping issue

Related : https://github.com/OCA/server-tools/issues/1482

    def _auth_timeout_check(self):
        """Perform session timeout validation and expire if needed."""

        if not http.request:

        session = http.request.session

        # Calculate deadline
        deadline = self._auth_timeout_deadline_calculate()

        # Check if past deadline
        expired = False
        if deadline is not False:
            path = http.root.session_store.get_session_filename(session.sid)

                expired = getmtime(path) < deadline
            except FileNotFoundError
                        'File nya tidak ada %s, Path : %s',(path, http.request.httprequest.path)
            except OSError:
                    'Exception reading session file modified time.',
                # Force expire the session. Will be resolved with new session.

                expired = True

Read more ...

Aug 14, 2019

odoo add followers when task change followers

just a simple automation

partners_who_are_users = []
users = env['res.users'].search([])
for user in users:

followers = []
for partner in record.project_id.message_follower_ids.ids:
  if partner in partners_who_are_users:


Read more ...

SOLVED odoo 11 Domains no longer working with dynamic dates

regarding to :

on V10, we can use :


this is a simple solution,

update base_automation set filter_pre_domain='[["write_date","<=", datetime.datetime.now().replace(microsecond=0).replace(hour=0).replace(minute=0).replace(second=0).isoformat(" ").partition("+")[0]  ]]', filter_domain='[["write_date","<=", datetime.datetime.now().replace(microsecond=0).replace(hour=0).replace(minute=0).replace(second=0).isoformat(" ").partition("+")[0]  ]]' where id=5;

main idea is change "%" notation from strftime to native, make it pass the "eval" to be compiled.

Read more ...

Aug 9, 2019

all about followers odoo

just as your inspiration only.

Automatically add follower to Sales Order if user(s) is a follower of the Contact - Odoo 10

10/18/18, 3:53 AM 1,075 views
How do I automatically add all followers from the partner to any new Sales Order with the same Partner?

So when a sales order is placed it will add all users following the Partner of the Sales Order to the Sales Order.

Ray Carnes United States
 10/18/18, 9:56 AM
An Automated Action (this example should work with v11 and v12) can combine the followers (this example adds ONLY followers who are Users) on the Sale Order and followers from the Customer:

Code to copy/paste:

partners_who_are_users = []
users = env['res.users'].search([])
for user in users:

followers = []
for partner in record.partner_id.message_partner_ids.ids:
  if partner in partners_who_are_users:


add followers automatically

12/18/13, 5:27 AM 10,045 views
Hello in crm.lead the responsible user (user_id) is automatically added as follower to the new task. How can I add this functionality to add some users to my custom object?

Ray Carnes United States
 2/9/18, 3:16 AM
To expand on David's answer, I needed to add the Customer as a follower on a LEAD in v10.
I created an Automated Action that looked for crm.lead records created or updated that also had either a Customer or Email populated.
If the record had a Customer, I needed to just add that Customer as a follower (as long as it wasn't already).
If the record had an Email, I needed to check if a Customer already existed, and if not - create them.
This is the code I used for the Server Action:
if record.partner_id: 
    partner = record.partner_id  
    partner = env['res.partner'].search([('email','=',record.email_from)]) 
if not partner: 
    reg = { 
           'name': record.contact_name or record.email_from, 
           'email': record.email_from, 
           'type': 'contact', 
    partner = env['res.partner'].create(reg) 
partner_id = partner.id 
reg = { 
       'res_id': record.id, 
       'res_model': 'crm.lead', 
       'partner_id': partner_id, 
if not env['mail.followers'].search([('res_id','=',record.id),('res_model','=','crm.lead'),('partner_id','=',partner_id)]): 
    follower_id = env['mail.followers'].create(reg)
Read more ...