[FIX] Add check_company=True on contracts and contract lines

Add check_company=True in field definition and
[('company_id', '=', company_id)] in the domain (in view or in field definition)
This commit is contained in:
Alexis de Lattre
2022-05-09 14:35:04 +02:00
parent 8409479cbe
commit 000ad9eabb
11 changed files with 50 additions and 6 deletions

View File

@@ -2210,8 +2210,21 @@ class TestContract(TestContractBase):
parent_partner = self.env["res.partner"].create(
{"name": "parent partner", "is_company": True}
)
journal2 = self.env["account.journal"].create(
{
"name": "Test journal Company2",
"code": "VTC2",
"type": "sale",
"company_id": company2.id,
}
)
# Assume contract 2 is for company 2
self.contract2.company_id = company2
self.contract2.write(
{
"company_id": company2.id,
"journal_id": journal2.id,
}
)
# Update the partner attached to both contracts
self.partner.with_user(unprivileged_user).with_company(company2).with_context(
company_id=company2.id
@@ -2410,6 +2423,7 @@ class TestContract(TestContractBase):
"code": "TCAD",
"type": "sale",
"currency_id": currency_cad.id,
"company_id": self.contract2.company_id.id,
}
)
self.contract2.journal_id = journal.id