diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-09 15:03:15 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-09 15:03:15 +0700 |
| commit | dfd4a1617d2c62b99d4bbcb6386b477874a33ebf (patch) | |
| tree | cf929b7967798000910e6f8afc6156de512fc330 /indoteknik_custom/models | |
| parent | 3615748eafd2d2cfd81f6ddc95d50a7bc347798d (diff) | |
multiple confirm purchase orders
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 14 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchase_order_multi_confirm.py | 22 |
3 files changed, 37 insertions, 0 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 509fceef..e984d0dd 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -96,3 +96,4 @@ from . import commision from . import sale_advance_payment_inv from . import purchase_order_multi_update from . import invoice_reklas_penjualan +from . import purchase_order_multi_confirm diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index ba6b6c41..6a641aff 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -52,12 +52,26 @@ class PurchaseOrder(models.Model): responsible_ids = fields.Many2many('res.users', string='Responsibles', compute='_compute_responsibles') status_paid_cbd = fields.Boolean(string='Paid Status', tracking=3, help='Field ini diisi secara manual oleh Finance AP dan hanya untuk status PO CBD') + def open_form_multi_confirm_po(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_purchase_order_multi_confirm') + action['context'] = { + 'order_ids': [x.id for x in self] + } + return action + def action_multi_update_paid_status(self): for purchase in self: purchase.update({ 'status_paid_cbd': True, }) + def action_multi_confirm_po(self): + for purchase in self: + if purchase.state != 'draft': + continue + + purchase.button_confirm() + def open_form_multi_update_paid_status(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_purchase_order_multi_update') action['context'] = { diff --git a/indoteknik_custom/models/purchase_order_multi_confirm.py b/indoteknik_custom/models/purchase_order_multi_confirm.py new file mode 100644 index 00000000..ac77ca54 --- /dev/null +++ b/indoteknik_custom/models/purchase_order_multi_confirm.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class PurchaseOrderMultiUpdate(models.TransientModel): + _name = 'purchase.order.multi_confirm' + + def save_multi_confirm_po(self): + order_ids = self._context['order_ids'] + purchase = self.env['purchase.order'].browse(order_ids) + purchase.action_multi_confirm_po() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'PO berhasil di Confirm', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file |
