[IMP] ensan_donation_request: send campaign to completed stage once the target is met
This commit is contained in:
parent
b1ea5bb0d2
commit
eed45175e6
|
|
@ -53,6 +53,15 @@ class DonationRequest(models.Model):
|
|||
for rec in self:
|
||||
if rec.total_amount < rec.category_id.minimum_request_amount:
|
||||
raise ValidationError(_('Total Amount must be greater than or equal %.2f!') % rec.category_id.minimum_request_amount)
|
||||
|
||||
@api.depends('remaining_amount')
|
||||
def _compute_stage_id(self):
|
||||
for rec in self:
|
||||
if rec.remaining_amount <= 0:
|
||||
new_stage = self.env.ref('ensan_donation_request.stage_done')
|
||||
else:
|
||||
new_stage = rec.stage_id
|
||||
rec.stage_id = new_stage
|
||||
|
||||
def action_approve(self):
|
||||
sms_template_id = self.env.company.donation_request_confirmation_sms_template_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue