From 47cc4fbbab6e532b056fee26542283bd65978ac7 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 15 May 2018 10:58:59 +0200 Subject: [PATCH 1/4] [FIX] auth_signup: add missing dependency on the computation of the signup validity The field signup_valid is a non stored computed field based on signup_token. The cache is filled with prefetched values, so in a loop the field is read from the cache and not recomputed due to the missing dependency. opw 1843442 --- addons/auth_signup/models/res_partner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/auth_signup/models/res_partner.py b/addons/auth_signup/models/res_partner.py index d2bad560398..cb253555a45 100644 --- a/addons/auth_signup/models/res_partner.py +++ b/addons/auth_signup/models/res_partner.py @@ -33,6 +33,7 @@ class ResPartner(models.Model): signup_url = fields.Char(compute='_compute_signup_url', string='Signup URL') @api.multi + @api.depends('signup_token', 'signup_expiration') def _compute_signup_valid(self): dt = now() for partner in self: From 9db6dfa25df26b340176b43d4c7df9d004b27afb Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 15 May 2018 19:19:51 +0200 Subject: [PATCH 2/4] [FIX] event_sale: update registrations as sudo. Consequence of 19878d011f8abdc737b7b702c4c79632670d4b78 Backport of fb17edd0b0d5c956f6991feabfa704566fa0a11b --- addons/event_sale/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event_sale/models/sale_order.py b/addons/event_sale/models/sale_order.py index 8c2b8bc0c3f..30c5e40d122 100644 --- a/addons/event_sale/models/sale_order.py +++ b/addons/event_sale/models/sale_order.py @@ -56,7 +56,7 @@ class sale_order_line(osv.osv): order line has a product_uom_qty attribute that will be the number of registrations linked to this line. This method update existing registrations and create new one for missing one. """ - Registration = self.env['event.registration'] + Registration = self.env['event.registration'].sudo() registrations = Registration.search([('sale_order_line_id', 'in', self.ids)]) for so_line in [l for l in self if l.event_id]: existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id) From c22d3f67320f3c3edfdd3d00732021e896f2cda6 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Thu, 3 May 2018 10:07:22 +0200 Subject: [PATCH 3/4] [FIX] web: widget char_domain should pass context to selection dialog In case we define a field like, when selecting records the dialog should display all records (as asked by the context), but it's not the case. This commit ensure the field context is passed to the selection dialog. opw-1831902 --- addons/web/static/src/js/views/form_widgets.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index b99732774f2..25b4fbed8ba 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -454,6 +454,7 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin, var self = this; var dialog = new common.DomainEditorDialog(this, { res_model: this.options.model || this.field_manager.get_field_value(this.options.model_field), + context: self.build_context(), default_domain: this.get('value'), title: this.get('effective_readonly') ? _t('Selected records') : _t('Select records...'), readonly: this.get('effective_readonly'), From bcf20cfbecf6850256ad2d542bc3cac75a42dad8 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 14 May 2018 16:58:21 +0200 Subject: [PATCH 4/4] [FIX] stock: use timedelta instead of relativedelta Suppose we have a delta between two datetimes: delta = dt1 - dt0 If delta is negative but less than a day, ``delta.days`` returns -1 (which is compensated by positive seconds). In order to avoid this surprising effect, use ``delta.total_seconds()`` to compute the number of days. --- addons/stock/models/stock_move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index c5f8e54d984..a0f774109e1 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -288,10 +288,10 @@ class StockMove(models.Model): if propagated_date_field: current_date = datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) new_date = datetime.strptime(vals.get(propagated_date_field), DEFAULT_SERVER_DATETIME_FORMAT) - delta = relativedelta.relativedelta(new_date, current_date) - if abs(delta.days) >= move.company_id.propagation_minimum_delta: + delta_days = (new_date - current_date).total_seconds() / 86400 + if abs(delta_days) >= move.company_id.propagation_minimum_delta: old_move_date = datetime.strptime(move.move_dest_id.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) - new_move_date = (old_move_date + relativedelta.relativedelta(days=delta.days or 0)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) + new_move_date = (old_move_date + relativedelta.relativedelta(days=delta_days or 0)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) propagated_changes_dict['date_expected'] = new_move_date #For pushed moves as well as for pulled moves, propagate by recursive call of write(). #Note that, for pulled moves we intentionally don't propagate on the procurement.