From 23a2bac3fa3aadc473e29adac376c614c983ec6b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 16 Jan 2018 14:14:54 +0100 Subject: [PATCH 01/15] [FIX] hr_equipment: no technician subscribe in 9.0 In 9.0, an "Human Resources / Employee" see only hr.equipment for which they are set as the "Employee". But the code automatically subscribed the "Technician" because the field name was named technically "user_id" which is automatically subscribed by the system. This led to a possible issue with read / unread message because of feature that just happen by coincidence. For 9.0 only (in 10.0 the field has been renamed technician_user_id and access rules have been changed). opw-805185 closes #22273 --- addons/hr_equipment/models/hr_equipment.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/hr_equipment/models/hr_equipment.py b/addons/hr_equipment/models/hr_equipment.py index 0d48366224f..e542e4c50cd 100644 --- a/addons/hr_equipment/models/hr_equipment.py +++ b/addons/hr_equipment/models/hr_equipment.py @@ -182,6 +182,15 @@ class HrEquipment(models.Model): self.message_subscribe_users(user_ids=user_ids) return super(HrEquipment, self).write(vals) + @api.model + def _message_get_auto_subscribe_fields(self, updated_fields, auto_follow_fields=None): + """ mail.thread override so user_id which has no special access allowance is not + automatically subscribed. + """ + if auto_follow_fields is None: + auto_follow_fields = [] + return super(HrEquipment, self)._message_get_auto_subscribe_fields(updated_fields, auto_follow_fields) + @api.multi def _read_group_category_ids(self, domain, read_group_order=None, access_rights_uid=None): """ Read group customization in order to display all the category in the From 73c9b3d01463e2ca143113ebca8d3a7e3b756256 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 16 Jan 2018 13:31:58 +0100 Subject: [PATCH 02/15] [FIX] mail: Cannot send new message from Event Track When the Speaker address is False, it crashed. opw:805361 --- addons/mail/static/src/js/chatter.js | 6 +++--- addons/mail/static/src/js/utils.js | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 51036e66aee..5d490a48297 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -111,7 +111,7 @@ var ChatterComposer = composer.BasicComposer.extend({ .done(function (suggested_recipients) { var thread_recipients = suggested_recipients[self.context.default_res_id]; _.each(thread_recipients, function (recipient) { - var parsed_email = utils.parse_email(recipient[1]); + var parsed_email = recipient[1] && utils.parse_email(recipient[1]); if (_.indexOf(email_addresses, parsed_email[1]) === -1) { self.suggested_partners.push({ checked: true, @@ -188,8 +188,8 @@ var ChatterComposer = composer.BasicComposer.extend({ context: { force_email: true, ref: "compound_context", - default_name: parsed_email[0], - default_email: parsed_email[1], + default_name: parsed_email && parsed_email[0], + default_email: parsed_email && parsed_email[1], }, title: _t("Please complete partner's informations"), disable_multiple_selection: true, diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js index b4e0c01a23a..4c7619e393a 100644 --- a/addons/mail/static/src/js/utils.js +++ b/addons/mail/static/src/js/utils.js @@ -101,15 +101,17 @@ function inline (node, transform_children) { // Parses text to find email: Tagada -> [Tagada, address@mail.fr] or False function parse_email (text) { - var result = text.match(/(.*)<(.*@.*)>/); - if (result) { - return [_.str.trim(result[1]), _.str.trim(result[2])]; + if (text){ + var result = text.match(/(.*)<(.*@.*)>/); + if (result) { + return [_.str.trim(result[1]), _.str.trim(result[2])]; + } + result = text.match(/(.*@.*)/); + if (result) { + return [_.str.trim(result[1]), _.str.trim(result[1])]; + } + return [text, false]; } - result = text.match(/(.*@.*)/); - if (result) { - return [_.str.trim(result[1]), _.str.trim(result[1])]; - } - return [text, false]; } // Replaces textarea text into html text (add

, ) From 80f1d9ded6f88de509dc1ca80a5fd201281b0d1d Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 16 Jan 2018 17:05:11 +0100 Subject: [PATCH 03/15] [FIX] mail: reduce no sudo effect mark_all_as_read The "Mark all read" button either set all messages as read, or if a domain is given, filter messages on it. But this filtering is also dependent on not doing sudo so odd notification to which we would somehow not have any access would never disappear in the unread number. Adding a sudo is risky, so this changeset just modify the test on domain since in most instance the domain is just an empty list (so: []). The added test before this change would fail at the last assert ("mark all read should conclude all needactions even inacessible ones"). opw-805185 closes #22277 --- addons/mail/models/mail_message.py | 2 +- addons/mail/tests/test_mail_features.py | 26 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 07079c57be0..f672e276adc 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -153,7 +153,7 @@ class Message(models.Model): """ Remove all needactions of the current partner. If channel_ids is given, restrict to messages written in one of those channels. """ partner_id = self.env.user.partner_id.id - if domain is None: + if not domain: query = "DELETE FROM mail_message_res_partner_needaction_rel WHERE res_partner_id IN %s" args = [(partner_id,)] if channel_ids: diff --git a/addons/mail/tests/test_mail_features.py b/addons/mail/tests/test_mail_features.py index 82dc2e05363..880c5f1ca47 100644 --- a/addons/mail/tests/test_mail_features.py +++ b/addons/mail/tests/test_mail_features.py @@ -48,6 +48,32 @@ class TestMailFeatures(TestMail): self.assertEqual(na_emp1_new, na_emp1_base + 1) self.assertEqual(na_emp2_new, na_emp2_base) + @mute_logger('openerp.addons.mail.models.mail_mail') + def test_mark_all_as_read(self): + portal_partner = self.user_portal.partner_id.sudo(self.user_portal.id) + + # mark all as read clear needactions + self.group_pigs.message_post(body='Test', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id]) + portal_partner.env['mail.message'].mark_all_as_read(channel_ids=[], domain=[]) + na_count = portal_partner.get_needaction_count() + self.assertEqual(na_count, 0, "mark all as read should conclude all needactions") + + # mark all as read also clear inaccessible needactions + new_msg = self.group_pigs.message_post(body='Zest', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id]) + needaction_accessible = len(portal_partner.env['mail.message'].search([['needaction', '=', True]])) + self.assertEqual(needaction_accessible, 1, "a new message to a partner is readable to that partner") + + new_msg.sudo().partner_ids = self.env['res.partner'] + needaction_length = len(portal_partner.env['mail.message'].search([['needaction', '=', True]])) + self.assertEqual(needaction_length, 0, "removing access of a message make it not readable") + + na_count = portal_partner.get_needaction_count() + self.assertEqual(na_count, 1, "message not accessible is currently still counted") + + portal_partner.env['mail.message'].mark_all_as_read(channel_ids=[], domain=[]) + na_count = portal_partner.get_needaction_count() + self.assertEqual(na_count, 0, "mark all read should conclude all needactions even inacessible ones") + class TestMessagePost(TestMail): From c05c2cc03cfa45fccfab420908bf7dc0726a4b87 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 17 Jan 2018 11:48:24 +0100 Subject: [PATCH 04/15] [FIX] hr_payroll: Unable to refund payslip The function action_payslip_done has been overwritten in module hr_payroll_account. Due to this overwrite, the function compute_sheet which creates the payslip lines was called after the creation of the entries. Then creating a refund payslip didn't create any entries. opw:785033 --- addons/hr_payroll/models/hr_payroll.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/hr_payroll/models/hr_payroll.py b/addons/hr_payroll/models/hr_payroll.py index becb958c771..09719395543 100644 --- a/addons/hr_payroll/models/hr_payroll.py +++ b/addons/hr_payroll/models/hr_payroll.py @@ -244,6 +244,7 @@ class HrPayslip(models.Model): def refund_sheet(self): for payslip in self: copied_payslip = payslip.copy({'credit_note': True, 'name': _('Refund: ') + payslip.name}) + copied_payslip.compute_sheet() copied_payslip.action_payslip_done() formview_ref = self.env.ref('hr_payroll.view_hr_payslip_form', False) treeview_ref = self.env.ref('hr_payroll.view_hr_payslip_tree', False) From 0690911d7588f0f96e6df9b09346ae144b108b35 Mon Sep 17 00:00:00 2001 From: Swapnesh Date: Mon, 27 Nov 2017 19:19:42 +0530 Subject: [PATCH 05/15] [CLA] signature for sswapnesh Backport of 4e333607f1d37c7d76ac614647c064705ddf5752 CLA already signed in v11 --- doc/cla/individual/sswapnesh.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doc/cla/individual/sswapnesh.md diff --git a/doc/cla/individual/sswapnesh.md b/doc/cla/individual/sswapnesh.md new file mode 100644 index 00000000000..97a61b8c83c --- /dev/null +++ b/doc/cla/individual/sswapnesh.md @@ -0,0 +1,12 @@ +India, 2017-11-24 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Swapensh Shah swapneshshah111@gmail.com https://github.com/sswapnesh + From 57e37d6629b327a5c01470862e649bc21ecff557 Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Tue, 16 Jan 2018 22:50:04 +0530 Subject: [PATCH 06/15] [FIX] calendar: Made Start/End date required in meetings This commit closes #22279 and closes #21979 --- addons/calendar/views/calendar_views.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/calendar/views/calendar_views.xml b/addons/calendar/views/calendar_views.xml index 03432741965..6a5c11de816 100644 --- a/addons/calendar/views/calendar_views.xml +++ b/addons/calendar/views/calendar_views.xml @@ -116,10 +116,10 @@ - - + + - +

From 128656f6ea56f200c7e7e0c8f80aa2bb11d7882c Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 17 Jan 2018 11:56:21 +0100 Subject: [PATCH 07/15] [FIX] website: space symbol is missing when compress html is enabled Issue: when the qWeb compress rendered HTML for a better Google PageSpeed result, some text fields are missing spacebar between fa icons and text, and between some fields. --- addons/website/models/ir_qweb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index fcfb93b59c0..1ee0318624b 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -45,5 +45,5 @@ class QWeb(orm.AbstractModel): compress = request and not request.debug and getattr(request, 'website', None) and request.website.compress_html if compress and element.getparent().tag not in self.PRESERVE_WHITESPACE: # No need to recurse because those tags children are not html5 parser friendly - tail = self.re_remove_spaces.sub(' ', tail.rstrip()) + tail = self.re_remove_spaces.sub(' ', tail) return super(QWeb, self).render_tail(tail, element, qwebcontext) From 74b564cf8d1a192cee784997a6fb9da5b030c794 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Fri, 12 Jan 2018 14:36:19 +0100 Subject: [PATCH 08/15] [FIX] website_slides: dont show upload button for public user This commit closes #15369 --- addons/website_slides/view/website_slides.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/website_slides/view/website_slides.xml b/addons/website_slides/view/website_slides.xml index 6b21bba84c6..27c13cdf4df 100644 --- a/addons/website_slides/view/website_slides.xml +++ b/addons/website_slides/view/website_slides.xml @@ -112,11 +112,6 @@ Upload - - - Upload - -
From 6e9163150ee4335622ca65c62637fa62b22a7e1e Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Tue, 2 May 2017 11:36:47 +0200 Subject: [PATCH 09/15] [IMP] account: make currency_exchange_journal_id field visible in settings --- addons/account/models/res_config.py | 6 ++++++ addons/account/views/res_config_view.xml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index 34145cf1a70..e6b705c86cd 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -14,6 +14,12 @@ class AccountConfigSettings(models.TransientModel): default=lambda self: self.env.user.company_id) currency_id = fields.Many2one('res.currency', related="company_id.currency_id", required=True, string='Currency', help="Main currency of the company.") + currency_exchange_journal_id = fields.Many2one( + 'account.journal', + related='company_id.currency_exchange_journal_id', + string="Exchange Gain or Loss Journal", + domain=[('type', '=', 'general')], + help='The accounting journal where automatic exchange differences will be registered') has_chart_of_accounts = fields.Boolean(compute='_compute_has_chart_of_accounts', string='Company has a chart of accounts') chart_template_id = fields.Many2one('account.chart.template', string='Template', domain="[('visible','=', True)]") diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml index 44c22a45d09..6186b611e0e 100644 --- a/addons/account/views/res_config_view.xml +++ b/addons/account/views/res_config_view.xml @@ -128,6 +128,10 @@
+
+
From 094c735f005f183b5a2b6ec7d803bba4516e9bd9 Mon Sep 17 00:00:00 2001 From: Nguyen Duc Tam Date: Tue, 16 Jan 2018 13:18:26 +0700 Subject: [PATCH 10/15] [CLA] Signature for nguyenductamlhp Closes #22255 --- doc/cla/individual/nguyenductamlhp.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/nguyenductamlhp.md diff --git a/doc/cla/individual/nguyenductamlhp.md b/doc/cla/individual/nguyenductamlhp.md new file mode 100644 index 00000000000..898f465c52b --- /dev/null +++ b/doc/cla/individual/nguyenductamlhp.md @@ -0,0 +1,11 @@ +Vietnam, 2018-01-16, + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Nguyen Duc Tam nguyenductamlhp@gmail.com https://github.com/nguyenductamlhp From a92eba42b814f26a170d7a45ae74f14ad5dc955a Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 18 Jan 2018 10:43:53 +0000 Subject: [PATCH 11/15] [FIX] website_form: avoid race condition This fixes what is explained in https://github.com/odoo/odoo/issues/20821#issuecomment-358574349 (PR #22330) --- addons/website_form/static/src/js/website_form.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/website_form/static/src/js/website_form.js b/addons/website_form/static/src/js/website_form.js index ff59b6186b9..7a8b413a04b 100644 --- a/addons/website_form/static/src/js/website_form.js +++ b/addons/website_form/static/src/js/website_form.js @@ -15,7 +15,7 @@ odoo.define('website_form.animation', function (require) { start: function() { var self = this; - qweb.add_template('/website_form/static/src/xml/website_form.xml'); + this.templates_loaded = ajax.loadXML('/website_form/static/src/xml/website_form.xml', qweb); this.$target.find('.o_website_form_send').on('click',function(e) {self.send(e);}); // Initialize datetimepickers @@ -218,7 +218,10 @@ odoo.define('website_form.animation', function (require) { if (status != 'success') { // Restore send button behavior if result is an error this.$target.find('.o_website_form_send').on('click',function(e) {self.send(e);}); } - this.$target.find('#o_website_form_result').replaceWith(qweb.render("website_form.status_" + status)) + var $result = this.$('#o_website_form_result'); + this.templates_loaded.done(function () { + $result.replaceWith(qweb.render("website_form.status_" + status)); + }); }, }); }); From 07240a9369e6e333cfdb10ae833f5b217bab5750 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 18 Jan 2018 10:49:46 +0100 Subject: [PATCH 12/15] [FIX] account: Error when duplicating a purchase invoice In multi company, when a user 1 creates a purchase invoice I in company A. The responsible of the invpoice I is user 1. But if the user 1 changes his company from company A to company B. Then it raised an access error when a user 2 in company A tries to duplicate the invoice I because the responsible is in an other company. Now the responsible is not duplicated to avoid access error. opw:805573 --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 979e17690a8..1f92ac3e2be 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -312,7 +312,7 @@ class AccountInvoice(models.Model): payment_move_line_ids = fields.Many2many('account.move.line', string='Payment Move Lines', compute='_compute_payments', store=True) user_id = fields.Many2one('res.users', string='Salesperson', track_visibility='onchange', readonly=True, states={'draft': [('readonly', False)]}, - default=lambda self: self.env.user) + default=lambda self: self.env.user, copy=False) fiscal_position_id = fields.Many2one('account.fiscal.position', string='Fiscal Position', oldname='fiscal_position', readonly=True, states={'draft': [('readonly', False)]}) commercial_partner_id = fields.Many2one('res.partner', string='Commercial Entity', compute_sudo=True, From 710ce85c31f55ffb1d87c07baa73d4d3852db744 Mon Sep 17 00:00:00 2001 From: Maximilien Tantin Date: Tue, 16 Jan 2018 09:38:47 +0100 Subject: [PATCH 13/15] [FIX] website_sale: fix wizard_checkout when only services This commit display only 'Invoicing' if cart have only service. Set website_sale_order variable to get right context of order. This commit closes 22259 --- addons/website_sale/views/templates.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index d3083ea3c84..4bd9782cfb8 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -720,6 +720,7 @@