Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4f59fea
end
optionfamily Dec 28, 2020
cc66eb2
Merge pull request #10 from odoochain/14.0
odoochain Jan 12, 2021
6f83db6
Merge branch '14chain' of github.com:odoochain/OCB into 14chain
optionfamily Jan 12, 2021
d12645a
修正一下翻译怎么啦
optionfamily Feb 7, 2021
1fe4cff
updatae requirements
optionfamily Feb 7, 2021
9c3e837
Merge pull request #12 from odoochain/14.0
odoochain Feb 7, 2021
af557b4
Merge branch '14chain' of github.com:odoochain/OCB into 14chain
optionfamily Feb 7, 2021
1c03a77
Merge pull request #14 from odoochain/14.0
odoochain Feb 15, 2021
5bc9610
odoochain
optionfamily May 26, 2021
1ca1ba3
Merge pull request #15 from odoochain/14.0
odoochain May 27, 2021
57edc58
Merge branch 'OCA:14.0' into 14chain
paddlelaw Sep 2, 2021
9da8910
odoochain
optionfamily Oct 1, 2021
6da20fb
允许跨域访问
optionfamily Oct 1, 2021
f23c7d7
Merge branch 'OCA:14.0' into 14chain
paddlelaw May 26, 2022
65059c5
一些小问题
optionfamily May 29, 2022
dd9ec02
222
optionfamily May 29, 2022
ab4a0ef
Merge branch '14chain' of github.com:odoochain/OCB into 14chain
optionfamily May 29, 2022
5deaa6c
Merge branch 'OCA:14.0' into 14chain
odoochain Jul 9, 2022
10c2179
删除敏感信息
optionfamily Jul 9, 2022
9511f97
增加几个新税率
optionfamily Jul 10, 2022
6014f90
Merge branch 'OCA:14.0' into 14chain
odoochain Jul 11, 2022
46aaf99
Merge branch '14chain' of github.com:odoochain/OCB into 14chain
optionfamily Jul 11, 2022
ebb8c64
Merge remote-tracking branch 'upstream/14.0' into 14.22.07.12
optionfamily Jul 13, 2022
e2c8c93
001 upgrade to python3.10
optionfamily Jul 13, 2022
ead67e7
fix
optionfamily Jul 13, 2022
127d5c9
https://github.com/odoo/odoo/issues/89533
optionfamily Jul 14, 2022
467ea53
fix bus warning
optionfamily Jul 14, 2022
6b384d8
still have some errors
optionfamily Jul 14, 2022
4212b8e
Merge branch 'OCA:14.0' into 14-updatetowerkzeug2
odoochain Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ setup/win32/static/postgresql*.exe
/man/
/share/
/src/
/odoo.conf
/dev/
4 changes: 2 additions & 2 deletions addons/auth_signup/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def web_auth_signup(self, *args, **kw):
qcontext['error'] = _("Could not create a new account.")

response = request.render('auth_signup.signup', qcontext)
response.headers['X-Frame-Options'] = 'DENY'
# response.headers['X-Frame-Options'] = 'DENY'
return response

@http.route('/web/reset_password', type='http', auth='public', website=True, sitemap=False)
Expand Down Expand Up @@ -87,7 +87,7 @@ def web_auth_reset_password(self, *args, **kw):
qcontext['error'] = str(e)

response = request.render('auth_signup.reset_password', qcontext)
response.headers['X-Frame-Options'] = 'DENY'
# response.headers['X-Frame-Options'] = 'DENY'
return response

def get_auth_signup_config(self):
Expand Down
2 changes: 1 addition & 1 deletion addons/bus/models/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def poll(self, dbname, channels, last, options=None, timeout=TIMEOUT):
current = threading.current_thread()
current._daemonic = True
# rename the thread to avoid tests waiting for a longpolling
current.setName("openerp.longpolling.request.%s" % current.ident)
current.name = f"openerp.longpolling.request.{current.ident}"

registry = odoo.registry(dbname)

Expand Down
2 changes: 1 addition & 1 deletion addons/crm/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ def _update_automated_probabilities(self):
# - avoid blocking the table for too long with a too big transaction
transactions_count, transactions_failed_count = 0, 0
cron_update_lead_start_date = datetime.now()
auto_commit = not getattr(threading.currentThread(), 'testing', False)
auto_commit = not getattr(threading.current_thread(), 'testing', False)
for probability, probability_lead_ids in probability_leads.items():
for lead_ids_current in tools.split_every(PLS_UPDATE_BATCH_STEP, probability_lead_ids):
transactions_count += 1
Expand Down
2 changes: 1 addition & 1 deletion addons/event/models/event_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def run(self, autocommit=False):
self.invalidate_cache()
self._warn_template_error(scheduler, e)
else:
if autocommit and not getattr(threading.currentThread(), 'testing', False):
if autocommit and not getattr(threading.current_thread(), 'testing', False):
self.env.cr.commit()
return True

Expand Down
81 changes: 40 additions & 41 deletions addons/http_routing/models/ir_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

import odoo
from odoo import api, models, registry, exceptions, tools, http
from odoo.addons.base.models.ir_http import RequestUID, ModelConverter
from odoo.addons.base.models import ir_http
from odoo.addons.base.models.ir_http import RequestUID
from odoo.addons.base.models.qweb import QWebException
from odoo.http import request
from odoo.osv import expression
Expand Down Expand Up @@ -155,9 +156,9 @@ def url_lang(path_or_uri, lang_code=None):
lang_code = pycompat.to_text(lang_code or request.context['lang'])
lang_url_code = Lang._lang_code_to_urlcode(lang_code)
lang_url_code = lang_url_code if lang_url_code in lang_url_codes else lang_code

if (len(lang_url_codes) > 1 or force_lang) and is_multilang_url(location, lang_url_codes):
ps = location.split(u'/')
loc, sep, qs = location.partition('?')
ps = loc.split(u'/')
default_lg = request.env['ir.http']._get_default_lang()
if ps[1] in lang_url_codes:
# Replace the language only if we explicitly provide a language to url_for
Expand All @@ -169,7 +170,8 @@ def url_lang(path_or_uri, lang_code=None):
# Insert the context language or the provided language
elif lang_url_code != default_lg.url_code or force_lang:
ps.insert(1, lang_url_code)
location = u'/'.join(ps)

location = u'/'.join(ps) + sep + qs
return location


Expand Down Expand Up @@ -197,7 +199,7 @@ def url_for(url_from, lang_code=None, no_rewrite=False):
and '/static/' not in path
and not path.startswith('/web/')
)):
new_url = request.env['ir.http'].url_rewrite(path)
new_url, _ = request.env['ir.http'].url_rewrite(path)
new_url = new_url if not qs else new_url + '?%s' % qs

return url_lang(new_url or url_from, lang_code=lang_code)
Expand Down Expand Up @@ -229,7 +231,8 @@ def is_multilang_url(local_url, lang_url_codes=None):

# Try to match an endpoint in werkzeug's routing table
try:
func = request.env['ir.http']._get_endpoint_qargs(path, query_args=query_string)
_, func = request.env['ir.http'].url_rewrite(path, query_args=query_string)

# /page/xxx has no endpoint/func but is multilang
return (not func or (
func.routing.get('website', False)
Expand All @@ -240,7 +243,7 @@ def is_multilang_url(local_url, lang_url_codes=None):
return False


class ModelConverter(ModelConverter):
class ModelConverter(ir_http.ModelConverter):

def __init__(self, url_map, model=False, domain='[]'):
super(ModelConverter, self).__init__(url_map, model)
Expand Down Expand Up @@ -425,7 +428,7 @@ def _dispatch(cls):
# handle // in url
if request.httprequest.method == 'GET' and '//' in request.httprequest.path:
new_url = request.httprequest.path.replace('//', '/') + '?' + request.httprequest.query_string.decode('utf-8')
return werkzeug.utils.redirect(new_url, 301)
return request.redirect(new_url, code=301)

# locate the controller method
try:
Expand All @@ -439,7 +442,7 @@ def _dispatch(cls):
# most of the time the browser is loading and inexisting assets or image. A standard 404 is enough.
# Earlier check would be difficult since we don't want to break data modules
path_components = request.httprequest.path.split('/')
request.is_frontend = len(path_components) < 3 or path_components[2] != 'static' or not '.' in path_components[-1]
request.is_frontend = len(path_components) < 3 or path_components[2] != 'static' or '.' not in path_components[-1]
routing_error = e

request.is_frontend_multilang = not func or (func and request.is_frontend and func.routing.get('multilang', func.routing['type'] == 'http'))
Expand All @@ -458,8 +461,6 @@ def _dispatch(cls):

# For website routes (only), add website params on `request`
if request.is_frontend:
request.redirect = lambda url, code=302: werkzeug.utils.redirect(url_for(url), code)

cls._add_dispatch_parameters(func)

path = request.httprequest.path.split('/')
Expand Down Expand Up @@ -490,6 +491,12 @@ def _dispatch(cls):
return redirect
elif url_lg:
request.uid = None
if request.httprequest.path == '/%s/' % url_lg:
# special case for homepage controller, mimick `_postprocess_args()` redirect
path = request.httprequest.path[:-1]
if request.httprequest.query_string:
path += '?' + request.httprequest.query_string.decode('utf-8')
return request.redirect(path, code=301)
path.pop(1)
routing_error = None
return cls.reroute('/'.join(path) or '/')
Expand All @@ -512,11 +519,17 @@ def _dispatch(cls):
result = super(IrHttp, cls)._dispatch()

cook_lang = request.httprequest.cookies.get('frontend_lang')
if request.is_frontend and cook_lang != request.lang.code and hasattr(result, 'set_cookie'):
result.set_cookie('frontend_lang', request.lang.code)
if request.is_frontend and cook_lang != request.lang._get_cached('code') and hasattr(result, 'set_cookie'):
result.set_cookie('frontend_lang', request.lang._get_cached('code'))

return result

@classmethod
def _redirect(cls, location, code=303):
if request and request.db and getattr(request, 'is_frontend', False):
location = url_for(location)
return super()._redirect(location, code)

@classmethod
def reroute(cls, path):
if not hasattr(request, 'rerouting'):
Expand All @@ -528,8 +541,13 @@ def reroute(cls, path):
raise Exception("Rerouting limit exceeded")
request.httprequest.environ['PATH_INFO'] = path
# void werkzeug cached_property. TODO: find a proper way to do this
for key in ('path', 'full_path', 'url', 'base_url'):
for key in ('full_path', 'url', 'base_url'):
request.httprequest.__dict__.pop(key, None)
# since werkzeug 2.0 `path`` became an attribute and is not a cached property anymore
if hasattr(type(request.httprequest), 'path'): # cached property
request.httprequest.__dict__.pop('path', None)
else: # direct attribute
request.httprequest.path = '/' + path.lstrip('/')

return cls._dispatch()

Expand All @@ -553,7 +571,7 @@ def _postprocess_args(cls, arguments, rule):
path = '/' + request.lang.url_code + path
if request.httprequest.query_string:
path += '?' + request.httprequest.query_string.decode('utf-8')
return werkzeug.utils.redirect(path, code=301)
return request.redirect(path, code=301)

@classmethod
def _get_exception_code_values(cls, exception):
Expand Down Expand Up @@ -654,39 +672,20 @@ def _handle_exception(cls, exception):
return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8')

@api.model
@tools.ormcache('path')
def url_rewrite(self, path):
@tools.ormcache('path', 'query_args')
def url_rewrite(self, path, query_args=None):
new_url = False
router = http.root.get_db_router(request.db).bind('')
try:
_ = router.match(path, method='POST')
except werkzeug.exceptions.MethodNotAllowed:
_ = router.match(path, method='GET')
except werkzeug.routing.RequestRedirect as e:
# get path from http://{path}?{current query string}
new_url = e.new_url.split('?')[0][7:]
except werkzeug.exceptions.NotFound:
new_url = path
except Exception as e:
raise e

return new_url or path

# merge with def url_rewrite in master/14.1
@api.model
@tools.cache('path', 'query_args')
def _get_endpoint_qargs(self, path, query_args=None):
router = http.root.get_db_router(request.db).bind('')
endpoint = False
try:
endpoint = router.match(path, method='POST', query_args=query_args)
except werkzeug.exceptions.MethodNotAllowed:
endpoint = router.match(path, method='GET', query_args=query_args)
except werkzeug.routing.RequestRedirect as e:
new_url = e.new_url[7:] # remove scheme
assert new_url != path
endpoint = self._get_endpoint_qargs(new_url, query_args)
# get path from http://{path}?{current query string}
new_url = e.new_url.split('?')[0][7:]
_, endpoint = self.url_rewrite(new_url, query_args)
endpoint = endpoint and [endpoint]
except werkzeug.exceptions.NotFound:
pass # endpoint = False
return endpoint and endpoint[0]
new_url = path
return new_url or path, endpoint and endpoint[0]
2 changes: 1 addition & 1 deletion addons/hw_drivers/tools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def load_certificate():
db_uuid = read_file_first_line('odoo-db-uuid.conf')
enterprise_code = read_file_first_line('odoo-enterprise-code.conf')
if db_uuid and enterprise_code:
url = 'https://www.odoo.com/odoo-enterprise/iot/x509'
url = 'https://www.odoochain.com/odoochain-enterprise/iot/x509'
data = {
'params': {
'db_uuid': db_uuid,
Expand Down
12 changes: 12 additions & 0 deletions addons/l10n_cn/data/account_tax_group_data.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="l10n_cn_tax_group_vat_3" model="account.tax.group">
<field name="name">VAT 3%</field>
</record>
<record id="l10n_cn_tax_group_vat_6" model="account.tax.group">
<field name="name">VAT 6%</field>
</record>
<record id="l10n_cn_tax_group_vat_9" model="account.tax.group">
<field name="name">VAT 9%</field>
</record>
<record id="l10n_cn_tax_group_vat_11" model="account.tax.group">
<field name="name">VAT 11%</field>
</record>
<record id="l10n_cn_tax_group_vat_13" model="account.tax.group">
<field name="name">VAT 13%</field>
</record>
<record id="l10n_cn_tax_group_vat_16" model="account.tax.group">
<field name="name">VAT 16%</field>
</record>
<record id="l10n_cn_tax_group_vat_17" model="account.tax.group">
<field name="name">VAT 17%</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion addons/l10n_cn_city/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
City Data/城市数据

""",
'depends': ['l10n_cn','base_address_city'],
'depends': ['base_address_city'],
'data': [
'data/res_city_data.xml',
],
Expand Down
7 changes: 4 additions & 3 deletions addons/link_tracker/models/mail_render_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import re

from werkzeug import urls, utils
from html import unescape
from werkzeug import urls

from odoo import api, models, tools

Expand Down Expand Up @@ -40,7 +41,7 @@ def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None)
label = (match[3] or '').strip()

if not blacklist or not [s for s in blacklist if s in long_url] and not long_url.startswith(short_schema):
create_vals = dict(link_tracker_vals, url=utils.unescape(long_url), label=utils.unescape(label))
create_vals = dict(link_tracker_vals, url=unescape(long_url), label=unescape(label))
link = self.env['link.tracker'].create(create_vals)
if link.short_url:
new_href = href.replace(long_url, link.short_url)
Expand Down Expand Up @@ -69,7 +70,7 @@ def _shorten_links_text(self, content, link_tracker_vals, blacklist=None, base_u
if blacklist and any(item in parsed.path for item in blacklist):
continue

create_vals = dict(link_tracker_vals, url= utils.unescape(original_url))
create_vals = dict(link_tracker_vals, url=unescape(original_url))
link = self.env['link.tracker'].create(create_vals)
if link.short_url:
content = content.replace(original_url, link.short_url, 1)
Expand Down
2 changes: 1 addition & 1 deletion addons/mail/models/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def process_email_queue(self, ids=None):
res = None
try:
# auto-commit except in testing mode
auto_commit = not getattr(threading.currentThread(), 'testing', False)
auto_commit = not getattr(threading.current_thread(), 'testing', False)
res = self.browse(ids).send(auto_commit=auto_commit)
except Exception:
_logger.exception("Failed processing mail queue")
Expand Down
2 changes: 1 addition & 1 deletion addons/mail/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -2346,7 +2346,7 @@ def _notify_record_by_email(self, message, recipients_data, msg_vals=False,
# 2. do not send emails immediately if the registry is not loaded,
# to prevent sending email during a simple update of the database
# using the command-line.
test_mode = getattr(threading.currentThread(), 'testing', False)
test_mode = getattr(threading.current_thread(), 'testing', False)
if force_send and len(emails) < recipients_max and (not self.pool._init or test_mode):
# unless asked specifically, send emails after the transaction to
# avoid side effects due to emails being sent while the transaction fails
Expand Down
2 changes: 1 addition & 1 deletion addons/mass_mailing/models/mailing.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def action_send_mail(self, res_ids=None):
extra_context = mailing._get_mass_mailing_context()
composer = composer.with_context(active_ids=res_ids, **extra_context)
# auto-commit except in testing mode
auto_commit = not getattr(threading.currentThread(), 'testing', False)
auto_commit = not getattr(threading.current_thread(), 'testing', False)
composer.send_mail(auto_commit=auto_commit)
mailing.write({
'state': 'done',
Expand Down
1 change: 1 addition & 0 deletions addons/pad/models/pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def pad_get_content(self, url):
path = len(split_url) == 2 and split_url[1]
try:
content = myPad.getHtml(path).get('html', '')
# todo pad跨域和不显示问题
except IOError:
_logger.warning('Http Error: the credentials might be absent for url: "%s". Falling back.' % url)
try:
Expand Down
2 changes: 1 addition & 1 deletion addons/portal/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def account(self, redirect=None, **post):
})

response = request.render("portal.portal_my_details", values)
response.headers['X-Frame-Options'] = 'DENY'
# response.headers['X-Frame-Options'] = 'DENY'
return response

@route('/my/security', type='http', auth='user', website=True, methods=['GET', 'POST'])
Expand Down
4 changes: 2 additions & 2 deletions addons/sale_timesheet/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def unlink(self):

def write(self, vals):
# timesheet product can't be archived
test_mode = getattr(threading.currentThread(), 'testing', False) or self.env.registry.in_test_mode()
test_mode = getattr(threading.current_thread(), 'testing', False) or self.env.registry.in_test_mode()
if not test_mode and 'active' in vals and not vals['active']:
time_product = self.env.ref('sale_timesheet.time_product')
if time_product.product_tmpl_id in self:
Expand Down Expand Up @@ -143,7 +143,7 @@ def unlink(self):

def write(self, vals):
# timesheet product can't be archived
test_mode = getattr(threading.currentThread(), 'testing', False) or self.env.registry.in_test_mode()
test_mode = getattr(threading.current_thread(), 'testing', False) or self.env.registry.in_test_mode()
if not test_mode and 'active' in vals and not vals['active']:
time_product = self.env.ref('sale_timesheet.time_product')
if time_product in self:
Expand Down
4 changes: 2 additions & 2 deletions addons/sms/models/sms_sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def send(self, delete_all=False, auto_commit=False, raise_exception=False):
for batch_ids in self._split_batch():
self.browse(batch_ids)._send(delete_all=delete_all, raise_exception=raise_exception)
# auto-commit if asked except in testing mode
if auto_commit is True and not getattr(threading.currentThread(), 'testing', False):
if auto_commit is True and not getattr(threading.current_thread(), 'testing', False):
self._cr.commit()

def cancel(self):
Expand All @@ -81,7 +81,7 @@ def _process_queue(self, ids=None):
res = None
try:
# auto-commit except in testing mode
auto_commit = not getattr(threading.currentThread(), 'testing', False)
auto_commit = not getattr(threading.current_thread(), 'testing', False)
res = self.browse(ids).send(delete_all=False, auto_commit=auto_commit, raise_exception=False)
except Exception:
_logger.exception("Failed processing SMS queue")
Expand Down
Loading