From 860edce900b22241d5f75e1e4613945c577e1c14 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 27 Feb 2025 15:25:13 +0700 Subject: update code jaga jaga kalau so tidak ter-cancel --- indoteknik_custom/models/sale_order.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index f53041cb..d6b5e848 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1162,6 +1162,8 @@ class SaleOrder(models.Model): def confirm_cancel_order(self): """Fungsi ini akan dipanggil oleh wizard setelah alasan pembatalan dipilih""" + if self.state != 'cancel': + self.state = 'cancel' return super(SaleOrder, self).action_cancel() def validate_partner_invoice_due(self): -- cgit v1.2.3 From 74950ab252b92c23b2b5dc754fa4d86a28052145 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Fri, 28 Feb 2025 09:57:52 +0700 Subject: update xml coretax --- indoteknik_custom/models/coretax_fatur.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py index 706a4f44..fec53779 100644 --- a/indoteknik_custom/models/coretax_fatur.py +++ b/indoteknik_custom/models/coretax_fatur.py @@ -59,6 +59,7 @@ class CoretaxFaktur(models.Model): ET.SubElement(tax_invoice, 'TrxCode').text = '04' ET.SubElement(tax_invoice, 'AddInfo') ET.SubElement(tax_invoice, 'CustomDoc') + ET.SubElement(tax_invoice, 'CustomDocMonthYearCustomDocMonthYear') ET.SubElement(tax_invoice, 'RefDesc').text = invoice.name ET.SubElement(tax_invoice, 'FacilityStamp') ET.SubElement(tax_invoice, 'SellerIDTKU').text = '0742260227086000000000' -- cgit v1.2.3 From d67c586c80d87e7e2f3da703cd04e6680fbd62b7 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Fri, 28 Feb 2025 10:47:57 +0700 Subject: update bugs coretax xml --- indoteknik_custom/models/coretax_fatur.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py index fec53779..b4bffbd2 100644 --- a/indoteknik_custom/models/coretax_fatur.py +++ b/indoteknik_custom/models/coretax_fatur.py @@ -59,7 +59,7 @@ class CoretaxFaktur(models.Model): ET.SubElement(tax_invoice, 'TrxCode').text = '04' ET.SubElement(tax_invoice, 'AddInfo') ET.SubElement(tax_invoice, 'CustomDoc') - ET.SubElement(tax_invoice, 'CustomDocMonthYearCustomDocMonthYear') + ET.SubElement(tax_invoice, 'CustomDocMonthYear') ET.SubElement(tax_invoice, 'RefDesc').text = invoice.name ET.SubElement(tax_invoice, 'FacilityStamp') ET.SubElement(tax_invoice, 'SellerIDTKU').text = '0742260227086000000000' -- cgit v1.2.3 From 7c675cd5bc9f45d2ebca33a63b7184cbb97f0f2f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 3 Mar 2025 09:16:21 +0700 Subject: CR safa add log note when product detail change --- indoteknik_custom/models/requisition.py | 42 ++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index c972b485..1d350929 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -276,10 +276,11 @@ class RequisitionLine(models.Model): _name = 'requisition.line' _description = 'Requisition Line' _order = 'requisition_id, id' + _inherit = ['mail.thread'] requisition_id = fields.Many2one('requisition', string='Ref', required=True, ondelete='cascade', index=True, copy=False) brand_id = fields.Many2one('x_manufactures', string='Brand') - product_id = fields.Many2one('product.product', string='Product') + product_id = fields.Many2one('product.product', string='Product', tracking=3,) partner_id = fields.Many2one('res.partner', string='Vendor') qty_purchase = fields.Float(string='Qty Purchase') price_unit = fields.Float(string='Price') @@ -331,6 +332,45 @@ class RequisitionLine(models.Model): line.taxes_id = taxes line.partner_id = purchase_pricelist.vendor_id.id + @api.model + def create(self, vals): + record = super(RequisitionLine, self).create(vals) + record._track_changes('Tambah') + return record + + def write(self, vals): + for record in self: + old_values = {field: record[field] for field in vals if field in record} + + result = super(RequisitionLine, self).write(vals) + + for record in self: + record._track_changes('Updated', old_values) + + return result + + def unlink(self): + for record in self: + record._track_changes('Hapus') + return super(RequisitionLine, self).unlink() + + def _track_changes(self, action, old_values=None): + message = f"Produk telah di-{action} :
" + if action == 'Tambah': + # message += f"
Product: {self.product_id.name}" + message += f"Product: {self.product_id.name}
Vendor: {self.partner_id.name}
Qty: {self.qty_purchase}
Price: {self.price_unit}
Tax: {self.tax_id.name}
Subtotal: {self.subtotal}
Brand: {self.brand_id.x_name}" + elif action == 'Hapus': + # message += f"
Deleted Product: {self.product_id.name}" + message += f"
Deleted Product: {self.product_id.name}
Vendor: {self.partner_id.name} Qty: {self.qty_purchase}
Price: {self.price_unit}
Tax: {self.tax_id.name}
Subtotal: {self.subtotal}
Brand: {self.brand_id.x_name}" + else: # Updated + for field, old_value in old_values.items(): + new_value = self[field] + if old_value != new_value: + field_label = self._fields[field].string # Ambil nama label field + message += f"{field_label}: {old_value} -> {new_value}
" + + if self.requisition_id: + self.requisition_id.message_post(body=message) class RequisitionPurchaseMatch(models.Model): _name = 'requisition.purchase.match' -- cgit v1.2.3 From cc170c5420fd8854303a63dba59065ab0f87c94e Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 4 Mar 2025 10:00:53 +0700 Subject: multi ask approval po and source document bills --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/account_move.py | 1 + indoteknik_custom/models/purchase_order.py | 17 ++++++++++++ .../models/purchase_order_multi_ask_approval.py | 22 +++++++++++++++ indoteknik_custom/security/ir.model.access.csv | 1 + indoteknik_custom/views/account_move.xml | 1 + indoteknik_custom/views/purchase_order.xml | 9 +++++++ .../views/purchase_order_multi_ask_approval.xml | 31 ++++++++++++++++++++++ 9 files changed, 84 insertions(+) create mode 100644 indoteknik_custom/models/purchase_order_multi_ask_approval.py create mode 100644 indoteknik_custom/views/purchase_order_multi_ask_approval.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index ac887547..f66314fa 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -118,6 +118,7 @@ 'views/sale_monitoring_detail_v2.xml', 'views/purchase_order_multi_update.xml', 'views/purchase_order_multi_confirm.xml', + 'views/purchase_order_multi_ask_approval.xml', 'views/invoice_reklas_penjualan.xml', 'views/po_multi_cancel.xml', 'views/logbook_sj.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index f33a7411..3573eddd 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -106,6 +106,7 @@ from . import sale_monitoring_detail_v2 from . import purchase_order_multi_update from . import invoice_reklas_penjualan from . import purchase_order_multi_confirm +from . import purchase_order_multi_ask_approval from . import po_multi_cancel from . import logbook_sj from . import report_logbook_sj diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b2ac47c2..9aa0743b 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -65,6 +65,7 @@ class AccountMove(models.Model): other_subtotal = fields.Float(string="Other Subtotal", compute='compute_other_subtotal') other_taxes = fields.Float(string="Other Taxes", compute='compute_other_taxes') is_hr = fields.Boolean(string="Is HR?", default=False) + purchase_order_id = fields.Many2one('purchase.order', string='Purchase Order') def _update_line_name_from_ref(self): """Update all account.move.line name fields with ref from account.move""" diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 54d771ba..d90c4a8a 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -155,6 +155,7 @@ class PurchaseOrder(models.Model): 'invoice_date': current_date, 'date': current_date, 'invoice_origin': self.name, + 'purchase_order_id': self.id, 'move_type': 'in_invoice' } @@ -231,6 +232,7 @@ class PurchaseOrder(models.Model): 'invoice_date': current_date, 'date': current_date, 'invoice_origin': self.name, + 'purchase_order_id': self.id, 'move_type': 'in_invoice' } @@ -307,6 +309,7 @@ class PurchaseOrder(models.Model): invoice_vals = { 'ref': self.partner_ref or '', 'move_type': move_type, + 'purchase_order_id': self.id, 'narration': self.notes, 'currency_id': self.currency_id.id, 'invoice_user_id': self.user_id and self.user_id.id or self.env.user.id, @@ -388,6 +391,13 @@ class PurchaseOrder(models.Model): } return action + def open_form_multi_ask_approval_po(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_purchase_order_multi_ask_approval') + action['context'] = { + 'po_ids': [x.id for x in self] + } + return action + def open_form_multi_create_uang_muka(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_purchase_order_multi_uangmuka') action['context'] = { @@ -415,6 +425,13 @@ class PurchaseOrder(models.Model): purchase.button_confirm() + def action_multi_ask_approval_po(self): + for purchase in self: + if purchase.state != 'draft': + continue + + purchase.po_approve() + 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_ask_approval.py b/indoteknik_custom/models/purchase_order_multi_ask_approval.py new file mode 100644 index 00000000..69f8e5a8 --- /dev/null +++ b/indoteknik_custom/models/purchase_order_multi_ask_approval.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class PurchaseOrderMultiUpdate(models.TransientModel): + _name = 'purchase.order.multi_ask_approval' + + def save_multi_ask_approval_po(self): + po_ids = self._context['po_ids'] + purchase = self.env['purchase.order'].browse(po_ids) + purchase.action_multi_ask_approval_po() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'PO berhasil di ask_approval', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } \ No newline at end of file diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 75b3bf48..5e0c2221 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -105,6 +105,7 @@ access_purchase_order_multi_update,access.purchase.order.multi_update,model_purc access_invoice_reklas_penjualan,access.invoice.reklas.penjualan,model_invoice_reklas_penjualan,,1,1,1,1 access_invoice_reklas_penjualan_line,access.invoice.reklas.penjualan.line,model_invoice_reklas_penjualan_line,,1,1,1,1 access_purchase_order_multi_confirm,access.purchase.order.multi_confirm,model_purchase_order_multi_confirm,,1,1,1,1 +access_purchase_order_multi_ask_approval,access.purchase.order.multi_ask_approval,model_purchase_order_multi_ask_approval,,1,1,1,1 access_po_multi_cancel,access.po.multi.cancel,model_po_multi_cancel,,1,1,1,1 access_logbook_sj,access.logbook.sj,model_logbook_sj,,1,1,1,1 access_logbook_sj_line,access.logbook.sj.line,model_logbook_sj_line,,1,1,1,1 diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 50a34e11..17263c3a 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -27,6 +27,7 @@ + diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index a57bd467..36c0db13 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -330,6 +330,15 @@ action = records.open_form_multi_confirm_po() + + + Ask Approval PO + + + code + action = records.open_form_multi_ask_approval_po() + + Uang Muka diff --git a/indoteknik_custom/views/purchase_order_multi_ask_approval.xml b/indoteknik_custom/views/purchase_order_multi_ask_approval.xml new file mode 100644 index 00000000..887ac0bd --- /dev/null +++ b/indoteknik_custom/views/purchase_order_multi_ask_approval.xml @@ -0,0 +1,31 @@ + + + + + Purchase Order Multi ask_approval + purchase.order.multi_ask_approval + +
+ + + Apakah Anda Yakin Ingin Ask Approval PO Tersebut? + + +
+
+
+
+
+ + + Purchase Order Multi ask_approval + purchase.order.multi_ask_approval + ir.actions.act_window + form + + new + +
+
\ No newline at end of file -- cgit v1.2.3 From 92b6da28414fed56732f86e1f04ea2fac3464d7d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 4 Mar 2025 13:26:28 +0700 Subject: add reason cancel quotation --- indoteknik_custom/models/sale_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d6b5e848..8a983479 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -25,6 +25,7 @@ class CancelReasonOrder(models.TransientModel): ('dokumen_tidak_support', 'Indoteknik tidak bisa support document yang dibutuhkan (Ex: TKDN, COO, SNI)'), ('ganti_quotation', 'Ganti Quotation'), ('testing_internal', 'Testing Internal'), + ('revisi_data', 'Revisi Data'), ], string='Reason for Cancel', required=True, copy=False, index=True, tracking=3) attachment_bukti = fields.Many2many( 'ir.attachment', -- cgit v1.2.3