Skip to content
Merged
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
2 changes: 1 addition & 1 deletion intervention_compassion/data/account.analytic.group.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ analytic_group_unrestricted,unrestricted fund,analytic_group_fund
analytic_group_christmas,christmas fund,analytic_group_fund
analytic_group_local,local fund,analytic_group_fund
analytic_group_ldp,ldp fund,analytic_group_fund
analytic_group_usp,unsponsored fund,analytic_group_fund
analytic_group_usp,unsponsored fund,analytic_group_fund
8 changes: 7 additions & 1 deletion sponsorship_compassion/models/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,6 @@ def contract_active(self):
not_active = self.filtered(lambda c: not c.is_active)
if not_active:
not_active.write({"activation_date": fields.Datetime.now()})
self.write({"state": "active"})
last_line_id = self.search(
[("sponsorship_line_id", "!=", False)],
order="sponsorship_line_id desc",
Expand All @@ -816,6 +815,13 @@ def contract_active(self):
last_line_id += 1
contract.sponsorship_line_id = last_line_id

# Flush env so db reflects payment mode
self.mapped("partner_id").flush()
self.flush()

# trigger auto comm job after payment info is written to the db
self.write({"state": "active"})

# Cancel the old invoices if a contract is activated
delay = datetime.now() + relativedelta(seconds=30)
self.with_delay(
Expand Down
Loading