Skip to content

Instantly share code, notes, and snippets.

@tejastank
Last active December 18, 2025 10:01
Show Gist options
  • Select an option

  • Save tejastank/3eecb59c8ff04b85829bd8d4b14b5b26 to your computer and use it in GitHub Desktop.

Select an option

Save tejastank/3eecb59c8ff04b85829bd8d4b14b5b26 to your computer and use it in GitHub Desktop.
tejaskumartank@proton.me , Fix ODOO License 15,16,17,18,19, due to ODOO support failed temporary quick fix ,
# -*- coding: utf-8 -*-
# tejaskumartank@proton.me
# ODOO Enterprise Edition
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import logging
import requests
import werkzeug.urls
from ast import literal_eval
from odoo import api, release, SUPERUSER_ID
from odoo.exceptions import UserError
from odoo.models import AbstractModel
from odoo.tools.translate import _
from odoo.tools import config, misc, ustr
_logger = logging.getLogger(__name__)
class PublisherWarrantyContract(AbstractModel):
_name = "publisher_warranty.contract"
_description = 'Publisher Warranty Contract'
@api.model
def _get_message(self):
Users = self.env['res.users']
IrParamSudo = self.env['ir.config_parameter'].sudo()
dbuuid = IrParamSudo.get_param('database.uuid')
db_create_date = IrParamSudo.get_param('database.create_date')
limit_date = datetime.datetime.now()
limit_date = limit_date - datetime.timedelta(15)
limit_date_str = limit_date.strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
nbr_users = Users.search_count([('active', '=', True)])
nbr_active_users = Users.search_count([("login_date", ">=", limit_date_str), ('active', '=', True)])
nbr_share_users = 0
nbr_active_share_users = 0
if "share" in Users._fields:
nbr_share_users = Users.search_count([("share", "=", True), ('active', '=', True)])
nbr_active_share_users = Users.search_count([("share", "=", True), ("login_date", ">=", limit_date_str), ('active', '=', True)])
user = self.env.user
domain = [('application', '=', True), ('state', 'in', ['installed', 'to upgrade', 'to remove'])]
apps = self.env['ir.module.module'].sudo().search_read(domain, ['name'])
enterprise_code = IrParamSudo.get_param('database.enterprise_code')
web_base_url = IrParamSudo.get_param('web.base.url')
msg = {
"dbuuid": dbuuid,
"nbr_users": nbr_users,
"nbr_active_users": nbr_active_users,
"nbr_share_users": nbr_share_users,
"nbr_active_share_users": nbr_active_share_users,
"dbname": self._cr.dbname,
"db_create_date": db_create_date,
"version": release.version,
"language": user.lang,
"web_base_url": web_base_url,
"apps": [app['name'] for app in apps],
"enterprise_code": enterprise_code,
}
if user.partner_id.company_id:
company_id = user.partner_id.company_id
msg.update(company_id.read(["name", "email", "phone"])[0])
return msg
@api.model
def _get_sys_logs(self):
"""
Utility method to send a publisher warranty get logs messages.
"""
msg = self._get_message()
arguments = {'arg0': ustr(msg), "action": "update"}
#url = config.get("publisher_warranty_url")
#r = requests.post(url, data=arguments, timeout=30)
#r.raise_for_status()
return literal_eval('')
def update_notification(self, cron_mode=True):
# """
# Send a message to Odoo's publisher warranty server to check the
# validity of the contracts, get notifications, etc...
# @param cron_mode: If true, catch all exceptions (appropriate for usage in a cron).
# @type cron_mode: boolean
# """
# try:
# try:
# result = self._get_sys_logs()
# except Exception:
# if cron_mode: # we don't want to see any stack trace in cron
# return False
# _logger.debug("Exception while sending a get logs messages", exc_info=1)
# raise UserError(_("Error during communication with the publisher warranty server."))
# # old behavior based on res.log; now on mail.message, that is not necessarily installed
# user = self.env['res.users'].sudo().browse(SUPERUSER_ID)
# poster = self.sudo().env.ref('mail.channel_all_employees')
# for message in result["messages"]:
# try:
# poster.message_post(body=message, subtype_xmlid='mail.mt_comment', partner_ids=[user.partner_id.id])
# except Exception:
# pass
# if result.get('enterprise_info'):
# # Update expiration date
# set_param = self.env['ir.config_parameter'].sudo().set_param
## set_param('database.expiration_date', result['enterprise_info'].get('expiration_date'))
## set_param('database.expiration_reason', result['enterprise_info'].get('expiration_reason', 'trial'))
## set_param('database.enterprise_code', result['enterprise_info'].get('enterprise_code'))
## set_param('database.already_linked_subscription_url', result['enterprise_info'].get('database_already_linked_subscription_url'))
## set_param('database.already_linked_email', result['enterprise_info'].get('database_already_linked_email'))
## set_param('database.already_linked_send_mail_url', result['enterprise_info'].get('database_already_linked_send_mail_url'))
# except Exception:
# if cron_mode:
# return False # we don't want to see any stack trace in cron
# else:
# raise
return True
@wshamasneh
Copy link

@wshamasneh I am also currently trying to find out what file it is that I need to patch so currently I can't help as I don't know where or how to use the file

Thanks for your reply, it was my bad asking you, my question should be for @tejastank and @KomsijaSuad, so @tejastank and @KomsijaSuad Could you please share more details on how to patch the license file check?

@KomsijaSuad
Copy link

KomsijaSuad commented Dec 15, 2025

@wshamasneh @codefreak558 The file is located at odoo/addons/mail/models/update.py (at least for me). Just copy the content from here to there. Note that this file isn't for extending your database expiration, but for disabling information from being sent to Odoo.

@codefreak558
Copy link

@KomsijaSuad okay cool thanks that worked for me. Then if you have a more up to date enterprise 19 could you send that through to me via email

@hstpc
Copy link

hstpc commented Dec 18, 2025

@KomsijaSuad okay cool thanks that worked for me. Then if you have a more up to date enterprise 19 could you send that through to me via email

Hello @codefreak558 ! Can you help me install it? Or explain the question to me?

Can I have your email address or contact me via email? hstpc@proton.me

@klimaflo
Copy link

Hi, anyone who has actually managed to install this, can you please send me instructions on klimaflooperations@gmail.com

@cityshop365-cmd
Copy link

First of all, I want to be crystal clear: I am not interested in using any illegal version of Odoo, and I am not interested in bypassing or circumventing Odoo’s subscription or security mechanisms in any way.

That said, from a purely technical perspective, I respect the skill involved here. This shows deep understanding and strong engineering ability. I believe this level of talent would be better used in a legal, constructive way that creates real value and pays well.

What I actually need is custom Odoo development. I am planning to build a few Odoo apps and I am looking for an experienced, smart developer to work with directly. I am not looking to work with agencies. I only need a small number of apps and targeted features, done properly.

To be clear again: I am not trying to use Odoo Enterprise for free. Odoo’s Community Edition is already a fair and continuously developed option, so there is no reason to look for cracks. My interest is strictly in legal, professional app development.

Compensation can be straightforward (paid work) and can also include a commission or revenue-share model if that fits better. What matters to me is strong technical skill, professionalism, and a clean, legal collaboration going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment