From 7d72a72905ce9e13b7be4239aa67eece9140dcb8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 8 Sep 2017 14:21:18 +0200 Subject: [PATCH 01/18] [FIX] calendar, web_calendar: change date - Change the date of an event through the form view => a mail is sent to the attendees. - Change the date of an event thanks to the drag and drop of an event => the mail is not sent. It is necessary to introduce a context key in the write call so we can make the distinction between the write triggered from the drag and drop and the write triggered by a recomputation of fields. Indeed, when the form view is used to change the date, `write` is called several times. We should avoid sending the same email each time. opw-766295 --- addons/calendar/models/calendar.py | 3 ++- addons/web_calendar/static/src/js/web_calendar.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 145614fc045..fa22382b328 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -1406,7 +1406,8 @@ class Meeting(models.Model): partners_to_notify.append(event_attendees_changes['removed_partners'].ids) self.env['calendar.alarm_manager'].notify_next_alarm(partners_to_notify) - if (values.get('start_date') or values.get('start_datetime')) and values.get('active', True): + if (values.get('start_date') or values.get('start_datetime') or + (values.get('start') and self.env.context.get('from_ui'))) and values.get('active', True): for current_meeting in all_meetings: if attendees_create: attendees_create = attendees_create[current_meeting.id] diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index be6e1743ddc..51827c27e3c 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -892,7 +892,7 @@ var CalendarView = View.extend({ var index = this.dataset.get_id_index(id); if (index !== null) { event_id = this.dataset.ids[index]; - this.dataset.write(event_id, data, {}).always(function() { + this.dataset.write(event_id, data, {context: {from_ui: true}}).always(function() { if (is_virtual_id(event_id)) { // this is a virtual ID and so this will create a new event // with an unknown id for us. From d23667262b3e0c14935f58cae793c0ed7b58bd08 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 8 Sep 2017 11:49:54 +0200 Subject: [PATCH 02/18] [FIX] account: future payment - Create a vendor bill - Register a payment in the future (e.g. Bank payment) On the dashboard, this payment in the future is taken into account, while it shows a graph up to today. Moreover, when clicking on "Difference", the report is opened at today's date. opw-768155 --- addons/account/models/account_journal_dashboard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 7fc9aa17cf8..3b44fa44eb9 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -163,8 +163,8 @@ class account_journal(models.Model): account_ids = tuple(filter(None, [self.default_debit_account_id.id, self.default_credit_account_id.id])) if account_ids: amount_field = 'balance' if not self.currency_id else 'amount_currency' - query = """SELECT sum(%s) FROM account_move_line WHERE account_id in %%s;""" % (amount_field,) - self.env.cr.execute(query, (account_ids,)) + query = """SELECT sum(%s) FROM account_move_line WHERE account_id in %%s AND date <= %%s;""" % (amount_field,) + self.env.cr.execute(query, (account_ids, fields.Date.today(),)) query_results = self.env.cr.dictfetchall() if query_results and query_results[0].get('sum') != None: account_sum = query_results[0].get('sum') From 2e292a21e6650c2045e12820263216965d5d86d5 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 11 Sep 2017 11:42:49 +0200 Subject: [PATCH 03/18] [FIX] mrp: Singleton expected in action_unbuild In some cases, the consumed quants can be more than one. In this case the check for the lot must be done just on the first consumed quant. Courtesy of @jco. opw:748472 --- addons/mrp/models/mrp_unbuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/models/mrp_unbuild.py b/addons/mrp/models/mrp_unbuild.py index d73466ed2bb..4fc4af387c4 100644 --- a/addons/mrp/models/mrp_unbuild.py +++ b/addons/mrp/models/mrp_unbuild.py @@ -121,11 +121,11 @@ class MrpUnbuild(models.Model): for produce_move in produce_moves: if produce_move.has_tracking != 'none': original = original_quants.filtered(lambda quant: quant.product_id == produce_move.product_id) - if not original.lot_id: + if original and not original[0].lot_id: raise UserError(_("You don't have in the stock the required lot/serial number for %s .") % (produce_move.product_id.name,)) self.env['stock.move.lots'].create({ 'move_id': produce_move.id, - 'lot_id': original.lot_id.id, + 'lot_id': original[0].lot_id.id, 'quantity_done': produce_move.product_uom_qty, 'quantity': produce_move.product_uom_qty }) From 0327f3e4671c517e18787e6c282ffcd6f3b45685 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 11 Sep 2017 14:02:21 +0200 Subject: [PATCH 04/18] [FIX] report: paper format Make paper format mandatory on the company. If no paper format is defined, the PDF created may have an unexpected format. opw-770173 --- addons/report/views/base_config_settings_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/report/views/base_config_settings_views.xml b/addons/report/views/base_config_settings_views.xml index 5e2766736f7..2d15525fcf4 100644 --- a/addons/report/views/base_config_settings_views.xml +++ b/addons/report/views/base_config_settings_views.xml @@ -9,7 +9,7 @@