diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index a1bdf5d12f4..8ef48cf6d68 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -650,8 +650,9 @@ class AccountBankStatementLine(models.Model): # Look for a single move line with the same amount field = currency and 'amount_residual_currency' or 'amount_residual' liquidity_field = currency and 'amount_currency' or amount > 0 and 'debit' or 'credit' + liquidity_amt_clause = currency and '%(amount)s' or 'abs(%(amount)s)' sql_query = self._get_common_sql_query(excluded_ids=excluded_ids) + \ - " AND ("+field+" = %(amount)s OR (acc.internal_type = 'liquidity' AND "+liquidity_field+" = %(amount)s)) \ + " AND ("+field+" = %(amount)s OR (acc.internal_type = 'liquidity' AND "+liquidity_field+" = " + liquidity_amt_clause + ")) \ ORDER BY date_maturity asc, aml.id asc LIMIT 1" self.env.cr.execute(sql_query, params) results = self.env.cr.fetchone() diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index c6e9ab46dcd..a98d6d01492 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -108,6 +108,15 @@ class PickingType(models.Model): res.append((picking_type.id, name)) return res + @api.model + def name_search(self, name, args=None, operator='ilike', limit=100): + args = args or [] + domain = [] + if name: + domain = ['|', ('name', operator, name), ('warehouse_id.name', operator, name)] + picks = self.search(domain + args, limit=limit) + return picks.name_get() + @api.onchange('code') def onchange_picking_code(self): if self.code == 'incoming': diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index a448b9d8554..8b2f3c554d7 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -132,14 +132,13 @@ class ir_http(orm.AbstractModel): langs = [lg[0] for lg in request.website.get_languages()] path = request.httprequest.path.split('/') if first_pass: + is_a_bot = self.is_a_bot() nearest_lang = not func and self.get_nearest_lang(path[1]) url_lang = nearest_lang and path[1] preferred_lang = ((cook_lang if cook_lang in langs else False) - or self.get_nearest_lang(request.lang) + or (not is_a_bot and self.get_nearest_lang(request.lang)) or request.website.default_lang_code) - is_a_bot = self.is_a_bot() - request.lang = request.context['lang'] = nearest_lang or preferred_lang # if lang in url but not the displayed or default language --> change or remove # or no lang in url, and lang to dispay not the default language --> add lang diff --git a/addons/website_event/views/website_event_templates.xml b/addons/website_event/views/website_event_templates.xml index 5a00e44953a..0dc01d5e2c9 100644 --- a/addons/website_event/views/website_event_templates.xml +++ b/addons/website_event/views/website_event_templates.xml @@ -243,7 +243,7 @@
@@ -345,7 +345,7 @@ @@ -507,7 +507,7 @@ to