summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/approval_retur_picking.py
blob: 34c449a8a931a9413ef17362f089cc3a24c038bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from odoo import models, fields
import logging

_logger = logging.getLogger(__name__)


class ApprovalReturPicking(models.TransientModel):
    _name = 'approval.retur.picking'
    _description = 'Wizard to add Note Return'

    note_return = fields.Text(string="Note Return")

    def action_confirm_note_return(self):
        picking_ids = self._context.get('picking_ids')
        picking = self.env['stock.picking'].browse(picking_ids)
        
        # Update the note_return field
        picking.update({
            'approval_return_status': 'pengajuan1'
        })
        
        # Post a highlighted message to lognote
        # picking.message_post(
        #     body=f"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>"
        #         f"<b>Note Return (Pinned):</b><br>{self.note_return}</div>",
        #     subtype_id=self.env.ref("mail.mt_note").id
        # )
        
        return {
            'type': 'ir.actions.client',
            'tag': 'display_notification',
            'params': {
                'title': 'Notification',
                'message': 'Status pengajuan telah berubah',
                'next': {'type': 'ir.actions.act_window_close'},
            }
        }