Thursday, July 20, 2023

Error Odoo 14 Often Crash (virtual real time limit (151/120s) reached)

Our Odoo14 server often crash, suddenly the web page cannot be opened.

Checking to the log I get  erro : virtual real time limit (151/120s) reached.

 After browsing I get the solution is to add --limit-time-real parameter :

ExecStart=/usr/bin/scl enable rh-python36 -- /opt/odoo/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo.conf --limit-time-real=100000

Thursday, June 9, 2022

Network not connected in Ubuntu 18.04 (network interface not detected)

 - Check network interface availability (logical name) :

sudo lshw -C network

- Set / change interface name in /etc/network/interface

Saturday, March 19, 2022

Odoo 14 sequence not working when create model (TypeError: not enough arguments for format string)

I have tried to follow tutorial odoo14, and it explain about sequence, I have followed the tutorial but sequence not working with error : TypeError: not enough arguments for format string.

After checking i realize that the mistake was in the prefix format in xml file.
it should be something like this : TC/%(year)s/%(month)s/ but i made it like this : TC/%(year)s/%(month)s%/

So i fix the xml file and restart the odoo server, but it still got the same problem, even i tried to search it from google, i still cannot find the error :(, until i check into the databases it self through setting-technical-sequence I can see that there were two same sequence but the first was the error one, so after i deleted it, everything run smoothly :).

Tuesday, March 8, 2022

Cannot change built in display resolution (Ubuntu 16.04)

 I have been frustated since I was not able to setup built in resolution in my Ubuntu 16.04,

it was stuck to 800x600 pixel.


I have tried to change the resolution by following this tutorial, but it did not work.

https://askubuntu.com/questions/1075157/unable-to-set-my-screen-resolution-higher


and finally  I found the solution by following below tutorial :

https://askubuntu.com/questions/441040/failed-to-get-size-of-gamma-for-output-default-when-trying-to-add-new-screen-res

 in short the solution is to change the following line in the grub file :

#GRUB_GFXMODE=640x480

I change it to 1920 x 1080 for the resolution and remove the # :

GRUB_GFXMODE=1920x1080

And after that update the grub and reboot the server.

sudo update-grub
sudo reboot





Locale issue (ValueError: unknown locale: UTF-8) with odoo 9

When running odoo using service command in Ubuntu 16.04 it run smoothly, but when run it using odoo.py i have error Locale issue (ValueError: unknown locale: UTF-8). 

It solved by adding below script to etc/default/locale :

export LC_ALL=en_US.UTF-8

export LANG="en_US.UTF-8"

Friday, February 25, 2022

Macbook bootloop "Unrecoverable error. Security agent was unable to create requested mechanism TeamViewerAuthPlugin:start"

I suddenly can't login to my Macbook Air due to it keeps bootloop with the message "Unrecoverable error. Security agent was unable to create requested mechanism TeamViewerAuthPlugin:start".
This is most likely caused by my Macbook died suddenly because lack of the battery.






Several times I searched on google and always suggested to reinstall the mackbook via recovery mode, until finally I found the following method that didn't require reinstallation:

1. Start macbook recovery mode by pressing the command + R keys on the keyboard when turning on the macbook
2. Enter Disk Utility to mount HDD / Macbook HD
3. Exit Disk Utility then enter terminal
4. Remove the autuh.db-* file in /Volume/<disk name>/var/db/
5. Restart again

And yeaay..my macbook turn back to normal.

Friday, October 22, 2021

Adding LogEntry to Django Admin

from django.contrib.admin.models import LogEntry, DELETION

from django.utils.html import escape

from django.urls import reverse

from django.utils.safestring import mark_safe



@admin.register(LogEntry)

class LogEntryAdmin(admin.ModelAdmin):

    date_hierarchy = 'action_time'


    list_filter = [

        'user',

        'content_type',

        'action_flag'

    ]


    search_fields = [

        'object_repr',

        'change_message'

    ]


    list_display = [

        'action_time',

        'user',

        'content_type',

        'object_link',

        'action_flag',

    ]


    def has_add_permission(self, request):

        return False


    def has_change_permission(self, request, obj=None):

        return False


    def has_delete_permission(self, request, obj=None):

        return False


    def has_view_permission(self, request, obj=None):

        return request.user.is_superuser


    def object_link(self, obj):

        if obj.action_flag == DELETION:

            link = escape(obj.object_repr)

        else:

            ct = obj.content_type

            link = '<a href="%s">%s</a>' % (

                reverse('admin:%s_%s_change' % (ct.app_label, ct.model), args=[obj.object_id]),

                escape(obj.object_repr),

            )

        return mark_safe(link)


    object_link.admin_order_field = "object_repr"

    object_link.short_description = "object"