[IMP] ensan_sale_management: send confirmation message when the order is auto locked

This commit is contained in:
Abdurrahman Saber 2025-12-03 12:12:07 +04:00
parent 9134feb645
commit 7222104a81
1 changed files with 2 additions and 1 deletions

View File

@ -100,13 +100,14 @@ class SaleOrder(models.Model):
}) })
def action_confirm(self): def action_confirm(self):
old_state = self.state
res = super().action_confirm() res = super().action_confirm()
bot = self.env.ref('base.partner_root').id bot = self.env.ref('base.partner_root').id
if res: if res:
sms_template_id = self.env.ref('ensan_sale_management.sms_template_data_donation') sms_template_id = self.env.ref('ensan_sale_management.sms_template_data_donation')
donar_sms_template_id = self.env.ref('ensan_sale_management.sms_template_donors_data_donation') donar_sms_template_id = self.env.ref('ensan_sale_management.sms_template_donors_data_donation')
for rec in self: for rec in self:
if rec.state == 'sale' and not self._context.get('skip_donation_sms'): if old_state in ('draft', 'sent') and rec.state in ('sale', 'done') and not self._context.get('skip_donation_sms'):
if rec.order_mobile_number: if rec.order_mobile_number:
rec._message_sms_with_template( rec._message_sms_with_template(
template=sms_template_id, template=sms_template_id,