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 | |
| parent | 41d40976a4400d973a5d3b627196a303cfd0d712 (diff) | |
add modal to mark as on so, add tracking to stockpicking date_doc_kirim
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 2 | ||||
| -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 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/quotation_so_multi_update.xml | 31 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 5 | ||||
| -rw-r--r-- | indoteknik_custom/views/sale_orders_multi_update.xml | 31 |
10 files changed, 133 insertions, 13 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 10878e32..48434845 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -95,6 +95,8 @@ 'views/cost_centre.xml', 'views/account_account_views.xml', 'views/account_move_line.xml', + 'views/sale_orders_multi_update.xml', + 'views/quotation_so_multi_update.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', 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'), diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index da92f81f..e362e546 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -76,3 +76,5 @@ access_apache_solr_queue,access.apache.solr.queue,model_apache_solr_queue,,1,1,1 access_cost_centre,access.cost.centre,model_cost_centre,,1,1,1,1 access_stock_scheduler_compute,access.stock.scheduler.compute,model_stock_scheduler_compute,,1,1,1,1 access_sale_order_promotion,access.sale.order.promotion,model_sale_order_promotion,,1,1,1,1 +access_sale_orders_multi_update,access.sale.orders.multi_update,model_sale_orders_multi_update,,1,1,1,1 +access_quotation_so_multi_update,access.quotation.so.multi_update,model_quotation_so_multi_update,,1,1,1,1
\ No newline at end of file diff --git a/indoteknik_custom/views/quotation_so_multi_update.xml b/indoteknik_custom/views/quotation_so_multi_update.xml new file mode 100644 index 00000000..d3d310d5 --- /dev/null +++ b/indoteknik_custom/views/quotation_so_multi_update.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="view_quotation_so_multi_update_form" model="ir.ui.view"> + <field name="name">Quotation Multi Update</field> + <field name="model">quotation.so.multi_update</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <span>Apakah Anda Yakin Ingin Mengubah Status Menjadi Cancel?</span> + </group> + </sheet> + <footer> + <button name="save_multi_update_quotation" string="Update" type="object" default_focus="1" class="oe_highlight"/> + <button string="Cancel" class="btn btn-secondary" special="cancel" /> + </footer> + </form> + </field> + </record> + + <record id="action_quotation_so_multi_update" model="ir.actions.act_window"> + <field name="name">Quotation Multi Update</field> + <field name="res_model">quotation.so.multi_update</field> + <field name="type">ir.actions.act_window</field> + <field name="view_mode">form</field> + <field name="view_id" ref="view_quotation_so_multi_update_form"/> + <field name="target">new</field> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index a0b5e779..bc098f18 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -193,16 +193,15 @@ <field name="binding_model_id" ref="sale.model_sale_order"/> <field name="binding_view_types">form,list</field> <field name="state">code</field> - <field name="code">model.action_multi_update_state()</field> + <field name="code">action = records.open_form_multi_update_state()</field> </record> <record id="sale_order_update_multi_actions_server" model="ir.actions.server"> <field name="name">Mark As Completed</field> <field name="model_id" ref="sale.model_sale_order"/> <field name="binding_model_id" ref="sale.model_sale_order"/> - <field name="binding_view_types">form,list</field> <field name="state">code</field> - <field name="code">model.action_multi_update_invoice_status()</field> + <field name="code">action = records.open_form_multi_update_status()</field> </record> </data> </odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/sale_orders_multi_update.xml b/indoteknik_custom/views/sale_orders_multi_update.xml new file mode 100644 index 00000000..7f8d6a04 --- /dev/null +++ b/indoteknik_custom/views/sale_orders_multi_update.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="view_sale_orders_multi_update_form" model="ir.ui.view"> + <field name="name">Sale Orders Multi Update</field> + <field name="model">sale.orders.multi_update</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <span>Apakah Anda Yakin Ingin Mengubah Invoice Status?</span> + </group> + </sheet> + <footer> + <button name="save_multi_update_so" string="Multi Update" type="object" default_focus="1" class="oe_highlight"/> + <button string="Cancel" class="btn btn-secondary" special="cancel" /> + </footer> + </form> + </field> + </record> + + <record id="action_sale_orders_multi_update" model="ir.actions.act_window"> + <field name="name">Sale Orders Multi Update</field> + <field name="res_model">sale.orders.multi_update</field> + <field name="type">ir.actions.act_window</field> + <field name="view_mode">form</field> + <field name="view_id" ref="view_sale_orders_multi_update_form"/> + <field name="target">new</field> + </record> + </data> +</odoo>
\ No newline at end of file |
