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 | |
| parent | c48f3204c84cf7fca8da827178c4971370b324f8 (diff) | |
<iman> add sale order post massage when confirm product bom
| -rw-r--r-- | indoteknik_custom/models/mrp_production.py | 17 | ||||
| -rw-r--r-- | indoteknik_custom/views/mrp_production.xml | 2 |
2 files changed, 17 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 diff --git a/indoteknik_custom/views/mrp_production.xml b/indoteknik_custom/views/mrp_production.xml index f81d65e8..95f419f6 100644 --- a/indoteknik_custom/views/mrp_production.xml +++ b/indoteknik_custom/views/mrp_production.xml @@ -7,6 +7,7 @@ <field name="arch" type="xml"> <field name="bom_id" position="after"> <field name="desc"/> + <field name="sale_order"/> </field> </field> </record> @@ -18,6 +19,7 @@ <field name="arch" type="xml"> <field name="product_id" position="after"> <field name="desc"/> + <field name="sale_order"/> </field> </field> </record> |
