diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index edb44f3d983..15ed4ecb5a6 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -381,7 +381,7 @@ class AccountBankStatementLine(models.Model): #################################################### def _get_common_sql_query(self, overlook_partner = False, excluded_ids = None, split = False): - acc_type = "acc.internal_type IN ('payable', 'receivable')" if (self.partner_id or overlook_partner) else "acc.reconcile = true" + acc_type = "acc.reconcile = true" select_clause = "SELECT aml.id " from_clause = "FROM account_move_line aml JOIN account_account acc ON acc.id = aml.account_id " account_clause = '' diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index f65487073fe..25cfa07eb1c 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -226,7 +226,7 @@ class AccountInvoice(models.Model): for line in self.move_id.line_ids.filtered(lambda l: l.account_id.id == self.account_id.id): payment_lines.update(line.mapped('matched_credit_ids.credit_move_id.id')) payment_lines.update(line.mapped('matched_debit_ids.debit_move_id.id')) - self.payment_move_line_ids = self.env['account.move.line'].browse(list(payment_lines)) + self.payment_move_line_ids = self.env['account.move.line'].browse(list(payment_lines)).sorted() name = fields.Char(string='Reference/Description', index=True, readonly=True, states={'draft': [('readonly', False)]}, copy=False, help='The name that will be used on account move lines') diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index a6bd6908e2f..948cebf5c23 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -18,18 +18,29 @@ class ReportAgedPartnerBalance(models.AbstractModel): # Do an invoice and a payment and unreconcile. The amount will be nullified # By default, the partner wouldn't appear in this report. # The context key allow it to appear + # In case of a period_length of 30 days as of 2019-02-08, we want the following periods: + # Name Stop Start + # 1 - 30 : 2019-02-07 - 2019-01-09 + # 31 - 60 : 2019-01-08 - 2018-12-10 + # 61 - 90 : 2018-12-09 - 2018-11-10 + # 91 - 120 : 2018-11-09 - 2018-10-11 + # +120 : 2018-10-10 ctx = self._context periods = {} date_from = fields.Date.from_string(date_from) start = date_from - relativedelta(days=1) for i in range(5)[::-1]: stop = start - relativedelta(days=period_length) + period_name = str((5-(i+1)) * period_length + 1) + '-' + str((5-i) * period_length) + period_stop = (start - relativedelta(days=1)).strftime('%Y-%m-%d') + if i == 0: + period_name = '+' + str(4 * period_length) periods[str(i)] = { - 'name': (i!=0 and (str((5-(i+1)) * period_length) + '-' + str((5-i) * period_length)) or ('+'+str(4 * period_length))), - 'stop': start.strftime('%Y-%m-%d'), + 'name': period_name, + 'stop': period_stop, 'start': (i!=0 and stop.strftime('%Y-%m-%d') or False), } - start = stop - relativedelta(days=1) + start = stop res = [] total = [] diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js index 0c605527b6e..7d572bc74b3 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js @@ -43,6 +43,7 @@ var StatementRenderer = Widget.extend(FieldManagerMixin, { var defs = [this._super.apply(this, arguments)]; this.time = Date.now(); this.$progress = this.$('.progress'); + this.clickStatementName = this._initialState.bank_statement_id ? true : false; if (this._initialState.bank_statement_id) { var def = this.model.makeRecord("account.bank.statement", [{ diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 1e23f2d887b..bbb083de9c5 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -782,7 +782,7 @@ class TestReconciliation(AccountingTestCase): def test_aged_report(self): AgedReport = self.env['report.account.report_agedpartnerbalance'].with_context(include_nullified_amount=True) account_type = ['receivable'] - report_date_to = time.strftime('%Y') + '-07-16' + report_date_to = time.strftime('%Y') + '-07-17' partner = self.env['res.partner'].create({'name': 'AgedPartner'}) currency = self.env.user.company_id.currency_id diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index c04674b20c5..1e09d4b6935 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -89,6 +89,7 @@ + diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 2a57d6be7cf..1268c9d1232 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -430,8 +430,10 @@ - - + + + + diff --git a/addons/auth_signup/models/res_partner.py b/addons/auth_signup/models/res_partner.py index b4c8ebd1667..d6161e17b91 100644 --- a/addons/auth_signup/models/res_partner.py +++ b/addons/auth_signup/models/res_partner.py @@ -27,7 +27,7 @@ class ResPartner(models.Model): signup_token = fields.Char(copy=False, groups="base.group_erp_manager") signup_type = fields.Char(string='Signup Token Type', copy=False, groups="base.group_erp_manager") signup_expiration = fields.Datetime(copy=False, groups="base.group_erp_manager") - signup_valid = fields.Boolean(compute='_compute_signup_valid', string='Signup Token is Valid', compute_sudo=True) + signup_valid = fields.Boolean(compute='_compute_signup_valid', compute_sudo=True, string='Signup Token is Valid') signup_url = fields.Char(compute='_compute_signup_url', string='Signup URL') @api.multi diff --git a/addons/board/static/src/js/board_view.js b/addons/board/static/src/js/board_view.js index 126214cedf1..1cf27c79fe8 100644 --- a/addons/board/static/src/js/board_view.js +++ b/addons/board/static/src/js/board_view.js @@ -10,6 +10,7 @@ var FormController = require('web.FormController'); var FormRenderer = require('web.FormRenderer'); var FormView = require('web.FormView'); var pyUtils = require('web.py_utils'); +var session = require('web.session'); var viewRegistry = require('web.view_registry'); var _t = core._t; @@ -246,7 +247,10 @@ var BoardRenderer = FormRenderer.extend({ // the action does not exist anymore return $.when(); } - var context = pyUtils.eval('context', new Context(params.context, action.context)); + // tz and lang are saved in the custom view + // override the language to take the current one + var rawContext = new Context(params.context, action.context, {lang: session.user_context.lang}); + var context = pyUtils.eval('context', rawContext); var domain = params.domain || pyUtils.eval('domain', action.domain || '[]', action.context); var viewType = params.viewType || action.views[0][1]; var view = _.find(action.views, function (descr) { diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 8b148c3ebb6..42fb870458f 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -6,6 +6,7 @@ var BoardView = require('board.BoardView'); var ListController = require('web.ListController'); var testUtils = require('web.test_utils'); var ListRenderer = require('web.ListRenderer'); +var pyUtils = require('web.py_utils'); var createActionManager = testUtils.createActionManager; var createView = testUtils.createView; @@ -746,4 +747,44 @@ QUnit.test('save to dashboard actions with flag keepSearchView', function (asser actionManager.destroy(); }); +QUnit.test("Views should be loaded in the user's language", function (assert) { + assert.expect(2); + var form = createView({ + View: BoardView, + model: 'board', + data: this.data, + session: {user_context: {lang: 'fr_FR'}}, + arch: '
' + + '' + + '' + + '' + + '' + + '' + + '
', + mockRPC: function (route, args) { + if (args.method === 'load_views') { + assert.deepEqual(pyUtils.eval('context', args.kwargs.context), {lang: 'fr_FR'}, + 'The views should be loaded with the correct context'); + } + if (route === "/web/dataset/search_read") { + assert.deepEqual(args.context, {lang: 'fr_FR'}, + 'The data should be loaded with the correct context'); + } + if (route === '/web/action/load') { + return $.when({ + res_model: 'partner', + views: [[4, 'list']], + }); + } + return this._super.apply(this, arguments); + }, + archs: { + 'partner,4,list': + '', + }, + }); + + form.destroy(); +}); + }); diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js index 897c8ef09e2..c2e26206e4e 100644 --- a/addons/calendar/static/src/js/base_calendar.js +++ b/addons/calendar/static/src/js/base_calendar.js @@ -57,10 +57,8 @@ WebClient.include({ // Clear previously set timeouts and destroy currently displayed calendar notifications clearTimeout(this.get_next_calendar_notif_timeout); _.each(this.calendar_notif_timeouts, clearTimeout); - _.each(this.calendar_notif, function(notif) { - if (!notif.isDestroyed()) { - notif.destroy(); - } + _.each(this.calendar_notif, function (notificationID) { + self.call('notification', 'close', notificationID, true); }); this.calendar_notif_timeouts = {}; this.calendar_notif = {}; @@ -68,13 +66,13 @@ WebClient.include({ // For each notification, set a timeout to display it _.each(notifications, function(notif) { self.calendar_notif_timeouts[notif.event_id] = setTimeout(function() { - var notification = new CalendarNotification(self.notification_manager, { + var notificationID = self.call('notification', 'notify', { + Notification: CalendarNotification, title: notif.title, text: notif.message, eventID: notif.event_id, }); - self.notification_manager.display(notification); - self.calendar_notif[notif.event_id] = notification; + self.calendar_notif[notif.event_id] = notificationID; }, notif.timer * 1000); last_notif_timer = Math.max(last_notif_timer, notif.timer); }); diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml index 92734975333..48ca69b7a8e 100644 --- a/addons/hr_expense/views/hr_expense_views.xml +++ b/addons/hr_expense/views/hr_expense_views.xml @@ -67,7 +67,7 @@ - +