diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index acd1fc2bcec..a35db7d7197 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1075,8 +1075,11 @@ class AccountMoveLine(models.Model): } bank = self.env["account.bank.statement"].browse(vals.get('statement_id')) if bank.currency_id != bank.company_id.currency_id: + ctx = {} + if 'date' in vals: + ctx['date'] = vals['date'] temp['currency_id'] = bank.currency_id.id - temp['amount_currency'] = bank.company_id.currency_id.compute(tax_vals['amount'], bank.currency_id, round=True) + temp['amount_currency'] = bank.company_id.currency_id.with_context(ctx).compute(tax_vals['amount'], bank.currency_id, round=True) tax_lines_vals.append(temp) new_line = super(AccountMoveLine, self).create(vals) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index a96cd646327..d67ca8ab786 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -4107,6 +4107,7 @@ class stock_location_path(osv.osv): 'propagate': rule.propagate, 'push_rule_id': rule.id, 'warehouse_id': rule.warehouse_id and rule.warehouse_id.id or False, + 'procurement_id': False, } def _apply(self, cr, uid, rule, move, context=None): diff --git a/addons/web/static/test/x2many.js b/addons/web/static/test/x2many.js index f57b03bcb1d..f45df41334e 100644 --- a/addons/web/static/test/x2many.js +++ b/addons/web/static/test/x2many.js @@ -69,7 +69,42 @@ Tour.register({ waitFor: '.tab-pane:last tr:has(.oe_list_field_cell):not(:has(.oe_list_record_selector)):contains(user_test)', }, + // add ourself as participant + { + title: "change tab to Participants", + element: '[data-toggle="tab"]:contains(Participants)' + }, + { + title: "click to add participants", + element: '.tab-pane:eq(2).active .oe_form_field_x2many_list_row_add a' + }, + { + title: "select Admin", + element: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]' + }, + { + title: "save selected participants", + waitFor: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]:propChecked', + element: '.o_selectcreatepopup_search_select' + }, + + // save + { + title: "save discussion", + waitFor: '.oe_form_field_many2many tbody tr td.oe_list_field_char:containsExact(Administrator)', + element: 'button.oe_form_button_save' + }, + // edit + { + title: "edit discussion", + element: 'button.oe_form_button_edit' + }, + // add message a + { + title: "Select First Tab", + element: 'a[role=tab]:first', + }, { title: "create new message a", element: '.oe_form_field_x2many_list_row_add:first a' @@ -167,15 +202,10 @@ Tour.register({ }, { title: "click to add participants", - element: '.tab-pane:eq(1).active .oe_form_field_x2many_list_row_add a' - }, - { - title: "select Admin", - element: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]' + element: '.tab-pane:eq(2).active .oe_form_field_x2many_list_row_add a' }, { title: "select Demo User", - waitFor: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]:propChecked', element: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Demo User)) .oe_list_record_selector input[type="checkbox"]' }, { @@ -214,7 +244,7 @@ Tour.register({ element: 'button.oe_form_button_edit' }, { - title: "change tab to Participants", + title: "change tab to Messages", waitFor: '.oe_form_editable', element: '[data-toggle="tab"]:contains(Messages)' }, diff --git a/openerp/addons/test_new_api/tests/test_onchange.py b/openerp/addons/test_new_api/tests/test_onchange.py index 2916959ed20..adecda3e4aa 100644 --- a/openerp/addons/test_new_api/tests/test_onchange.py +++ b/openerp/addons/test_new_api/tests/test_onchange.py @@ -89,7 +89,7 @@ class TestOnChange(common.TransactionCase): self.assertEqual(field_onchange.get('messages'), '1') self.assertItemsEqual( strip_prefix('messages.', field_onchange), - ['author', 'body', 'name', 'size'], + ['author', 'body', 'name', 'size', 'important'], ) # modify discussion name @@ -105,6 +105,7 @@ class TestOnChange(common.TransactionCase): 'body': BODY, 'author': USER.id, 'size': len(BODY), + 'important': False, }), ], } @@ -118,12 +119,14 @@ class TestOnChange(common.TransactionCase): 'body': message.body, 'author': message.author.name_get()[0], 'size': message.size, + 'important': message.important, }), (0, 0, { 'name': "[%s] %s" % ("Foo", USER.name), 'body': BODY, 'author': USER.name_get()[0], 'size': len(BODY), + 'important': False, }), ]) @@ -248,6 +251,7 @@ class TestOnChange(common.TransactionCase): 'body': BODY, 'author': USER.id, 'important': False, + 'email_to': demo.email, }) # check if server-side cache is working correctly @@ -276,8 +280,18 @@ class TestOnChange(common.TransactionCase): # When one2many domain contains non-computed field, things are ok self.assertEqual(result['value']['important_messages'], - [(1, email.message.id, {'name': u'[Foo Bar] %s' % USER.name})]) + [(5,)] + [(4, msg.id) for msg in discussion.important_messages]) # But here with commit 5676d81, we get value of: [(2, email.id)] - self.assertEqual(result['value']['important_emails'], - [(1, email.id, {'name': u'[Foo Bar] %s' % USER.name})]) + self.assertEqual( + result['value']['important_emails'], + [(5,), + (1, email.id, { + 'name': u'[Foo Bar] %s' % USER.name, + 'body': email.body, + 'author': USER.name_get()[0], + 'important': True, + 'email_to': demo.email, + 'size': email.size, + })] + )