diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 931ae7f41df..de6394b2ea2 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -645,8 +645,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/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index 2756b0ebd42..ecdda31d27d 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -218,9 +218,10 @@ class HrExpense(models.Model): raise UserError(_("No Home Address found for the employee %s, please configure one.") % (expense.employee_id.name)) emp_account = expense.employee_id.address_home_id.property_account_payable_id.id + aml_name = expense.employee_id.name + ': ' + expense.name.split('\n')[0][:64] move_lines.append({ 'type': 'dest', - 'name': expense.employee_id.name, + 'name': aml_name, 'price': total, 'account_id': emp_account, 'date_maturity': acc_date, @@ -253,9 +254,10 @@ class HrExpense(models.Model): if not account: raise UserError(_('Please configure Default Expense account for Product expense: `property_account_expense_categ_id`.')) + aml_name = expense.employee_id.name + ': ' + expense.name.split('\n')[0][:64] move_line = { 'type': 'src', - 'name': expense.name.split('\n')[0][:64], + 'name': aml_name, 'price_unit': expense.unit_amount, 'quantity': expense.quantity, 'price': expense.total_amount, diff --git a/addons/point_of_sale/data/point_of_sale_demo.xml b/addons/point_of_sale/data/point_of_sale_demo.xml index 174ca4edaf0..8e8d7b05681 100644 --- a/addons/point_of_sale/data/point_of_sale_demo.xml +++ b/addons/point_of_sale/data/point_of_sale_demo.xml @@ -141,6 +141,7 @@ + diff --git a/addons/rating_project/models/project.py b/addons/rating_project/models/project.py index 345576768ae..5c4eb6fc119 100644 --- a/addons/rating_project/models/project.py +++ b/addons/rating_project/models/project.py @@ -4,6 +4,7 @@ from datetime import timedelta from odoo import api, fields, models +from odoo.tools.safe_eval import safe_eval class ProjectTaskType(models.Model): @@ -104,7 +105,9 @@ class Project(models.Model): def action_view_task_rating(self): """ return the action to see all the rating about the tasks of the project """ action = self.env['ir.actions.act_window'].for_xml_id('rating', 'action_view_rating') - return dict(action, domain=[('res_id', 'in', self.tasks.ids), ('res_model', '=', 'project.task')]) + action_domain = safe_eval(action['domain']) if action['domain'] else [] + domain = action_domain + [('res_id', 'in', self.tasks.ids), ('res_model', '=', 'project.task')] + return dict(action, domain=domain) @api.multi def action_view_all_rating(self): diff --git a/addons/rating_project_issue/models/project_issue.py b/addons/rating_project_issue/models/project_issue.py index 5b2b126cad2..047edd6441f 100644 --- a/addons/rating_project_issue/models/project_issue.py +++ b/addons/rating_project_issue/models/project_issue.py @@ -4,6 +4,7 @@ from datetime import timedelta from odoo import api, fields, models +from odoo.tools.safe_eval import safe_eval class ProjectIssue(models.Model): @@ -28,7 +29,6 @@ class ProjectIssue(models.Model): return super(ProjectIssue, self).rating_apply(rate, token=token, feedback=feedback, subtype="rating_project_issue.mt_issue_rating") - class Stage(models.Model): _inherit = ['project.task.type'] @@ -45,7 +45,7 @@ class Project(models.Model): def _send_rating_mail(self): super(Project, self)._send_rating_mail() for project in self: - project.issue_ids._send_issue_rating_mail() + self.env['project.issue'].search([('project_id', '=', project.id)])._send_issue_rating_mail() @api.depends('percentage_satisfaction_task', 'percentage_satisfaction_issue') def _compute_percentage_satisfaction_project(self): @@ -58,7 +58,7 @@ class Project(models.Model): activity_great = activity_task['great'] activity_sum = sum(activity_task.values()) if project.use_issues: - activity_issue = project.issue_ids.rating_get_grades(domain) + activity_issue = self.env['project.issue'].search([('project_id', '=', project.id)]).rating_get_grades(domain) activity_great += activity_issue['great'] activity_sum += sum(activity_issue.values()) project.percentage_satisfaction_project = activity_great * 100 / activity_sum if activity_sum else -1 @@ -77,7 +77,9 @@ class Project(models.Model): """ return the action to see all the rating about the issues of the project """ action = self.env['ir.actions.act_window'].for_xml_id('rating', 'action_view_rating') issues = self.env['project.issue'].search([('project_id', 'in', self.ids)]) - return dict(action, domain=[('res_id', 'in', issues.ids), ('res_model', '=', 'project.issue')]) + action_domain = safe_eval(action['domain']) if action['domain'] else [] + domain = action_domain + [('res_id', 'in', issues.ids), ('res_model', '=', 'project.issue')] + return dict(action, domain=domain) @api.multi def action_view_all_rating(self): diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 7ae10fe6bfc..b3cbaad92a3 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/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index 101c3463e6e..28bfe83a345 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -2302,13 +2302,16 @@ eventHandler.modules.popover.update = function ($popover, oStyle, isAirMode) { } }; -options.onPaste = function (e) { - e.preventDefault(); // FIXME this does not work with our custom out-dated summernote. - document.execCommand("undo"); // FIXME ... so use this hack until we decide to do something about it. - - var pastedText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); - var formattedText = pastedText.replace(/([^.!?:;])\r?\n/g, "$1").trim(); // Remove linebreaks which are not at the end of a sentence - document.execCommand("insertText", false, formattedText); +// override summernote clipboard functionality +eventHandler.modules.clipboard.attach = function(layoutInfo) { + var $editable = layoutInfo.editable(); + $editable.on('paste', function(e) { + e.preventDefault(); + $editable.data('NoteHistory').recordUndo($editable); + var pastedText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); + var formattedText = pastedText.replace(/([^.!?:;])\r?\n/g, "$1").trim(); // Remove linebreaks which are not at the end of a sentence + document.execCommand("insertText", false, formattedText); + }); }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index b1a0fff4e10..3edf0313e3f 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -166,14 +166,13 @@ class Http(models.AbstractModel): langs = [lg[0] for lg in request.website.get_languages()] path = request.httprequest.path.split('/') if first_pass: + is_a_bot = cls.is_a_bot() nearest_lang = not func and cls.get_nearest_lang(path[1]) url_lang = nearest_lang and path[1] preferred_lang = ((cook_lang if cook_lang in langs else False) - or cls.get_nearest_lang(request.lang) + or (not is_a_bot and cls.get_nearest_lang(request.lang)) or request.website.default_lang_code) - is_a_bot = cls.is_a_bot() - request.lang = 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 b205a3a58b0..918c59e3d1e 100644 --- a/addons/website_event/views/website_event_templates.xml +++ b/addons/website_event/views/website_event_templates.xml @@ -241,7 +241,7 @@

@@ -342,7 +342,7 @@
@@ -521,7 +521,7 @@ to
diff --git a/addons/website_quote/views/website_quote_templates.xml b/addons/website_quote/views/website_quote_templates.xml index 463f10b80d4..342d9859a7b 100644 --- a/addons/website_quote/views/website_quote_templates.xml +++ b/addons/website_quote/views/website_quote_templates.xml @@ -692,7 +692,12 @@ - + + + + + + diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 0d0d352f670..883904cd8c1 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -86,6 +86,8 @@ class BaseCase(unittest.TestCase): initialized by subclasses. """ + longMessage = True # more verbose error message by default: https://www.odoo.com/r/Vmh + def cursor(self): return self.registry.cursor()