From 7afd1ef51e18f9dcb1c0e71ea1e512b52284d3d1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 5 Nov 2024 11:09:46 +0700 Subject: add sticky note while ask approval --- indoteknik_custom/models/purchase_order.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 393fc562..6fc0c497 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -730,7 +730,20 @@ class PurchaseOrder(models.Model): elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id: raise UserError("Bisa langsung Confirm") else: + reason = '' self.approval_status = 'pengajuan1' + if self.amount_untaxed >= 50000000: + reason = 'above 50jt, ' + if self.total_percent_margin < self.total_so_percent_margin: + reason += 'diff margin, ' + if not self.from_apo and not self.sale_order_id: + reason += 'not link with sales, ' + # Post a highlighted message to lognote + self.message_post( + body=f"
" + f"Note Return (Pinned):
{reason}
", + subtype_id=self.env.ref("mail.mt_note").id + ) def re_calculate(self): if self.from_apo: -- cgit v1.2.3 From 772d42fba3fddccd3ca951bbedadeca4044593a9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 5 Nov 2024 12:04:45 +0700 Subject: add error handling ask aproval --- indoteknik_custom/models/sale_order.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 1ad08154..8e170b1c 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -768,7 +768,28 @@ class SaleOrder(models.Model): self._validate_order() for order in self: order.order_line.validate_line() + order.check_data_real_delivery_address() + order._validate_order() + order.sale_order_check_approve() + + main_parent = order.partner_id.get_main_parent() + SYSTEM_UID = 25 + FROM_WEBSITE = order.create_uid.id == SYSTEM_UID + if FROM_WEBSITE and main_parent.use_so_approval and order.web_approval not in ['cust_procurement','cust_director']: + raise UserError("This order not yet approved by customer procurement or director") + + if not order.client_order_ref and order.create_date > datetime(2024, 6, 27): + raise UserError("Customer Reference kosong, di isi dengan NO PO jika PO tidak ada mohon ditulis Tanpa PO") + + if not order.commitment_date and order.create_date > datetime(2024, 9, 12): + raise UserError("Expected Delivery Date kosong, wajib diisi") + + if not order.real_shipping_id: + UserError('Real Delivery Address harus di isi') + + if order.validate_partner_invoice_due(): + return self._create_notification_action('Notification','Terdapat invoice yang telah melewati batas waktu, mohon perbarui pada dokumen Due Extension') term_days = 0 for term_line in order.payment_term_id.line_ids: -- cgit v1.2.3 From 9602db0d08b64f50e02d3e25ab3846221bf2cb08 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 5 Nov 2024 13:22:35 +0700 Subject: temporary disable reserve stock --- indoteknik_custom/views/purchase_order.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 06c76a82..0e6b6792 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -212,7 +212,6 @@ model.procure_calculation() code 75 - True -- cgit v1.2.3