diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-27 13:20:17 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-27 13:20:17 +0700 |
| commit | 0bb47005022b33c79ecfb5924d41f35ce794c5fb (patch) | |
| tree | 72be75ad949fe9efaf7b55c8f7f5722225538b28 /indoteknik_custom/models | |
| parent | 41d40976a4400d973a5d3b627196a303cfd0d712 (diff) | |
add modal to mark as on so, add tracking to stockpicking date_doc_kirim
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/quotation_so_multi_update.py | 22 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 25 | ||||
| -rw-r--r-- | indoteknik_custom/models/sale_orders_multi_update.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 |
5 files changed, 65 insertions, 10 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index f51f95af..95defed6 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -86,4 +86,6 @@ from . import cost_centre from . import account_account from . import account_move_line from . import stock_scheduler_compute -from . import promotion
\ No newline at end of file +from . import promotion +from . import sale_orders_multi_update +from . import quotation_so_multi_update
\ No newline at end of file diff --git a/indoteknik_custom/models/quotation_so_multi_update.py b/indoteknik_custom/models/quotation_so_multi_update.py new file mode 100644 index 00000000..105b7963 --- /dev/null +++ b/indoteknik_custom/models/quotation_so_multi_update.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class QuotationSoMultiUpdate(models.TransientModel): + _name = 'quotation.so.multi_update' + + def save_multi_update_quotation(self): + quotation_ids = self._context['quotation_ids'] + sales = self.env['sale.order'].browse(quotation_ids) + sales.action_multi_update_state() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Status berhasil diubah', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 496c3551..71163fa4 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -58,7 +58,7 @@ class SaleOrder(models.Model): ('partial_chargeback', 'Partial Chargeback'), ('authorize', 'Authorize'), ], tracking=True, string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle') - date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting") + date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting", tracking=True) payment_type = fields.Char(string='Payment Type', help='Jenis pembayaran dengan Midtrans') gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans') notification = fields.Char(string='Notification', help='Dapat membantu error dari approval') @@ -83,9 +83,7 @@ class SaleOrder(models.Model): @api.model def action_multi_update_state(self): - order_ids = self.env.context.get('active_ids', []) - sale_order = self.search([('id', 'in', order_ids)]) - for sale in sale_order: + for sale in self: sale.update({ 'state': 'cancel', }) @@ -95,11 +93,22 @@ class SaleOrder(models.Model): 'approval_status': False, }) - @api.model + def open_form_multi_update_status(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_sale_orders_multi_update') + action['context'] = { + 'sale_ids': [x.id for x in self] + } + return action + + def open_form_multi_update_state(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_quotation_so_multi_update') + action['context'] = { + 'quotation_ids': [x.id for x in self] + } + return action + def action_multi_update_invoice_status(self): - order_ids = self.env.context.get('active_ids', []) - sale_order = self.search([('id', 'in', order_ids)]) - for sale in sale_order: + for sale in self: sale.update({ 'invoice_status': 'invoiced', }) diff --git a/indoteknik_custom/models/sale_orders_multi_update.py b/indoteknik_custom/models/sale_orders_multi_update.py new file mode 100644 index 00000000..95cfde21 --- /dev/null +++ b/indoteknik_custom/models/sale_orders_multi_update.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class SaleOrdersMultiUpdate(models.TransientModel): + _name = 'sale.orders.multi_update' + + def save_multi_update_so(self): + sale_ids = self._context['sale_ids'] + sales = self.env['sale.order'].browse(sale_ids) + sales.action_multi_update_invoice_status() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Invoice Status berhasil diubah', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index e1564ca9..181f2a59 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -64,7 +64,7 @@ class StockPicking(models.Model): ('pengajuan1', 'Approval Finance'), ('approved', 'Approved'), ], string='Approval Return Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Return") - date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ, tidak berpengaruh ke Accounting") + date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ, tidak berpengaruh ke Accounting", tracking=True) note_logistic = fields.Selection([ ('hold', 'Hold by Sales'), ('not_paid', 'Customer belum bayar'), |
