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 1 commit
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
Prev Previous commit
[TEST] contract: Add unit test for invoicing multiple contracts with …
…different customers
rlizana committed Nov 8, 2024
commit 10fc78b87d0efeec5d8913101549e6b752e33875
16 changes: 6 additions & 10 deletions contract/tests/test_contract.py
Original file line number Diff line number Diff line change
@@ -1745,12 +1745,9 @@ def test_cron_recurring_create_invoice(self):
)

def test_cron_recurring_create_invoice_several_partners(self):
self.acct_line.date_start = "2018-01-01"
self.acct_line.recurring_invoicing_type = "post-paid"
self.acct_line.date_end = "2018-03-15"
other_partner = self.env.ref('base.res_partner_1')
contracts = self.contract2
contracts |= self.contract.copy({'partner_id': other_partner.id})
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)]
@@ -1759,10 +1756,9 @@ def test_cron_recurring_create_invoice_several_partners(self):
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'))
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"