diff --git a/addons/account/models/account.py b/addons/account/models/account.py index eea65d9c3dc..cc303ec1309 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -274,6 +274,12 @@ class AccountAccount(models.Model): self.filtered(lambda r: not r.reconcile)._toggle_reconcile_to_true() else: self.filtered(lambda r: r.reconcile)._toggle_reconcile_to_false() + + if vals.get('currency_id'): + for account in self: + if self.env['account.move.line'].search_count([('account_id', '=', account.id), ('currency_id', 'not in', (False, vals['currency_id']))]): + raise UserError(_('You cannot set a currency on this account as it already has some journal entries having a different foreign currency.')) + return super(AccountAccount, self).write(vals) @api.multi diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 15669281ead..6fb13ffeb73 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -415,7 +415,7 @@ class AccountBankStatementLine(models.Model): st_line_currency = self.currency_id or self.journal_id.currency_id currency = (st_line_currency and st_line_currency != company_currency) and st_line_currency.id or False precision = st_line_currency and st_line_currency.decimal_places or company_currency.decimal_places - params = {'company_id': self.env.user.company_id.id, + params = {'company_id': self.company_id.id, 'account_payable_receivable': (self.journal_id.default_credit_account_id.id, self.journal_id.default_debit_account_id.id), 'amount': float_round(amount, precision_digits=precision), 'partner_id': self.partner_id.id, diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 713a208e7c2..81512af9b2e 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -631,6 +631,8 @@ class Meeting(models.Model): recurring_date = recurring_date.replace(tzinfo=None) else: recurring_date = todate(meeting.recurrent_id_date) + if date_field == "stop": + recurring_date += timedelta(hours=self.duration) rset1.exdate(recurring_date) invalidate = True return [d.astimezone(pytz.UTC) if d.tzinfo else d for d in rset1 if d.year < MAXYEAR] diff --git a/addons/calendar/tests/test_calendar_recurrent_event_case2.py b/addons/calendar/tests/test_calendar_recurrent_event_case2.py index 456a47fd9b9..e43d7c7843c 100644 --- a/addons/calendar/tests/test_calendar_recurrent_event_case2.py +++ b/addons/calendar/tests/test_calendar_recurrent_event_case2.py @@ -85,14 +85,23 @@ class TestRecurrentEvent(common.TransactionCase): for meeting in meetings: self.assertEqual(meeting.name, 'Sprint Review for google modules', 'Name not changed for id: %s' % meeting.id) + # I detach first occurrence to check it is not modified by changing recurrent event. + min(meetings, key=lambda m: m.start).detach_recurring_event() + # I change description of my weekly meeting Review code with programmer. idval = '%d-%s' % (self.calendar_event_sprint_review.id, '20110425124700') self.CalendarEvent.browse(idval).write({'description': 'Review code of the module: sync_google_calendar.'}) - # I check whether that all the records of this recurrence has been edited. - meetings = self.CalendarEvent.search([('recurrent_id', '=', self.calendar_event_sprint_review.id)]) - for meeting in meetings: - self.assertEqual(meeting.description, 'Review code of the module: sync_google_calendar.', 'Description not changed for id: %s' % meeting.id) + # I check that detached event has not been edited. + detached_meeting = self.CalendarEvent.search([('recurrent_id', '=', self.calendar_event_sprint_review.id)]) + self.assertEqual(detached_meeting.description, False, 'Detached event description changed for id: %s' % meeting.id) + + # I verify wether I find an event by date range when subsequent to a detached one. + last_meeting = max(meetings, key=lambda m: m.start) + meetings = self.CalendarEvent.with_context({'virtual_id': True}).search([ + ('start', '<=', last_meeting.stop), ('stop', '>=', last_meeting.start) + ]) + self.assertEqual(meetings.id, last_meeting.id, 'Last event should be found searching it by date range') # I update the description of two meetings, and check that both have been updated self.calendar_event_sprint_review.write({'description': "Some description"}) diff --git a/addons/rating/views/rating_view.xml b/addons/rating/views/rating_view.xml index 3c856f7fad9..256f52bc7f3 100644 --- a/addons/rating/views/rating_view.xml +++ b/addons/rating/views/rating_view.xml @@ -96,7 +96,7 @@ on - + diff --git a/doc/cla/individual/ivantodorovich.md b/doc/cla/individual/ivantodorovich.md new file mode 100644 index 00000000000..d3352e4a1f7 --- /dev/null +++ b/doc/cla/individual/ivantodorovich.md @@ -0,0 +1,11 @@ +Argentina, 2018-09-04 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Ivan Todorovich https://github.com/ivantodorovich diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index 9caa8859d35..360aeded8ff 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -445,7 +445,7 @@ class Partner(models.Model): """ Sync commercial fields and address fields from company and to children after create/update, just as if those were all modeled as fields.related to the parent """ # 1. From UPSTREAM: sync from parent - if values.get('parent_id') or values.get('type', 'contact'): + if values.get('parent_id') or values.get('type') == 'contact': # 1a. Commercial fields: sync if parent changed if values.get('parent_id'): self._commercial_sync_from_company()