17.0 vanilla

This commit is contained in:
Ernad Husremovic 2025-10-03 18:05:14 +02:00
parent 2e65bf056a
commit df627a6bba
328 changed files with 578149 additions and 759311 deletions

View file

@ -18,3 +18,5 @@ from . import neutralize
from . import obfuscate
from . import genproxytoken
from . import db
COMMAND = None

View file

@ -63,6 +63,7 @@ def main():
if command in commands:
o = commands[command]()
odoo.cli.COMMAND = command
o.run(args)
else:
sys.exit('Unknown command %r' % (command,))

View file

@ -166,7 +166,7 @@ class Obfuscate(Command):
('mail_tracking_value', 'new_value_char'),
('mail_tracking_value', 'new_value_text'),
('res_partner', 'name'),
('res_partner', 'display_name'),
('res_partner', 'complete_name'),
('res_partner', 'email'),
('res_partner', 'phone'),
('res_partner', 'mobile'),

View file

@ -32,10 +32,20 @@ class Scaffold(Command):
sys.exit(parser.print_help())
args = parser.parse_args(args=cmdargs)
if args.template.id == 'l10n_payroll':
name_split = args.name.split('-')
params = {
'name': name_split[0],
'code': name_split[1]
}
else:
params = {'name': args.name}
args.template.render_to(
snake(args.name),
directory(args.dest, create=True),
{'name': args.name})
params=params,
)
def epilog(self):
return "Built-in templates available are: %s" % ', '.join(
@ -109,11 +119,14 @@ class template(object):
"""
# overwrite with local
for path, content in self.files():
path = env.from_string(path).render(params)
local = os.path.relpath(path, self.path)
# strip .template extension
root, ext = os.path.splitext(local)
if ext == '.template':
local = root
if self.id == "l10n_payroll":
modname = f"l10n_{params['code']}_hr_payroll"
dest = os.path.join(directory, modname, local)
destdir = os.path.dirname(dest)
if not os.path.exists(destdir):
@ -126,6 +139,7 @@ class template(object):
env.from_string(content.decode('utf-8'))\
.stream(params or {})\
.dump(f, encoding='utf-8')
f.write(b'\n')
def die(message, code=1):
print(message, file=sys.stderr)

View file

@ -14,11 +14,8 @@ import atexit
import csv # pylint: disable=deprecated-module
import logging
import os
import signal
import re
import sys
import threading
import traceback
import time
from pathlib import Path
from psycopg2 import ProgrammingError, errorcodes
@ -33,6 +30,8 @@ __version__ = odoo.release.version
# Also use the `odoo` logger for the main script.
_logger = logging.getLogger('odoo')
re._MAXCACHE = 4096 # default is 512, a little too small for odoo
def check_root_user():
"""Warn if the process's user is 'root' (on POSIX system)."""
if os.name == 'posix':

View file

@ -4,6 +4,7 @@ import logging
import os
import signal
import sys
import threading
from pathlib import Path
import odoo
@ -106,6 +107,7 @@ class Shell(Command):
'odoo': odoo,
}
if dbname:
threading.current_thread().dbname = dbname
registry = odoo.registry(dbname)
with registry.cursor() as cr:
uid = odoo.SUPERUSER_ID
@ -113,6 +115,10 @@ class Shell(Command):
env = odoo.api.Environment(cr, uid, ctx)
local_vars['env'] = env
local_vars['self'] = env.user
# context_get() has started the transaction already. Rollback to
# avoid logging warning "rolling back the transaction before testing"
# from odoo.tests.shell.run_tests if the user hasn't done anything.
cr.rollback()
self.console(local_vars)
cr.rollback()
else:

View file

@ -2,19 +2,17 @@
{
'name': "{{ name }}",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'summary': "Short (1 phrase/line) summary of the module's purpose",
'description': """
Long description of module's purpose
Long description of module's purpose
""",
'author': "My Company",
'website': "https://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/data/ir_module_category_data.xml
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',