From 94f58d647cebf3e573615c0f41a45a8a71b6aa71 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 12 Feb 2016 11:52:47 +0100 Subject: [PATCH 01/14] [FIX] auth_ldap: fix authentication with special chars encode the filter in utf-8 This prevents a UnicodeDecode error in python-ldap when the filter contains non ascii characters. opw-682783 closes #10899 closes #12710 --- addons/auth_ldap/users_ldap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/auth_ldap/users_ldap.py b/addons/auth_ldap/users_ldap.py index c920268643b..16084af80f2 100644 --- a/addons/auth_ldap/users_ldap.py +++ b/addons/auth_ldap/users_ldap.py @@ -102,7 +102,7 @@ class CompanyLDAP(osv.osv): _logger.warning('Could not format LDAP filter. Your filter should contain one \'%s\'.') return False try: - results = self.query(conf, filter) + results = self.query(conf, filter.encode('utf-8')) # Get rid of (None, attrs) for searchResultReference replies results = [i for i in results if i[0]] From 295f62741d8d416c7ce3f0af0825d5e80766ac9c Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 11 Jul 2016 18:07:05 +0200 Subject: [PATCH 02/14] [FIX] tools: cherry-pick of 0529a7f9 extract terms in correct folder If two addons path have a common part in the folder name (e.g. `/home/alice/dev` and `/home/alice/devodoo`), the `get_module_from_path` method may match the wrong folder. A file `/home/alice/devodoo/bob/models.py` would wrongly match `/home/alice/dev` path (due to the lack of separator) and the returned module would be `odoo` (`"odoo/bob/models.py".split('/')[0]`). In such scenario, the translations of files (code, static folder, report) would not be included in the exported translation file. Force the module path to ends with a folder separator to avoid wrong matching. Closes #13363 --- openerp/tools/translate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index 532d52e4f60..7099639debd 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -859,8 +859,9 @@ def trans_generate(lang, modules, cr): def get_module_from_path(path): for (mp, rec) in path_list: + mp = os.path.join(mp, '') if rec and path.startswith(mp) and os.path.dirname(path) != mp: - path = path[len(mp)+1:] + path = path[len(mp):] return path.split(os.path.sep)[0] return 'base' # files that are not in a module are considered as being in 'base' module From b83efd4c3dc950f6213f835caf8863676196ea57 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 28 Sep 2016 13:32:28 +0200 Subject: [PATCH 03/14] [FIX] google_drive: user_is_admin Oversight of commit e80f1152 which causes a crash since the variable is not defined anymore. opw-689353 --- addons/google_drive/google_drive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_drive/google_drive.py b/addons/google_drive/google_drive.py index 3cd7da3612d..73700abbdf3 100644 --- a/addons/google_drive/google_drive.py +++ b/addons/google_drive/google_drive.py @@ -67,7 +67,7 @@ class config(osv.Model): req = urllib2.Request('https://accounts.google.com/o/oauth2/token', data, headers) content = urllib2.urlopen(req, timeout=TIMEOUT).read() except urllib2.HTTPError: - if user_is_admin: + if self.pool['res.users']._is_admin(cr, uid, [uid]): model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base_setup', 'action_general_configuration') msg = _("Something went wrong during the token generation. Please request again an authorization code .") raise openerp.exceptions.RedirectWarning(msg, action_id, _('Go to the configuration panel')) From 7d3c8437afc88cff54e6bb70b67495b11e4e1643 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Wed, 28 Sep 2016 16:22:58 +0200 Subject: [PATCH 04/14] [FIX] discuss: supress the star button on '/help' bot. (#13626) A traceback was generated when starring the '/help' bot. opw-681626 --- addons/mail/static/src/js/chat_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index b58d35e61ed..8355162fb1b 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -127,7 +127,8 @@ function make_message (data) { subtype_description: data.subtype_description, is_author: data.author_id && data.author_id[0] === session.partner_id, is_note: data.is_note, - is_system_notification: data.message_type === 'notification' && data.model === 'mail.channel', + is_system_notification: (data.message_type === 'notification' && data.model === 'mail.channel') + || data.info === 'transient_message', attachment_ids: data.attachment_ids || [], subject: data.subject, email_from: data.email_from, From a16f307e8556087e1e3b7bcc23029d0544376425 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Wed, 28 Sep 2016 16:24:24 +0200 Subject: [PATCH 05/14] [FIX] stock_account: restore the 'Account Stock Properties' (#13620) The 'Account Stock Properties' didn't appear when looking the infos in a product category. opw-688143 --- addons/stock_account/product_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/product_view.xml b/addons/stock_account/product_view.xml index 3c6b8072702..ddcc6bbe4be 100644 --- a/addons/stock_account/product_view.xml +++ b/addons/stock_account/product_view.xml @@ -8,7 +8,7 @@ - + From 349e873f8e1c2bc5503433e8c37bf62889225a2a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 29 Sep 2016 08:27:13 +0200 Subject: [PATCH 06/14] [IMP] l10n_be: fully translate CoA in Dutch --- addons/l10n_be/i18n_extra/nl_BE.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be/i18n_extra/nl_BE.po b/addons/l10n_be/i18n_extra/nl_BE.po index 4516f76832a..d40cd32f598 100644 --- a/addons/l10n_be/i18n_extra/nl_BE.po +++ b/addons/l10n_be/i18n_extra/nl_BE.po @@ -701,7 +701,7 @@ msgstr "R.S.Z. 4de kwartaal" #. module: l10n_be #: model:account.account.template,name:l10n_be.a4540 msgid "ONSS. Arriérés" -msgstr "" +msgstr "Achterstallige bijdragen RSZ" #. module: l10n_be #: model:account.account.template,name:l10n_be.a4553 @@ -879,7 +879,7 @@ msgstr "Waardeverminderingen op voorraden" #. module: l10n_be #: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_4 msgid "Régime Cocontractant" -msgstr "" +msgstr "Medecontractant" #. module: l10n_be #: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_2 From 6c79cfa83d7b121d79363511d7c1a6f27248c86d Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 29 Sep 2016 10:19:45 +0200 Subject: [PATCH 07/14] [FIX] stock_account: copy the analytic account on the COGS entry in anglo-saxon mode. OPW Ticket: 688456 --- addons/stock_account/stock_account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 4b9d5c8a843..4edaa4352cf 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -89,7 +89,7 @@ class account_invoice(osv.osv): 'account_id':dacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id, - 'account_analytic_id': False, + 'account_analytic_id': i_line.account_analytic_id.id, }, { @@ -101,7 +101,7 @@ class account_invoice(osv.osv): 'account_id':cacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id, - 'account_analytic_id': False, + 'account_analytic_id': i_line.account_analytic_id.id, }, ] return [] From 14fd32bd0850370ccdb6fffda26839279eb93c4f Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Thu, 29 Sep 2016 10:53:01 +0200 Subject: [PATCH 08/14] [FIX] web: prevent a crash when clicking on 'more' button (#13630) A traceback is generated when a user clicks on 'more' button in settings to see the pending invitations. That was caused by a missing check condition. backport of saas-13 commit 2fdf631 opw-689597 --- addons/web/static/src/js/control_panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/control_panel.js b/addons/web/static/src/js/control_panel.js index dd21d8d735e..5c7d206e777 100644 --- a/addons/web/static/src/js/control_panel.js +++ b/addons/web/static/src/js/control_panel.js @@ -196,7 +196,7 @@ var ControlPanel = Widget.extend({ _render_breadcrumbs_li: function (bc, index, length) { var self = this; var is_last = (index === length-1); - var li_content = _.escape(bc.title.trim()) || data.noDisplayContent; + var li_content = bc.title && _.escape(bc.title.trim()) || data.noDisplayContent; var $bc = $('
  • ') .append(is_last ? li_content : $('').html(li_content)) .toggleClass('active', is_last); From dd28f9bf78c35c878eaf35622212e5a40f90fa40 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 29 Sep 2016 15:06:38 +0200 Subject: [PATCH 09/14] [FIX] website_quote: /quote/ redirects to login when not signed in and no token When the route /quote/ is accessed without token e.g. through the `View sales Order` button in the headers of thread mails the user must be redirected to the login screen if he's not signed in. In other words, you must be signed in to access this route without token. opw-687931 --- addons/website_quote/controllers/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index a5e7b6c85ac..49e9628bf77 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -13,10 +13,11 @@ from openerp.addons.website_mail.controllers.main import _message_post_helper class sale_quote(http.Controller): - @http.route([ - "/quote/", - "/quote//" - ], type='http', auth="public", website=True) + @http.route("/quote/", type='http', auth="user", website=True) + def view_user(self, *args, **kwargs): + return self.view(*args, **kwargs) + + @http.route("/quote//", type='http', auth="public", website=True) def view(self, order_id, pdf=None, token=None, message=False, **post): # use SUPERUSER_ID allow to access/view order for public user # only if he knows the private token From ffd009a5044ac668b2094b4a2abe884670356008 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 29 Sep 2016 15:47:34 +0200 Subject: [PATCH 10/14] [FIX] stock_acount: copy analytic tags on COGS entry --- addons/stock_account/stock_account.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 1b59afdc74b..0f927b43561 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -88,7 +88,8 @@ class account_invoice(osv.osv): 'account_id':dacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id, - 'account_analytic_id': False, + 'account_analytic_id': i_line.account_analytic_id.id, + 'analytic_tag_ids': i_line.analytic_tag_ids.ids and [(6, 0, i_line.analytic_tag_ids.ids)] or False, }, { @@ -100,7 +101,8 @@ class account_invoice(osv.osv): 'account_id':cacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id, - 'account_analytic_id': False, + 'account_analytic_id': i_line.account_analytic_id.id, + 'analytic_tag_ids': i_line.analytic_tag_ids.ids and [(6, 0, i_line.analytic_tag_ids.ids)] or False, }, ] return [] From 204c75939a39222e0cefbfc589704993a332309b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 30 Sep 2016 11:48:16 +0200 Subject: [PATCH 11/14] [FIX] sale: always set fiscal position An issue occurs in the following case: - create a SO - set a partner for which a fiscal position applies - change the partner to a partner for which no fiscal position applies The fiscal position set in a first place remains. This is a major issue when interacting with the eCommerce, since a fiscal position can be first set based on the GeoIP results, then might need to be removed when the user fills in his address details. opw-689281 --- addons/sale/sale.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index a3b839fd781..0fb533a8254 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -178,9 +178,7 @@ class SaleOrder(models.Model): """ Trigger the change of fiscal position when the shipping address is modified. """ - fiscal_position = self.env['account.fiscal.position'].get_fiscal_position(self.partner_id.id, self.partner_shipping_id.id) - if fiscal_position: - self.fiscal_position_id = fiscal_position + self.fiscal_position_id = self.env['account.fiscal.position'].get_fiscal_position(self.partner_id.id, self.partner_shipping_id.id) return {} @api.multi From b2b85fbb19ba681b64f50d3e503d1297191a57cf Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 30 Sep 2016 11:52:51 +0200 Subject: [PATCH 12/14] [FIX] website_sale: recompute fiscal position Following commit 6006c0d72a6, the shipping address can be changed after the call to `checkout_form_save`. This is the case, for example, when the user has the same shipping and invoicing address. We need to make sure to recompute the fiscal position after the shipping address is finally set. opw-689281 --- addons/website_sale/controllers/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 93f1cccb2ee..eb25f657b8b 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -644,9 +644,6 @@ class website_sale(http.Controller): if checkout.get('shipping_id'): order.write({'partner_shipping_id': checkout['shipping_id']}) - order_obj.onchange_partner_shipping_id(cr, SUPERUSER_ID, [order.id], context=context) - order.order_line._compute_tax_id() - order_info = { 'message_partner_ids': [(4, partner_id), (3, request.website.partner_id.id)], } @@ -689,6 +686,9 @@ class website_sale(http.Controller): if not int(post.get('shipping_id', 0)): order.partner_shipping_id = order.partner_invoice_id + order.onchange_partner_shipping_id() + order.order_line._compute_tax_id() + request.session['sale_last_order_id'] = order.id request.website.sale_get_order(update_pricelist=True, context=context) From 00aab045b0e0b769cea6e0a152a30a33de64e2ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 30 Sep 2016 12:06:27 +0200 Subject: [PATCH 13/14] [FIX] sale: fix context update wrongly migrated / updated at 94716a3f14d929574c46ef165e4364d12a5903ed Purpose of the code is to automatically add the recipients of quotation emails as followers. It is done using the mail_post_autofollow context key. However current code add the context key in all cases and not just when composing a message on sale order. --- addons/sale/sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0fb533a8254..29b12b5f111 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -810,7 +810,8 @@ class MailComposeMessage(models.TransientModel): order = self.env['sale.order'].browse([self._context['default_res_id']]) if order.state == 'draft': order.state = 'sent' - return super(MailComposeMessage, self.with_context(mail_post_autofollow=True)).send_mail(auto_commit=auto_commit) + self = self.with_context(mail_post_autofollow=True) + return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit) class AccountInvoice(models.Model): From c8ca71fc62b44dbb6ba9eebf9091dae87c723cf4 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 30 Sep 2016 11:43:30 +0200 Subject: [PATCH 14/14] [IMP] stock_account: stock_history slow read_group On a given instance with 600 000 stock.history, the query changed by this commit takes: - before this change => 32 minutes - after this change => 20 seconds opw-685747 --- addons/stock_account/wizard/stock_valuation_history.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index a7c31e2381a..65169c6dc13 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -56,11 +56,11 @@ class stock_history(osv.osv): for ids in group_lines.values(): for product_id in ids: line_ids.add(product_id) - line_ids = list(line_ids) lines_rec = {} if line_ids: - cr.execute('SELECT id, product_id, price_unit_on_quant, company_id, quantity FROM stock_history WHERE id in %s', (tuple(line_ids),)) - lines_rec = cr.dictfetchall() + move_ids = tuple(abs(line_id) for line_id in line_ids) + cr.execute('SELECT id, product_id, price_unit_on_quant, company_id, quantity FROM stock_history WHERE move_id in %s', (move_ids,)) + lines_rec = tuple(rec for rec in cr.dictfetchall() if rec['id'] in line_ids) lines_dict = dict((line['id'], line) for line in lines_rec) product_ids = list(set(line_rec['product_id'] for line_rec in lines_rec)) products_rec = self.pool['product.product'].read(cr, uid, product_ids, ['cost_method', 'id'], context=context)