From f13cab6aa6d3181336abbfbe52dbc6330dab6fc2 Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Wed, 25 Oct 2017 15:31:58 +0200 Subject: [PATCH 01/10] [FIX] website_mail_channel: unsubscription Fixes 27280fefa9e7cad0143aca688149f19ebdb684f6: * `partner_id` is an `int` not a recordset * qweb Response is lazy (the template is only looked up and rendered when we actually need to send the content over the wire) => the error would occur outside of the try..except block. Force rendering (`Response.flatten`) so we can handle the issue here * Uses the HttpCase interface to contact the server over a new socket (same as tours & al) because using `werkzeug.test.Client` would not use the correct cursor (?) and so the test data would not be visible --- .../website_mail_channel/controllers/main.py | 14 ++-- addons/website_mail_channel/tests/__init__.py | 2 + .../tests/test_unsubscribe.py | 71 +++++++++++++++++++ 3 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 addons/website_mail_channel/tests/__init__.py create mode 100644 addons/website_mail_channel/tests/test_unsubscribe.py diff --git a/addons/website_mail_channel/controllers/main.py b/addons/website_mail_channel/controllers/main.py index 4a9e2c449a8..3aa9491bf54 100644 --- a/addons/website_mail_channel/controllers/main.py +++ b/addons/website_mail_channel/controllers/main.py @@ -228,15 +228,19 @@ class MailGroup(http.Controller): def confirm_unsubscribe(self, channel, partner_id, token, **kw): subscriber = request.env['mail.channel.partner'].search([('channel_id', '=', channel.id), ('partner_id', '=', partner_id)]) if not subscriber: + partner = request.env['res.partner'].browse(partner_id).sudo().exists() # FIXME: remove try/except in master try: - return request.render( - 'website_mail_channel.not_subscribed', { - 'partner_id': partner_id - }) + response = request.render( + 'website_mail_channel.not_subscribed', + {'partner_id': partner}) + # make sure the rendering (and thus error if template is + # missing) happens inside the try block + response.flatten() + return response except ValueError: return _("The address %s is already unsubscribed or was never subscribed to any mailing list") % ( - partner_id.email + partner.email ) subscriber_token = channel._generate_action_token(partner_id, action='unsubscribe') diff --git a/addons/website_mail_channel/tests/__init__.py b/addons/website_mail_channel/tests/__init__.py new file mode 100644 index 00000000000..2e3364d701d --- /dev/null +++ b/addons/website_mail_channel/tests/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import test_unsubscribe diff --git a/addons/website_mail_channel/tests/test_unsubscribe.py b/addons/website_mail_channel/tests/test_unsubscribe.py new file mode 100644 index 00000000000..44128c30b86 --- /dev/null +++ b/addons/website_mail_channel/tests/test_unsubscribe.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +import requests + +from odoo.api import Environment +from odoo.tests import common +from odoo.tools.misc import mute_logger + + +class TestConfirmUnsubscribe(common.HttpCase): + def setUp(self): + super(TestConfirmUnsubscribe, self).setUp() + + cr = self.registry.cursor() + # apparently HttpCase does not properly update self.env? + self.env2 = env = Environment(cr, self.uid, {}) + self.partner = env['res.partner'].create({ + 'name': 'Bob', + 'email': 'bob@bob.bob' + }) + self.mailing_list = env['mail.channel'].create({ + 'name': 'Test Mailing List', + 'public': 'public', + }) + self.token = self.mailing_list._generate_action_token(self.partner.id, action='unsubscribe') + + def test_not_subscribed(self): + """Test warning works""" + self.env2.cr.release() + + self._unsubscribe_check("The address %s is already unsubscribed" % self.partner.email) + + @mute_logger('odoo.addons.website.models.ir_ui_view') + def test_not_subscribed_no_template(self): + """ Test warning works on db without template (code update w/o module update) """ + self.env2.ref('website_mail_channel.not_subscribed').unlink() + self.assertEquals( + self.env2['ir.model.data'].search_count([ + ('module', '=', 'website_mail_channel'), + ('name', '=', 'not_subscribed'), + ]), 0, 'XID for template should have been deleted') + self.env2.cr.release() + + self._unsubscribe_check("The address %s is already unsubscribed or was never subscribed to any mailing list" % self.partner.email) + + def test_wrong_token(self): + self.mailing_list.sudo().write({ + 'channel_partner_ids': [(4, self.partner.id, False)] + }) + self.env2.cr.release() + self.token = 'XXX' + + self._unsubscribe_check("Invalid or expired confirmation link.") + + def test_successful_unsubscribe(self): + self.mailing_list.sudo().write({ + 'channel_partner_ids': [(4, self.partner.id, False)] + }) + self.env2.cr.release() + + self._unsubscribe_check("You have been correctly unsubscribed") + + def _unsubscribe_check(self, text): + url = "/groups/unsubscribe/{}/{}/{}".format( + self.mailing_list.id, self.partner.id, + self.token + ) + # FIXME: may need to be altered during 11.0 forward port + r = self.url_open(url) + body = r.read().decode('utf-8') + # normalize space to make matching simpler + self.assertIn(text, u' '.join(body.split())) From 505a7f853fd6b9574d41b2701480ed2f06e58e6d Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Tue, 24 Oct 2017 13:47:17 +0200 Subject: [PATCH 02/10] [ADD] account_tax_cash_basis: add hook to change the cash basis base amount account To be able to retrieve the base amount of cash basis taxes lines, an additional move is created. However, this additional move contains a several lines that are considered as pollution in reports. This hook allows to move these additional lines to an another account if needed. -task: https://www.odoo.com/web#id=35605&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720 --- .../models/account_partial_reconcile.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/account_tax_cash_basis/models/account_partial_reconcile.py b/addons/account_tax_cash_basis/models/account_partial_reconcile.py index a95e355b68f..67d7351da08 100644 --- a/addons/account_tax_cash_basis/models/account_partial_reconcile.py +++ b/addons/account_tax_cash_basis/models/account_partial_reconcile.py @@ -9,6 +9,15 @@ from odoo.tools import float_is_zero class AccountPartialReconcileCashBasis(models.Model): _inherit = 'account.partial.reconcile' + def _get_tax_cash_basis_base_account(self, line, tax): + ''' Get the account of lines that will contain the base amount of taxes. + + :param line: An account.move.line record + :param tax: An account.tax record + :return: An account record + ''' + return line.account_id + def _get_tax_cash_basis_lines(self, value_before_reconciliation): # Search in account_move if we have any taxes account move lines tax_group = {} @@ -44,11 +53,12 @@ class AccountPartialReconcileCashBasis(models.Model): total_by_cash_basis_account[key] = amount if any([tax.use_cash_basis for tax in line.tax_ids]): for tax in line.tax_ids: + account_id = self._get_tax_cash_basis_base_account(line, tax) line_to_create.append((0, 0, { 'name': '/', 'debit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage), 'credit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage), - 'account_id': line.account_id.id, + 'account_id': account_id.id, 'tax_ids': [(6, 0, [tax.id])], 'tax_exigible': True, })) @@ -56,7 +66,7 @@ class AccountPartialReconcileCashBasis(models.Model): 'name': '/', 'credit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage), 'debit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage), - 'account_id': line.account_id.id, + 'account_id': account_id.id, 'tax_exigible': True, })) From 365362a4a0d86701d6f991b3917528d02923b22d Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 13 Oct 2017 17:02:52 +0200 Subject: [PATCH 03/10] [FIX] mrp: on rereserve of mo, we can unlink stock.move.lots On rereservation of an mo, it will remove the existing stock.move.lots if no quantity was done on them. We wanted to avoid however that it would remove the temporary stock.move.lots on the workorder. On the normal ones however, there is also a workorder_id. That way it would not unlink stock.move.lots when you had workorders. By checking the temporary or not flag (done_wo) instead of workorder_id, we solve the issue. Courtesy of blaggacao fixes #19422 --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 183bd0dc1c6..dba5d5cd0d3 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -161,7 +161,7 @@ class StockMove(models.Model): def create_lots(self): lots = self.env['stock.move.lots'] for move in self: - unlink_move_lots = move.move_lot_ids.filtered(lambda x : (x.quantity_done == 0) and not x.workorder_id) + unlink_move_lots = move.move_lot_ids.filtered(lambda x : (x.quantity_done == 0) and x.done_wo) unlink_move_lots.sudo().unlink() group_new_quant = {} old_move_lot = {} From 4a3801bc58a38551fba59c9830b68a582e4857c1 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 26 Oct 2017 11:10:13 +0200 Subject: [PATCH 04/10] [FIX] google_calendar: allow to use the function number_of_week for synchro get_param return string, but timedelta wait a integer --- addons/google_calendar/google_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index 48950928199..39f4a075ba5 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -954,7 +954,7 @@ class google_calendar(osv.AbstractModel): def get_minTime(self, cr, uid, context=None): number_of_week = int(self.pool['ir.config_parameter'].get_param(cr, uid, 'calendar.week_synchro', default=13)) - return datetime.now() - timedelta(weeks=number_of_week) + return datetime.now() - timedelta(weeks=int(number_of_week)) def get_need_synchro_attendee(self, cr, uid, context=None): return self.pool['ir.config_parameter'].get_param(cr, uid, 'calendar.block_synchro_attendee', default=True) From b80b13a572e478192e09715b68cdbe0404b196ee Mon Sep 17 00:00:00 2001 From: Pierre Rousseau Date: Thu, 26 Oct 2017 10:22:21 +0200 Subject: [PATCH 05/10] [FIX] l10n_fr_fec: change EcritureNum opw-777652 --- addons/l10n_fr_fec/wizard/fec.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/l10n_fr_fec/wizard/fec.py b/addons/l10n_fr_fec/wizard/fec.py index 1b1ddf20e9b..d56762b537c 100644 --- a/addons/l10n_fr_fec/wizard/fec.py +++ b/addons/l10n_fr_fec/wizard/fec.py @@ -5,6 +5,8 @@ from openerp import models, fields, api, _ from openerp.exceptions import Warning +from datetime import datetime +from openerp.tools import DEFAULT_SERVER_DATE_FORMAT import base64 import StringIO import csv @@ -32,7 +34,7 @@ class AccountFrFec(models.TransientModel): SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, - 'Balance initiale PL' AS EcritureNum, + 'OUVERTURE/' || %s AS EcritureNum, %s AS EcritureDate, '120/129' AS CompteNum, 'Benefice (perte) reporte(e)' AS CompteLib, @@ -66,8 +68,10 @@ class AccountFrFec(models.TransientModel): ''' company = self.env.user.company_id formatted_date_from = self.date_from.replace('-', '') + date_from = datetime.strptime(self.date_from, DEFAULT_SERVER_DATE_FORMAT) + formatted_date_year = date_from.year self._cr.execute( - sql_query, (formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) listrow = [] row = self._cr.fetchone() listrow = list(row) @@ -129,7 +133,7 @@ class AccountFrFec(models.TransientModel): SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, - 'Balance initiale ' || MIN(aa.name) AS EcritureNum, + 'OUVERTURE/' || %s AS EcritureNum, %s AS EcritureDate, MIN(aa.code) AS CompteNum, replace(MIN(aa.name), '|', '/') AS CompteLib, @@ -169,8 +173,10 @@ class AccountFrFec(models.TransientModel): HAVING sum(aml.balance) != 0 ''' formatted_date_from = self.date_from.replace('-', '') + date_from = datetime.strptime(self.date_from, DEFAULT_SERVER_DATE_FORMAT) + formatted_date_year = date_from.year self._cr.execute( - sql_query, (formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) for row in self._cr.fetchall(): listrow = list(row) From e653798d5c7e2de957ab35903e54b5998b0418b2 Mon Sep 17 00:00:00 2001 From: "Benjamin Willig (ACSONE)" Date: Thu, 26 Oct 2017 16:01:56 +0200 Subject: [PATCH 06/10] [FIX] hr_expense: allow inheritance when adding followers (#20319) --- addons/hr_expense/models/hr_expense.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index ee75dae5c52..f4cb1a69c9d 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -420,13 +420,7 @@ class HrExpenseSheet(models.Model): @api.model def create(self, vals): - # Add the followers at creation, so they can be notified - if vals.get('employee_id'): - employee = self.env['hr.employee'].browse(vals['employee_id']) - users = self._get_users_to_subscribe(employee=employee) - self.env.user - vals['message_follower_ids'] = [] - for partner in users.mapped('partner_id'): - vals['message_follower_ids'] += self.env['mail.followers']._add_follower_command(self._name, [], {partner.id: None}, {})[0] + self._create_set_followers(vals) sheet = super(HrExpenseSheet, self).create(vals) self.check_consistency() return sheet @@ -478,6 +472,20 @@ class HrExpenseSheet(models.Model): users = self._get_users_to_subscribe() self.message_subscribe_users(user_ids=users.ids) + @api.model + def _create_set_followers(self, values): + # Add the followers at creation, so they can be notified + employee_id = values.get('employee_id') + if not employee_id: + return + + employee = self.env['hr.employee'].browse(employee_id) + users = self._get_users_to_subscribe(employee=employee) - self.env.user + values['message_follower_ids'] = [] + MailFollowers = self.env['mail.followers'] + for partner in users.mapped('partner_id'): + values['message_follower_ids'] += MailFollowers._add_follower_command(self._name, [], {partner.id: None}, {})[0] + @api.onchange('employee_id') def _onchange_employee_id(self): self.address_id = self.employee_id.address_home_id From a44954b625132fea74e1bacd2ef6334f6645ca79 Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Wed, 25 Oct 2017 16:14:46 +0200 Subject: [PATCH 07/10] [FIX] sale: pricelist recursion in without_discount Supplements https://github.com/odoo/odoo/commit/0d56dca When basing a pricelist on another pricelist in different currency conversion was not being made correctly, since commit https://github.com/odoo/odoo/commit/6b3a808 that changes the pricelist_item on which the currency_id is set in _get_real_price_currency. Also align the _get_display_price's base_price to the _onchange_discount's new_list_price in the case where the pricelist depends on other pricelists that are in without_discount mode as well. --- addons/sale/models/sale.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index a235937c3a0..6e68fdad57a 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -851,14 +851,11 @@ class SaleOrderLine(models.Model): if self.order_id.pricelist_id.discount_policy == 'with_discount': return product.with_context(pricelist=self.order_id.pricelist_id.id).price final_price, rule_id = self.order_id.pricelist_id.get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id) - pricelist_item = self.env['product.pricelist.item'].browse(rule_id) - if pricelist_item.base == 'pricelist': - base_price, rule_id = pricelist_item.base_pricelist_id.get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id) - base_price = pricelist_item.base_pricelist_id.currency_id.compute(base_price, self.order_id.pricelist_id.currency_id) - else: - base_price = product[pricelist_item.base] if pricelist_item else product.lst_price - base_price = product.currency_id.compute(base_price, self.order_id.pricelist_id.currency_id) - # negative discounts (= surcharge) are included in the display price (= unit price) + context_partner = dict(self.env.context, partner_id=self.order_id.partner_id.id, date=self.order_id.date_order) + base_price, currency_id = self.with_context(context_partner)._get_real_price_currency(self.product_id, rule_id, self.product_uom_qty, self.product_uom, self.order_id.pricelist_id.id) + if currency_id != self.order_id.pricelist_id.currency_id.id: + base_price = self.env['res.currency'].browse(currency_id).with_context(context_partner).compute(base_price, self.order_id.pricelist_id.currency_id) + # negative discounts (= surcharge) are included in the display price return max(base_price, final_price) @api.multi @@ -1004,8 +1001,8 @@ class SaleOrderLine(models.Model): new_list_price = self.env['account.tax']._fix_tax_included_price_company(new_list_price, self.product_id.taxes_id, self.tax_id, self.company_id) if new_list_price != 0: - if self.product_id.company_id and self.order_id.pricelist_id.currency_id != self.product_id.company_id.currency_id: - # new_list_price is in company's currency while price in pricelist currency + if self.order_id.pricelist_id.currency_id.id != currency_id: + # we need new_list_price in the same currency as price, which is in the SO's pricelist's currency new_list_price = self.env['res.currency'].browse(currency_id).with_context(context_partner).compute(new_list_price, self.order_id.pricelist_id.currency_id) discount = (new_list_price - price) / new_list_price * 100 if discount > 0: From 9dee7d1e58eb555eed1f3dbc5be396eed3ec2d7f Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Wed, 25 Oct 2017 17:52:59 +0200 Subject: [PATCH 08/10] [FIX] sale: pricelist without_discount included taxes When having a product with included taxes that are changed/removed with a fiscal position, the price changes depending on if the pricelist's discount_policy is with_discount or without_discount. This commit aligns the without_discount behavior to the with_discount behavior. Note: the behaviour isn't 100% correct. The applied discount will be computed on the list_price, instead of the tax excluded list_price. If a price_surcharge is set, it will be wrong. --- addons/sale/models/sale.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 6e68fdad57a..40ce0e98088 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -998,7 +998,6 @@ class SaleOrderLine(models.Model): price, rule_id = self.order_id.pricelist_id.with_context(pricelist_context).get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id) new_list_price, currency_id = self.with_context(context_partner)._get_real_price_currency(self.product_id, rule_id, self.product_uom_qty, self.product_uom, self.order_id.pricelist_id.id) - new_list_price = self.env['account.tax']._fix_tax_included_price_company(new_list_price, self.product_id.taxes_id, self.tax_id, self.company_id) if new_list_price != 0: if self.order_id.pricelist_id.currency_id.id != currency_id: From ab9b5a13e4a610ae74a633e989620d5c3da240be Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 26 Oct 2017 17:23:14 +0200 Subject: [PATCH 09/10] [FIX] l10n_ca: default stock input account for products categories Since Odoo 8.0, the default stock input account for product categories in the Canadian localization is set to `214100 CANADA REVENUE AGENCY` This is the case since this commit: https://github.com/odoo/odoo/commit/13dacd11c10dac853def763432829b8976604a7d#diff-2e65e26a4efc4ab95e72dbe2033141ecL294 In which the account with the XML ID 2141_en 214100 Stock Received But Not Billed has been renamed 214100 CANADA REVENUE AGENCY In this very same commit, the account "Stock Received But Not Billed" has been moved to the account 217100, under the XML ID chart2171_en: https://github.com/odoo/odoo/commit/13dacd11c10dac853def763432829b8976604a7d#diff-2e65e26a4efc4ab95e72dbe2033141ecR447 While the default value for the products categories stock input account remained the same, the account with as code 2141: https://github.com/odoo/odoo/blob/8.0/addons/l10n_ca/account_chart_template_en.xml#L8 This is an oversight. It was not meant that way. The default stock input account for products should well be "Stock Received But Not Billed". In addition, a stock account is supposed to be of type assets, and not of type liabilities. I contacted @max3903, who was a contributor of the l10n_ca localization, and who is therefore a better expert than me regarding the Canadian localization. He confirmed me all the above findings. opw-775413 --- addons/l10n_ca/account_chart.xml | 2 +- addons/l10n_ca/account_chart_template_after.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_ca/account_chart.xml b/addons/l10n_ca/account_chart.xml index 0a463374290..8610079a78f 100644 --- a/addons/l10n_ca/account_chart.xml +++ b/addons/l10n_ca/account_chart.xml @@ -217,7 +217,7 @@ 2171 - + Stock Received But Not Billed diff --git a/addons/l10n_ca/account_chart_template_after.xml b/addons/l10n_ca/account_chart_template_after.xml index ccf130b9f0e..815fcea8b59 100644 --- a/addons/l10n_ca/account_chart_template_after.xml +++ b/addons/l10n_ca/account_chart_template_after.xml @@ -9,7 +9,7 @@ - + From 809aaf9e7b9de28383444d5059b19a67bb513f51 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 26 Oct 2017 17:02:14 +0200 Subject: [PATCH 10/10] [FIX] website_event: avoid double subscription Before this commit, you was able to double click on the button when are in registration flow. In this case, you subscribe 2 times and so take 2x more seats, what can be annoying when you have a limited room. In the same time, we fix the form in the form that generate strange behaviour like some events not bubbled correctly. The attendee form (into the modal) was inside the registration form. $'attendee_form).on('submit') obviously failed due to this bad dom. This commit closes opw-778191 --- addons/website/static/src/js/website.js | 2 +- addons/website_event/static/src/js/website_event.js | 4 +++- addons/website_event/views/website_event.xml | 4 ++-- .../views/website_event_questions_templates.xml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 4e5b805fa8c..c353590510e 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -228,7 +228,7 @@ base.ready().then(function () { init_kanban(this); }); - $('.js_website_submit_form').on('submit', function() { + $('body').on('submit', '.js_website_submit_form', function() { var $buttons = $(this).find('button[type="submit"], a.a-submit'); _.each($buttons, function(btn) { $(btn).attr('data-loading-text', ' ' + $(btn).text()).button('loading'); diff --git a/addons/website_event/static/src/js/website_event.js b/addons/website_event/static/src/js/website_event.js index 3b2248742a9..b5a31ae7950 100644 --- a/addons/website_event/static/src/js/website_event.js +++ b/addons/website_event/static/src/js/website_event.js @@ -9,6 +9,7 @@ $(document).ready(function () { .off('click') .removeClass('a-submit') .click(function (ev) { + $(this).attr('disabled', true); ev.preventDefault(); ev.stopPropagation(); var $form = $(ev.currentTarget).closest('form'); @@ -18,7 +19,8 @@ $(document).ready(function () { }); ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) { var $modal = $(modal); - $modal.appendTo($form).modal(); + $modal.find('.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19 + $modal.after($form).modal(); $modal.on('click', '.js_goto_event', function () { $modal.modal('hide'); }); diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index 69701ce0056..a1c7e8e0588 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -441,7 +441,7 @@