[FIX] account_banking_sepa_credit_transfer: Change company avoiding constraint

Since https://github.com/odoo/odoo/commit/d0f19ee8e11e31fda8ba7bebbc90e2ee6786,
the company of a partner can't be freely change. We do this switch for having
proper test data. This proves once more that we shouldn't use demo data for
tests, but for not having to do a lot of changes for preparing a test data
suite, let's simply change the company by SQL for having again green CI.
This commit is contained in:
Pedro M. Baeza
2021-09-10 12:36:59 +02:00
parent b5b79c5458
commit d06ee72b83

View File

@@ -33,9 +33,19 @@ class TestSCT(common.HttpCase):
'name': 'Test EUR company',
'currency_id': self.eur_currency.id,
})
self.partner_agrolait.company_id = self.main_company.id
self.partner_asus.company_id = self.main_company.id
self.partner_c2c.company_id = self.main_company.id
# Done as direct SQL for avoiding ORM constraint about changing company
self.env.cr.execute(
"UPDATE res_partner SET company_id = %s WHERE id = %s",
(self.main_company.id, self.partner_agrolait.id)
)
self.env.cr.execute(
"UPDATE res_partner SET company_id = %s WHERE id = %s",
(self.main_company.id, self.partner_asus.id)
)
self.env.cr.execute(
"UPDATE res_partner SET company_id = %s WHERE id = %s",
(self.main_company.id, self.partner_c2c.id)
)
self.env.user.write({
'company_ids': [(6, 0, self.main_company.ids)],
'company_id': self.main_company.id,