Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][TEST] Add unit test to demonstrate incorrect customer assignment when generating contract invoices #1142

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions contract/tests/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,22 @@ def test_cron_recurring_create_invoice(self):
len(invoice_lines),
)

def test_cron_recurring_create_invoice_several_partners(self):
other_partner = self.env.ref("base.res_partner_1")
contracts = self.contract
contracts |= self.contract.copy({"invoice_partner_id": other_partner.id})
self.env["contract.contract"].cron_recurring_create_invoice()
invoice_lines = self.env["account.move.line"].search(
[("contract_line_id", "in", contracts.mapped("contract_line_ids").ids)]
)
self.assertEqual(
len(contracts.mapped("contract_line_ids")),
len(invoice_lines),
)
self.assertEqual(len(invoice_lines.mapped("move_id")), 2)
self.assertEqual(len(invoice_lines.mapped("move_id.partner_id")), 2)
self.assertIn(other_partner, invoice_lines.mapped("move_id.partner_id"))

def test_recurring_create_invoice(self):
self.acct_line.date_start = "2024-01-01"
self.acct_line.recurring_invoicing_type = "pre-paid"
Expand Down
Loading