diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 10:06:30 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 10:06:30 +0700 |
| commit | 0e45b80f216e91ce6f305bdd728d4f110614881f (patch) | |
| tree | c46e519b61d6359e281ce3b28c685eb5d1516512 /indoteknik_custom/models/tukar_guling_po.py | |
| parent | 6e3b560d3f115bfa89f3d5853cc9709b7cc963d6 (diff) | |
| parent | a5da6a49dda2d756f907f072a00fb50672893682 (diff) | |
<miqdad> merge with odoo backup
Diffstat (limited to 'indoteknik_custom/models/tukar_guling_po.py')
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index 5f990525..20adcfef 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -408,6 +408,16 @@ class TukarGulingPO(models.Model): self.ensure_one() # if self.state == 'done': # raise UserError("Tidak bisa cancel jika sudah done") + + user = self.env.user + if not ( + user.has_group('indoteknik_custom.group_role_sales') or + user.has_group('indoteknik_custom.group_role_fat') or + user.has_group('indoteknik_custom.group_role_logistic') + ): + raise UserWarning('Anda tidak memiliki Permission untuk cancel document') + + bu_done = self.po_picking_ids.filtered(lambda p: p.state == 'done') if bu_done: raise UserError("Dokuemn BU sudah Done, tidak bisa di cancel") @@ -537,6 +547,15 @@ class TukarGulingPO(models.Model): 'group_id': grup.id, 'tukar_guling_po_id': record.id, }) + record.message_post( + body=f"📦 <b>{return_picking.name}</b> " + f"<b>{return_picking.picking_type_id.display_name}</b> " + f"Created by <b>{self.env.user.name}</b> " + f"status <b>{return_picking.state}</b> " + f"at <b>{fields.Datetime.now().strftime('%d/%m/%Y %H:%M')}</b>", + message_type="comment", + subtype_id=self.env.ref("mail.mt_note").id, + ) return return_picking |
