[FIX] account_banking_sepa_direct_debit: 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:31:37 +02:00
parent ee979c1aea
commit b5b79c5458

View File

@@ -36,8 +36,15 @@ class TestSDD(common.HttpCase):
'company_ids': [(6, 0, self.main_company.ids)],
'company_id': self.main_company.id,
})
self.partner_agrolait.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_c2c.id)
)
self.env.ref(
'l10n_generic_coa.configurable_chart_template'
).try_loading_for_current_company()