diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-06 11:20:22 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-06 11:20:22 +0700 |
| commit | 3a818abaab201a82bbba6736adb83c26958338d2 (patch) | |
| tree | 7040c23168f61184810d336f5b781ade42a45857 | |
| parent | 7712141e5fa515eb6b966ae63956e7bbb3f384f3 (diff) | |
| parent | 9602db0d08b64f50e02d3e25ab3846221bf2cb08 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 13 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 21 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 |
3 files changed, 34 insertions, 1 deletions
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"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>" + f"<b>Note Return (Pinned):</b><br>{reason}</div>", + subtype_id=self.env.ref("mail.mt_note").id + ) def re_calculate(self): if self.from_apo: 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: 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 @@ <field name="code">model.procure_calculation()</field> <field name="state">code</field> <field name="priority">75</field> - <field name="active">True</field> </record> </data> <data> |
