diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 3b72e38a2af9bab67997bc88dc23a18f1ab1122f..07319803ddc9ed6a4029f6711921b055e4e3780b 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -838,6 +838,9 @@ class AccountBankStatementLine(models.Model):
             }
             st_line.process_reconciliation(new_aml_dicts=[vals])
 
+    def _get_communication(self, payment_method_id):
+        return self.name or ''
+
     def process_reconciliation(self, counterpart_aml_dicts=None, payment_aml_rec=None, new_aml_dicts=None):
         """ Match statement lines with existing payments (eg. checks) and/or payables/receivables (eg. invoices and credit notes) and/or new move lines (eg. write-offs).
             If any new journal item needs to be created (via new_aml_dicts or counterpart_aml_dicts), a new journal entry will be created and will contain those
@@ -935,7 +938,7 @@ class AccountBankStatementLine(models.Model):
                     'state': 'reconciled',
                     'currency_id': currency.id,
                     'amount': abs(total),
-                    'communication': self.name or '',
+                    'communication': self._get_communication(payment_methods[0] if payment_methods else False),
                     'name': self.statement_id.name,
                 })
 
diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py
index 497d810470376c1abba5cbc687a8b3bf004517d9..0476d91999d80f3c85a5754a2bc9c8c8bd470891 100644
--- a/addons/account/models/partner.py
+++ b/addons/account/models/partner.py
@@ -278,7 +278,7 @@ class ResPartner(models.Model):
 
         # generate where clause to include multicompany rules
         where_query = account_invoice_report._where_calc([
-            ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('company_id', '=', self.env.user.company_id.id),
+            ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']),
             ('type', 'in', ('out_invoice', 'out_refund'))
         ])
         account_invoice_report._apply_ir_rules(where_query, 'read')
diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py
index 4f24dc11ee624b0ef4ce6d0744c5831f204073b9..5b8316d37f498cbe07ba46b2cb3032d1ba40a1d6 100644
--- a/addons/account/report/account_invoice_report.py
+++ b/addons/account/report/account_invoice_report.py
@@ -134,7 +134,7 @@ class AccountInvoiceReport(models.Model):
                 JOIN (
                     -- Temporary table to decide if the qty should be added or retrieved (Invoice vs Credit Note)
                     SELECT id,(CASE
-                         WHEN ai.type::text = ANY (ARRAY['out_refund'::character varying::text, 'in_invoice'::character varying::text])
+                         WHEN ai.type::text = ANY (ARRAY['in_refund'::character varying::text, 'in_invoice'::character varying::text])
                             THEN -1
                             ELSE 1
                         END) AS sign
diff --git a/addons/stock/models/stock_config_settings.py b/addons/stock/models/stock_config_settings.py
index 8ead9a928f730d80d46c5d9178771b6299774d4d..52856196d17dae670f0ec5393c68aafc91f44dce 100644
--- a/addons/stock/models/stock_config_settings.py
+++ b/addons/stock/models/stock_config_settings.py
@@ -84,3 +84,15 @@ class StockConfigSettings(models.TransientModel):
             warehouses.mapped('int_type_id').write({'active': active})
 
         return True
+
+    @api.model
+    def get_default_decimal_precision(self, fields):
+        # don't forward-port in v11.0, the API of config wizards changed.
+        digits = self.env.ref('product.decimal_stock_weight').digits
+        return {'decimal_precision': digits}
+
+    @api.multi
+    def set_decimal_precision(self):
+        # don't forward-port in v11.0, the API of config wizards changed.
+        for record in self:
+            self.env.ref('product.decimal_stock_weight').write({'digits': record.decimal_precision})
diff --git a/odoo/addons/test_new_api/tests/test_new_fields.py b/odoo/addons/test_new_api/tests/test_new_fields.py
index 9edf4a16114d8259506cb514c4882ef71e22d444..4ea0dce4281320cd469070e2dc580f3232d2a4dd 100644
--- a/odoo/addons/test_new_api/tests/test_new_fields.py
+++ b/odoo/addons/test_new_api/tests/test_new_fields.py
@@ -663,6 +663,30 @@ class TestFields(common.TransactionCase):
         self.assertFalse(discussion.very_important_messages)
         self.assertFalse(message.exists())
 
+    def test_70_x2many_write(self):
+        discussion = self.env.ref('test_new_api.discussion_0')
+        Message = self.env['test_new_api.message']
+        # There must be 3 messages, 0 important
+        self.assertEqual(len(discussion.messages), 3)
+        self.assertEqual(len(discussion.important_messages), 0)
+        self.assertEqual(len(discussion.very_important_messages), 0)
+        discussion.important_messages = [(0, 0, {
+            'body': 'What is the answer?',
+            'important': True,
+        })]
+        # There must be 4 messages, 1 important
+        self.assertEqual(len(discussion.messages), 4)
+        self.assertEqual(len(discussion.important_messages), 1)
+        self.assertEqual(len(discussion.very_important_messages), 1)
+        discussion.very_important_messages |= Message.new({
+            'body': '42',
+            'important': True,
+        })
+        # There must be 5 messages, 2 important
+        self.assertEqual(len(discussion.messages), 5)
+        self.assertEqual(len(discussion.important_messages), 2)
+        self.assertEqual(len(discussion.very_important_messages), 2)
+
 
 class TestHtmlField(common.TransactionCase):
 
diff --git a/odoo/fields.py b/odoo/fields.py
index 6cb78ec26fb8647d203b4437b7e3c09880f43845..9073d3c7303234ca4c9983081dce3189167fb671 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -2288,14 +2288,13 @@ class One2many(_RelationalMulti):
                 elif act[0] == 6:
                     record = records[-1]
                     comodel.browse(act[2]).write({inverse: record.id})
-                    query = "SELECT id FROM %s WHERE %s=%%s AND id <> ALL(%%s)" % (comodel._table, inverse)
-                    comodel._cr.execute(query, (record.id, act[2] or [0]))
-                    lines = comodel.browse([row[0] for row in comodel._cr.fetchall()])
+                    domain = self.domain(records) if callable(self.domain) else self.domain
+                    domain = domain + [(inverse, 'in', records.ids), ('id', 'not in', act[2] or [0])]
                     inverse_field = comodel._fields[inverse]
                     if inverse_field.ondelete == 'cascade':
-                        lines.unlink()
+                        comodel.search(domain).unlink()
                     else:
-                        lines.write({inverse: False})
+                        comodel.search(domain).write({inverse: False})
 
 
 class Many2many(_RelationalMulti):