From 1ad8867deea179e3548f8f7619fd1bd11d1446ae Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 2 Jan 2018 15:46:30 +0100 Subject: [PATCH 01/50] [FIX] base: corrected automated action onchange and write When having an automated action which triggered upon changing a field to write on another (no python code, but operatiing with ir.server.object.lines) Before this commit, the onchange was not performed. This was because there was no active id (in fact the code did not take object() into consideration) After this commit, the onchange is performed. OPW 801424 --- odoo/addons/base/ir/ir_actions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/ir/ir_actions.py b/odoo/addons/base/ir/ir_actions.py index 993548e9c64..15a6371df88 100644 --- a/odoo/addons/base/ir/ir_actions.py +++ b/odoo/addons/base/ir/ir_actions.py @@ -851,7 +851,13 @@ class IrActionsServer(models.Model): else: ref_id = int(ref) - self.env[model].browse(ref_id).write(res) + if self._context.get('onchange_self'): + record_cached = self._context['onchange_self'] + for field, new_value in res.iteritems(): + record_cached[field] = new_value + else: + self.env[model].browse(ref_id).write(res) + @api.model def run_action_object_create(self, action, eval_context=None): @@ -975,6 +981,8 @@ class IrActionsServer(models.Model): elif hasattr(self, 'run_action_%s' % action.state): active_id = self._context.get('active_id') + if not active_id and self._context.get('onchange_self'): + active_id = self._context['onchange_self']._origin.id active_ids = self._context.get('active_ids', [active_id] if active_id else []) for active_id in active_ids: # run context dedicated to a particular active_id From ad78f115c31cf8cbe5cff5dbcbc766b5a0c3a0f9 Mon Sep 17 00:00:00 2001 From: "Yenthe V.G" Date: Tue, 9 Jan 2018 16:17:14 +0100 Subject: [PATCH 02/50] [ADD] doc: warning about function names in tests Closes #22116 --- doc/reference/testing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/reference/testing.rst b/doc/reference/testing.rst index bff45196390..0495e896d8b 100644 --- a/doc/reference/testing.rst +++ b/doc/reference/testing.rst @@ -75,6 +75,10 @@ in each method:: # other tests... +.. note:: + + Test methods must start with `test_` + Running tests ------------- From cd05c16641ef9e5f84dcb1d4af70a2caab464ecb Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 9 Jan 2018 12:59:49 +0100 Subject: [PATCH 03/50] [FIX] mrp: location_id domain on mrp.routing Steps to reproduce the bug: - Create a routing with a Product Location of type view - Create a MO with this routing - Click on "Plan" without clicking on "Check for Availability" - Complete the work orders - Go back to the MO and try to put it in state "Done" Bug: Impossible to set the MO on state "Done". By clicking on "Mark as Done", it returns: You cannot take products from or deliver products to a location of type "view" opw:803580 --- addons/mrp/views/mrp_routing_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/views/mrp_routing_views.xml b/addons/mrp/views/mrp_routing_views.xml index bd761c371f4..8ee1b962f8d 100644 --- a/addons/mrp/views/mrp_routing_views.xml +++ b/addons/mrp/views/mrp_routing_views.xml @@ -85,7 +85,7 @@ - + From eeea6e8667cfafc18e4966170d5dd6a6312aa40c Mon Sep 17 00:00:00 2001 From: "Yenthe V.G" Date: Tue, 9 Jan 2018 10:38:15 +0100 Subject: [PATCH 04/50] [FIX] website_blog: don't copy visitor count of blogpost This commit closes #22107 and closes #22111 --- addons/website_blog/models/website_blog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index 657ea5d8ff7..bc5de780976 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -133,7 +133,7 @@ class BlogPost(osv.Model): 'author_avatar': fields.related( 'author_id', 'image_small', string="Avatar", type="binary"), - 'visits': fields.integer('No of Views'), + 'visits': fields.integer('No of Views', copy=False), 'ranking': fields.function(_compute_ranking, string='Ranking', type='float'), } From f7323dbe2321558f96640d6643a8b593958d8a49 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 10 Jan 2018 12:32:54 +0100 Subject: [PATCH 05/50] [FIX] doc: informal sub-params Revert 6cb12273e2c1e1385098e38880317ae162dc902e which reverted 08d48b0fff0938e7ac004767dddfab13d3cff30b. Issue was the support for sub-parameters (aka @param {type} foo.bar) where the "parent" parameter was not formal (only present in a function's docstring, but not in the function's parameters list), subtype creation would fail to find a root parameter to attach the sub-parameter to. This has not actually been fixed, but for the specific case where the formal parameters list is *completely empty* we fall back on a list of the docstring's parameters, which works well enough for this case. --- addons/web_tour/static/src/js/tour_manager.js | 16 ++++++++-------- doc/_extensions/autojsdoc/ext/directives.py | 1 + doc/_extensions/autojsdoc/parser/jsdoc.py | 10 ++++++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index 1d89147f8a1..2bb3436f0b2 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -172,18 +172,18 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { /** * Registers a tour described by the following arguments *in order* * - * @param [string] name - tour's name - * @param [Object] - options (optional), available options are: - * @param [boolean] - true if this is only for tests - * @param [boolean] + * @param {string} name - tour's name + * @param {Object} [options] - options (optional), available options are: + * @param {boolean} [options.test=false] - true if this is only for tests + * @param {boolean} [options.skip_enabled=false] * true to add a link in its tips to consume the whole tour - * @param [string] + * @param {string} [options.url] * the url to load when manually running the tour - * @param [boolean] + * @param {boolean} [options.rainbowMan=true] * whether or not the rainbowman must be shown at the end of the tour - * @param [Deferred] + * @param {Deferred} [options.wait_for] * indicates when the tour can be started - * @param [Object] steps - steps' descriptions, each step being an object + * @param {Object[]} steps - steps' descriptions, each step being an object * containing a tip description */ register: function() { diff --git a/doc/_extensions/autojsdoc/ext/directives.py b/doc/_extensions/autojsdoc/ext/directives.py index 98b3f9e8322..d127e24725b 100644 --- a/doc/_extensions/autojsdoc/ext/directives.py +++ b/doc/_extensions/autojsdoc/ext/directives.py @@ -565,6 +565,7 @@ def extract_subtypes(parent_name, doc): 'name': typename, 'doc': param.doc, '_members': [ + # TODO: add default value (sub.name, jsdoc.PropertyDoc(dict(sub.to_dict(), sourcemodule=doc['sourcemodule']))) for sub in subs ], diff --git a/doc/_extensions/autojsdoc/parser/jsdoc.py b/doc/_extensions/autojsdoc/parser/jsdoc.py index a34a2aa9b83..55ec998c94f 100644 --- a/doc/_extensions/autojsdoc/parser/jsdoc.py +++ b/doc/_extensions/autojsdoc/parser/jsdoc.py @@ -122,8 +122,14 @@ class FunctionDoc(CommentDoc): @property def params(self): tag_texts = self.get_as_list('param') - if self.get('guessed_params') is None: - return [ParamDoc(text) for text in tag_texts] + # turns out guessed_params is *almost* (?) always set to a list, + # if empty list of guessed params fall back to @params + if not self['guessed_params']: + # only get "primary" params (no "." in name) + return [ + p for p in map(ParamDoc, tag_texts) + if '.' not in p.name + ] else: param_dict = {} for text in tag_texts: From eded3cfda8254034edf4fa86ddc11dce65b02f6c Mon Sep 17 00:00:00 2001 From: Paul Catinean Date: Wed, 10 Jan 2018 13:06:59 +0100 Subject: [PATCH 06/50] [FIX] website: check that website.user_id is not falsy This field should be required. This commits closes #21997 @kangol: diff in addons/website/models/ir_http.py is for existing db It can be ignored in master because required will be apply --- addons/website/models/ir_http.py | 2 +- addons/website/models/website.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index b8af335a17e..6b6f119fd88 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -40,7 +40,7 @@ class ir_http(orm.AbstractModel): def _auth_method_public(self): if not request.session.uid: website = self.pool['website'].get_current_website(request.cr, openerp.SUPERUSER_ID, context=request.context) - if website: + if website and website.user_id: request.uid = website.user_id.id else: request.uid = self.pool['ir.model.data'].xmlid_to_res_id(request.cr, openerp.SUPERUSER_ID, 'base', 'public_user') diff --git a/addons/website/models/website.py b/addons/website/models/website.py index aef827b86a8..b4b95f00ab5 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -166,7 +166,7 @@ class website(osv.osv): 'social_youtube': fields.char('Youtube Account'), 'social_googleplus': fields.char('Google+ Account'), 'google_analytics_key': fields.char('Google Analytics Key'), - 'user_id': fields.many2one('res.users', string='Public User'), + 'user_id': fields.many2one('res.users', string='Public User', required=True), 'compress_html': fields.boolean('Compress HTML'), 'cdn_activated': fields.boolean('Activate CDN for assets'), 'cdn_url': fields.char('CDN Base URL'), From 932ac72c7e0dc6617bbbf8ebfffc44783e31cf20 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 10 Jan 2018 13:03:48 +0100 Subject: [PATCH 07/50] [FIX] hr: correct action source model Should be from hr.employee At a8326cc6 source model inconsistence was introduced but the bug was revealed only after 55549f1e where it kept the wrong one Fixes #20203 PS: this action should be removed in master in favor of hr_org_chart module --- addons/hr/views/hr_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr/views/hr_views.xml b/addons/hr/views/hr_views.xml index be426aba38f..787b8ffa6e4 100644 --- a/addons/hr/views/hr_views.xml +++ b/addons/hr/views/hr_views.xml @@ -296,7 +296,7 @@ [('id','in',active_ids)] tree - + From 13baea56b949365f2df76704f346350d9e2ba5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Tue, 9 Jan 2018 14:59:51 +0100 Subject: [PATCH 08/50] [FIX] phone_valdation: fix default behaviour for numbers formatting before this commit, the selection on res.company was by default hiding the country prefix. THe option was not available on res.company view. We fix the default behaviour and add the option in the res.company view in debug mode. --- addons/phone_validation/__manifest__.py | 1 + addons/phone_validation/models/res_company.py | 2 +- .../phone_validation/views/res_company_view.xml | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 addons/phone_validation/views/res_company_view.xml diff --git a/addons/phone_validation/__manifest__.py b/addons/phone_validation/__manifest__.py index dc21476150f..2ebc99f3ead 100644 --- a/addons/phone_validation/__manifest__.py +++ b/addons/phone_validation/__manifest__.py @@ -16,6 +16,7 @@ formatting. This module applies this feature to Leads and Contacts.""", 'data': [ + 'views/res_company_view.xml' ], 'depends': ['base'], } diff --git a/addons/phone_validation/models/res_company.py b/addons/phone_validation/models/res_company.py index 66d68225246..2ee2c18d7bd 100644 --- a/addons/phone_validation/models/res_company.py +++ b/addons/phone_validation/models/res_company.py @@ -10,7 +10,7 @@ class ResCompany(models.Model): phone_international_format = fields.Selection([ ('no_prefix', 'No prefix'), ('prefix', 'Add international prefix'), - ],string="Local Numbers", default="no_prefix", + ], string="Local Numbers", default="prefix", help="Always encode phone numbers using international format. Otherwise " "numbers coming from the company's country are nationaly formatted. " "International numbers are always using international format." diff --git a/addons/phone_validation/views/res_company_view.xml b/addons/phone_validation/views/res_company_view.xml new file mode 100644 index 00000000000..d788e5aa7fe --- /dev/null +++ b/addons/phone_validation/views/res_company_view.xml @@ -0,0 +1,17 @@ + + + + + res.company.view.form.phone_validation + res.company + + + + + + + + From d9f1e6789a84cdb4c10d3a82486402946c6c8a31 Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Wed, 10 Jan 2018 15:40:16 +0100 Subject: [PATCH 09/50] [FIX] mail: Fix crash when adding recipient on mails When adding more than one recipients on mails a traceback appears. This was caused because instead of doing a name_get by providing the partners ids as a list, we send them as arguments. Which wasn't valid because name_get except a single argument. opw #804691 --- addons/mail/static/src/js/many2many_tags_email.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/many2many_tags_email.js b/addons/mail/static/src/js/many2many_tags_email.js index e11a147d8e1..e4638d41d28 100644 --- a/addons/mail/static/src/js/many2many_tags_email.js +++ b/addons/mail/static/src/js/many2many_tags_email.js @@ -48,7 +48,7 @@ BasicModel.include({ def = self._rpc({ model: list.model, method: 'name_get', - args: list.res_ids, + args: [list.res_ids], context: record.getContext({fieldName: fieldName}), }); } From 88fe132a2764b4999baa57385ec8c0038f176dfa Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 10 Jan 2018 15:07:37 +0100 Subject: [PATCH 10/50] [FIX] mail: Wrong title for the image's activity An activity is always created with sudo, so it's useless to set the image and the name of the "Administrator" all the time. Now the image and the title of the assigned person is displayed. opw:802759 --- addons/mail/static/src/xml/activity.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/xml/activity.xml b/addons/mail/static/src/xml/activity.xml index 6b5aaabe5e8..da3e63772a6 100644 --- a/addons/mail/static/src/xml/activity.xml +++ b/addons/mail/static/src/xml/activity.xml @@ -17,7 +17,7 @@
- +
From 8fb203f7c692c0262a579575127b429e858ff3a2 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 10 Jan 2018 21:55:05 +0100 Subject: [PATCH 11/50] [FIX] base: ir_ui_view unescape %% in dev mode In dev mode with xml feature, we read the xml from file directly. %% should be unescape to get % instead. --- odoo/addons/base/ir/ir_ui_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/ir/ir_ui_view.py b/odoo/addons/base/ir/ir_ui_view.py index 2bef251ab86..61d679f8d90 100644 --- a/odoo/addons/base/ir/ir_ui_view.py +++ b/odoo/addons/base/ir/ir_ui_view.py @@ -201,7 +201,7 @@ actual arch. fullpath = get_resource_path(*view.arch_fs.split('/')) arch_fs = get_view_arch_from_file(fullpath, view.xml_id) # replace %(xml_id)s, %(xml_id)d, %%(xml_id)s, %%(xml_id)d by the res_id - arch_fs = arch_fs and resolve_external_ids(arch_fs, view.xml_id) + arch_fs = arch_fs and resolve_external_ids(arch_fs, view.xml_id).replace('%%', '%') view.arch = arch_fs or view.arch_db def _inverse_arch(self): From ea90491789037dc6c36bd7977715cf3eaf71524c Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Thu, 11 Jan 2018 10:12:06 +0100 Subject: [PATCH 12/50] [FIX] mail: m2m tag email test fixed - The test for m2m tag email was not expecting an array as the result. --- addons/mail/static/tests/chatter_tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 53b1cde91b9..ebc28731c01 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -1115,7 +1115,7 @@ QUnit.test('fieldmany2many tags email', function (assert) { }, mockRPC: function (route, args) { if (route === "/web/dataset/call_kw/partner_type/name_get") { - assert.deepEqual(args.args, nameGottenIds.shift(), + assert.deepEqual(args.args[0], nameGottenIds.shift(), "partner with email should be name_get'ed"); } else if (args.method ==='read' && args.model === 'partner_type') { From 330f84f21138343782000d375b4ce8daeb8907c7 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 11 Jan 2018 10:46:31 +0100 Subject: [PATCH 13/50] [FIX] l10n_fr_fec: fix format of Debit/Credit columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Numeric columns of fixed length should be left padded with '0' instead of ' ' (Article A47 A-1 Section III 2°) --- addons/l10n_fr_fec/wizard/fec.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/l10n_fr_fec/wizard/fec.py b/addons/l10n_fr_fec/wizard/fec.py index 00440affe2e..673b450b789 100644 --- a/addons/l10n_fr_fec/wizard/fec.py +++ b/addons/l10n_fr_fec/wizard/fec.py @@ -43,8 +43,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -142,8 +142,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -227,8 +227,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -289,14 +289,14 @@ class AccountFrFec(models.TransientModel): AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL THEN '/' ELSE replace(aml.name, '|', '/') END AS EcritureLib, - replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit, CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet, CASE WHEN aml.full_reconcile_id IS NULL THEN '' ELSE TO_CHAR(rec.create_date, 'YYYYMMDD') END AS DateLet, TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, CASE WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' - ELSE replace(to_char(aml.amount_currency, '999999999999999D99'), '.', ',') + ELSE replace(to_char(aml.amount_currency, '000000000000000D99'), '.', ',') END AS Montantdevise, CASE WHEN aml.currency_id IS NULL THEN '' ELSE rc.name END AS Idevise FROM From cca12fbb08626094c24a245c5bf54dad2696fae7 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 10 Jan 2018 11:58:06 +0100 Subject: [PATCH 14/50] [FIX] payment_stripe: route receive wrong currency parameter This commit b335ae0348ac74b2edb6d5ea56cc230e276ef283 previously sent currency instead of currency_id on /website_payment/transaction route resulting in a cast error. Now, we send the currency_id as the route expect This closes #19468, closes #22165 --- addons/payment_stripe/static/src/js/stripe.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js index 14e19775747..9db27aea858 100644 --- a/addons/payment_stripe/static/src/js/stripe.js +++ b/addons/payment_stripe/static/src/js/stripe.js @@ -68,6 +68,7 @@ odoo.define('payment_stripe.stripe', function(require) { e.preventDefault(); if ($('.o_website_payment').length !== 0) { var currency = $("input[name='currency']").val(); + var currency_id = $("input[name='currency_id']").val(); var amount = parseFloat($("input[name='amount']").val() || '0.0'); if (!_.contains(int_currencies, currency)) { amount = amount*100; @@ -76,7 +77,7 @@ odoo.define('payment_stripe.stripe', function(require) { ajax.jsonRpc('/website_payment/transaction', 'call', { reference: $("input[name='invoice_num']").val(), amount: amount, - currency_id: currency, + currency_id: currency_id, acquirer_id: acquirer_id }) handler.open({ From 32701aa512cb0c382154d030436ca4d265e6e27f Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Tue, 2 Jan 2018 12:18:26 +0100 Subject: [PATCH 15/50] [FIX] website: menus with null URL would throw an error on display Before this commit, if a website.menu had a URL set to null, it would throw an error when displaying that menu. It is normally not possible to do so in v11 but after a migration, menus can be empty. (eg: Using an empty menu to display a divider in a dropdown menu) Now we return an empty url instead of an error --- addons/website/models/website.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index a4848313a9c..1b63929759e 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -815,7 +815,7 @@ class Menu(models.Model): url = self.page_id.sudo().url else: url = self.url - if not self.url.startswith('/'): + if url and not self.url.startswith('/'): if '@' in self.url: if not self.url.startswith('mailto'): url = 'mailto:%s' % self.url From 491404f053005b05d86b1a9b1c7b9705617ee521 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 10 Jan 2018 17:59:51 +0100 Subject: [PATCH 16/50] [FIX] website_event_track: day separation and tz An agenda for an event separates tracks by days and display them taking into account the event timezone. But when separating by day the timezone is not taken into account and a track could be displayed on the wrong day. opw-803610 closes #22170 --- addons/website_event_track/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website_event_track/controllers/main.py b/addons/website_event_track/controllers/main.py index 0ef57e418ff..296ba70ecc6 100644 --- a/addons/website_event_track/controllers/main.py +++ b/addons/website_event_track/controllers/main.py @@ -55,11 +55,13 @@ class WebsiteEventTrackController(http.Controller): @http.route(['''/event/ Date: Wed, 29 Nov 2017 13:52:43 +0100 Subject: [PATCH 17/50] [FIX] website: hide menu if related to an unpublished page Before this commit, if there was a menu entry linked to an unpublished website.page, the menu would be shown. For restricted users, they would land on a 403 forbidden. Now, we dont show website.page's menu if user can't access it. This closes #21328 --- addons/website/models/website.py | 8 ++++++++ addons/website/views/website_templates.xml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 1b63929759e..d314ef5c902 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -807,6 +807,14 @@ class Menu(models.Model): child_id = fields.One2many('website.menu', 'parent_id', string='Child Menus') parent_left = fields.Integer('Parent Left', index=True) parent_right = fields.Integer('Parent Rigth', index=True) + is_visible = fields.Boolean(compute='_compute_visible', string='Is Visible') + + @api.one + def _compute_visible(self): + visible = True + if self.page_id and not self.page_id.sudo().is_visible and not self.user_has_groups('base.group_user'): + visible = False + self.is_visible = visible @api.model def clean_url(self): diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index fbd817f25f2..fc4561c9980 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -67,14 +67,14 @@