diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-03-20 15:05:01 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-03-20 15:05:01 +0700 |
| commit | 3ed91948307260a25efae332c6dae013d276fef5 (patch) | |
| tree | 7dd4217c97237709020d436a8e72d44bcf8d2267 /indoteknik_custom/models | |
| parent | c48f3204c84cf7fca8da827178c4971370b324f8 (diff) | |
<iman> add sale order post massage when confirm product bom
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/mrp_production.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/indoteknik_custom/models/mrp_production.py b/indoteknik_custom/models/mrp_production.py index 54d90256..0bf98702 100644 --- a/indoteknik_custom/models/mrp_production.py +++ b/indoteknik_custom/models/mrp_production.py @@ -6,5 +6,18 @@ class MrpProduction(models.Model): _inherit = 'mrp.production' desc = fields.Text(string='Description') - -
\ No newline at end of file + sale_order = fields.Many2one('sale.order', string='Sale Order', required=True, copy=False) + + def action_confirm(self): + """Override action_confirm untuk mengirim pesan ke Sale Order jika state berubah menjadi 'confirmed'.""" + if self._name != 'mrp.production': + return super(MrpProduction, self).action_confirm() + + result = super(MrpProduction, self).action_confirm() + + for record in self: + if record.sale_order and record.state == 'confirmed': + message = _("Manufacturing order telah dibuat dengan nomor %s") % (record.name) + record.sale_order.message_post(body=message) + + return result
\ No newline at end of file |
