diff options
| author | HafidBuroiroh <hafidburoiroh09@gmail.com> | 2026-03-12 13:28:19 +0700 |
|---|---|---|
| committer | HafidBuroiroh <hafidburoiroh09@gmail.com> | 2026-03-12 13:28:19 +0700 |
| commit | 4a70e8255a74b301104c4eeec9f7cf1874425f0a (patch) | |
| tree | f2d087cd872a29691d37eb727f8d7964c24e7f11 | |
| parent | 0383396bc2675fffa9fb48d8dfd5172b9c900f13 (diff) | |
<hafid> fix notif sourcing
| -rw-r--r-- | indoteknik_custom/models/sourcing_job_order.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sourcing_job_order.py b/indoteknik_custom/models/sourcing_job_order.py index 66d03703..5099b91d 100644 --- a/indoteknik_custom/models/sourcing_job_order.py +++ b/indoteknik_custom/models/sourcing_job_order.py @@ -458,11 +458,13 @@ class SourcingJobOrderLine(models.Model): return rec def write(self, vals): + bypass_md_check = self.env.context.get('bypass_md_check') for rec in self: if ( rec.md_person_ids and self.env.uid != rec.md_person_ids.id and rec.order_id.create_uid != self.env.user + and not bypass_md_check ): raise UserError("❌ Hanya MD yang memegang job yang boleh mengedit Sourcing Job.") @@ -1002,6 +1004,16 @@ class SourcingJobOrderLine(models.Model): rec.reason or '-' ) ) + if rec.show_salesperson: + rec.message_notify( + partner_ids=[rec.show_salesperson.partner_id.id], + subject="SJO Line Cancelled", + body=( + f"⚠️ Line <b>{line_no}</b> dari SJO <b>{rec.order_id.name}</b> " + f"telah di Cancel oleh <b>{self.env.user.name}</b>.<br/>" + f"<b>Reason:</b> {rec.reason}" + ) + ) @api.onchange('product_id') def _oncange_code(self): |
