Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions sale_automatic_workflow/models/automatic_workflow_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def _register_payments(self, payment_filter):
return

def _register_payment_invoice(self, invoice):
self = self.with_company(invoice.company_id)
payment = self.env["account.payment"].create(
self._prepare_dict_account_payment(invoice)
)
Expand Down
19 changes: 19 additions & 0 deletions sale_automatic_workflow/tests/test_multicompany.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,22 @@ def test_sale_order_multicompany(self):
self.assertEqual(
invoice_fr_daughter.journal_id.company_id, order_fr_daughter.company_id
)

# Test payment register
self.auto_wkf.register_payment = True
self.env["automatic.workflow.job"].run()
self.assertIn(invoice_fr.payment_state, ["in_payment", "paid"])
self.assertIn(invoice_ch.payment_state, ["in_payment", "paid"])
self.assertIn(invoice_be.payment_state, ["in_payment", "paid"])
self.assertIn(invoice_fr_daughter.payment_state, ["in_payment", "paid"])
# Check payment journal company matches the order company
payment_fr = invoice_fr.matched_payment_ids
payment_ch = invoice_ch.matched_payment_ids
payment_be = invoice_be.matched_payment_ids
payment_fr_daughter = invoice_fr_daughter.matched_payment_ids
self.assertEqual(payment_fr.journal_id.company_id, order_fr.company_id)
self.assertEqual(payment_ch.journal_id.company_id, order_ch.company_id)
self.assertEqual(payment_be.journal_id.company_id, order_be.company_id)
self.assertEqual(
payment_fr_daughter.journal_id.company_id, order_fr_daughter.company_id
)
Loading