diff options
| author | AndriFP <113114423+andrifp@users.noreply.github.com> | 2025-09-15 16:34:04 +0700 |
|---|---|---|
| committer | AndriFP <113114423+andrifp@users.noreply.github.com> | 2025-09-15 16:34:04 +0700 |
| commit | 462fb823c79d8652a6a08e267b00b13c7bbe5df0 (patch) | |
| tree | 3eb70d1c520b7617a0813a0d0afb9d058178584c | |
| parent | 60ef4aa56889985028a75cc927db80c36bc21338 (diff) | |
| parent | d7647af478bfe2c1b60f00ff2e13327c0ec09be2 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into form-sp
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 16 | ||||
| -rw-r--r-- | indoteknik_custom/report/purchase_report.xml | 130 |
3 files changed, 91 insertions, 57 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index c767dd04..8f49b579 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2644,7 +2644,7 @@ class SaleOrder(models.Model): if user.is_leader or user.is_sales_manager: return True - if user.id in (3401, 20, 3988): # admin (fida, nabila, ninda) + if user.id in (3401, 20, 3988, 17340): # admin (fida, nabila, ninda) return True if self.env.context.get("ask_approval") and user.id in (3401, 20, 3988): diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index d718ba0f..f435dd9f 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -492,14 +492,14 @@ class TukarGuling(models.Model): self.ensure_one() self._check_not_allow_tukar_guling_on_bu_pick() - existing_tukar_guling = self.env['tukar.guling'].search([ - ('operations', '=', self.operations.id), - ('id', '!=', self.id), - ('state', '!=', 'cancel'), - ], limit=1) - - if existing_tukar_guling: - raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + # existing_tukar_guling = self.env['tukar.guling'].search([ + # ('operations', '=', self.operations.id), + # ('id', '!=', self.id), + # ('state', '!=', 'cancel'), + # ], limit=1) + # + # if existing_tukar_guling: + # raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) picking = self.operations if picking.picking_type_id.id == 30 and self.return_type == 'tukar_guling': raise UserError("❌ BU/PICK tidak boleh di retur tukar guling") diff --git a/indoteknik_custom/report/purchase_report.xml b/indoteknik_custom/report/purchase_report.xml index cd8af78a..6666235a 100644 --- a/indoteknik_custom/report/purchase_report.xml +++ b/indoteknik_custom/report/purchase_report.xml @@ -29,44 +29,44 @@ <t t-call="web.html_container"> <t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)" /> - <!-- Header --> + <!-- HEADER --> <div class="header"> <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2498521" - style="width:100%; display: block;"/> + style="width:100%; display:block;"/> </div> - <!-- PAGE CONTENT --> - <div class="article" style="margin: 0 1.5cm 0 1.5cm; "> + <div class="article" style="margin: 0 1.5cm 0 1.5cm; font-family:Arial, sans-serif; font-size:14px; color:#333;"> + <!-- TITLE --> - <h2 style="text-align:center; margin:0; color:#d32f2f; font-weight:bold;"> + <h2 style="text-align:center; margin:8px 0 0 0; color:#d32f2f; font-weight:800; letter-spacing:1px;"> PURCHASE ORDER </h2> - <h4 style="text-align:center; margin:0 0 20px 0;"> + <h4 style="text-align:center; margin:4px 0 20px 0; font-weight:normal; color:#555;"> No. <span t-field="doc.name"/> </h4> <!-- TOP INFO --> - <table style="width:100%; margin-bottom:16px; font-size:14px;"> - <tr> - <td><strong>Term Of Payment:</strong> <span t-field="doc.payment_term_id.name"/></td> - <td><strong>Order Date:</strong> <span t-field="doc.date_order" t-options='{"widget": "date"}'/></td> - <td><strong>Responsible:</strong> <span t-field="doc.user_id"/></td> + <table style="width:100%; margin-bottom:20px; border-radius:8px; box-shadow:0 1px 4px rgba(0,0,0,0.1); overflow:hidden; border:1px solid #ddd;"> + <tr style="background:#fafafa;"> + <td style="padding:10px 12px;"><strong>Term Of Payment:</strong> <span t-field="doc.payment_term_id.name"/></td> + <td style="padding:10px 12px;"><strong>Order Date:</strong> <span t-field="doc.date_order" t-options='{"widget": "date"}'/></td> + <td style="padding:10px 12px;"><strong>Responsible:</strong> <span t-field="doc.user_id"/></td> </tr> </table> <!-- VENDOR & DELIVERY --> - <table style="width:100%; margin-bottom:24px; border-collapse:separate; border-spacing:16px 0;"> + <table style="width:100%; margin-bottom:24px; border-spacing:16px 0;"> <tr> - <td style="width:50%; border:1px solid #ccc; padding:8px; vertical-align:top;"> - <strong>Alamat Pengiriman:</strong><br/> + <td style="width:50%; border:1px solid #ccc; border-radius:8px; padding:10px; background:#fcfcfc; vertical-align:top;"> + <strong style="color:#d32f2f;">Alamat Pengiriman</strong><br/> PT Indoteknik (Bandengan 1 Depan)<br/> Jl. Bandengan Utara Komp A 8 B<br/> RT. Penjaringan, Kec. Penjaringan, Jakarta (BELAKANG INDOMARET)<br/> JK 14440 - Indonesia </td> - <td style="width:50%; border:1px solid #ccc; padding:8px; vertical-align:top;"> - <strong>Nama Vendor:</strong><br/> + <td style="width:50%; border:1px solid #ccc; border-radius:8px; padding:10px; background:#fcfcfc; vertical-align:top;"> + <strong style="color:#d32f2f;">Nama Vendor</strong><br/> <span t-field="doc.partner_id.name"/><br/> <span t-field="doc.partner_id.street"/><br/> <span t-field="doc.partner_id.city"/> - <span t-field="doc.partner_id.zip"/> @@ -75,38 +75,69 @@ </table> <!-- ORDER LINES --> - <table style="border-collapse:collapse; width:100%; margin-top:16px;"> - <thead> - <tr style="background:#f2f2f2;"> - <th style="border:1px solid #ccc; padding:4px;">Description</th> - <th style="border:1px solid #ccc; padding:4px; text-align:right;">Quantity</th> - <th style="border:1px solid #ccc; padding:4px; text-align:right;">Unit Price</th> - <th style="border:1px solid #ccc; padding:4px; text-align:right;">Taxes</th> - <th style="border:1px solid #ccc; padding:4px; text-align:right;">Subtotal</th> - </tr> - </thead> + <table style="border-collapse:collapse; width:100%; margin-top:16px; font-size:14px;"> <tbody> - <t t-foreach="doc.order_line" t-as="line"> - <tr> - <td style="border:1px solid #ccc; padding:4px;"> - <span t-field="line.name"/> + <!-- HEADER --> + <tr style="background:#e53935; color:white;"> + <th style="border:1px solid #ccc; padding:8px; text-align:left;">No. & Description</th> + <th style="border:1px solid #ccc; padding:8px; text-align:left;">Image</th> + <th style="border:1px solid #ccc; padding:8px; text-align:center;">Quantity</th> + <th style="border:1px solid #ccc; padding:8px; text-align:center;">Unit Price</th> + <th style="border:1px solid #ccc; padding:8px; text-align:center;">Taxes</th> + <th style="border:1px solid #ccc; padding:8px; text-align:center;">Subtotal</th> + </tr> + + <!-- ISI ORDER LINE --> + <t t-foreach="doc.order_line" t-as="line" t-index="line_index"> + <tr t-attf-style="background-color: #{ '#fafafa' if line_index % 2 == 0 else 'white' };"> + + <!-- NO & DESCRIPTION + IMAGE --> + <td style="border:1px solid #ccc; padding: 6px; display:flex; align-items:center; gap:10px;"> + <t t-if="not line.image_small"> + <div style="width:40px; height:40px; background:#f5f5f5; border:1px solid #ddd; border-radius:6px; display:flex; align-items:center; justify-content:center; color:#999; font-size:10px;"> + N/A + </div> + </t> + + <!-- TEKS --> + <div style="display:flex; flex-direction:column; flex:1;"> + <span style="font-weight:bold; margin-bottom:2px;"> + <t t-esc="line_index + 1"/>. <t t-esc="line.name"/> + </span> + </div> + </td> + + <t t-if="line.image_small"> + <td style="border:1px solid #ccc; padding:6px; text-align:center;"> + <img t-att-src="image_data_uri(line.image_small)" + style="width:100px; height:100px; object-fit:contain; border:1px solid #ddd; border-radius:6px; background:#fff;"/> </td> - <td style="border:1px solid #ccc; padding:4px; text-align:right;"> + </t> + <!-- QTY --> + <td style="border:1px solid #ccc; padding:6px; text-align:center;"> <span t-field="line.product_qty"/> <span t-field="line.product_uom"/> </td> - <td style="border:1px solid #ccc; padding:4px; text-align:right;"> + + <!-- UNIT PRICE --> + <td style="border:1px solid #ccc; padding:6px; text-align:center;"> <span t-field="line.price_unit"/> </td> - <td style="border:1px solid #ccc; padding:4px; text-align:right;"> + + <!-- TAXES --> + <td style="border:1px solid #ccc; padding:6px; text-align:center;"> <span t-esc="', '.join(map(lambda x: (x.description or x.name), line.taxes_id))"/> </td> - <td style="border:1px solid #ccc; padding:4px; text-align:right;"> + + <!-- SUBTOTAL --> + <td style="border:1px solid #ccc; padding:6px; text-align:right; font-weight:bold;"> <span t-field="line.price_subtotal"/> </td> </tr> + + <!-- WEBSITE DESCRIPTION --> <t t-if="line.product_id.website_description"> - <tr> - <td colspan="5" style="padding:8px 12px; font-size:11px; background:#fafafa; border-left:1px solid #ccc; border-right:1px solid #ccc;"> + <tr t-attf-style="background-color: #{ '#fef5f5' if line_index % 2 == 0 else '#fffafa' }; "> + <td colspan="6" style="padding: 10px 14px; font-size:12px; line-height:1.3; font-style:italic; color:#555; border-left:1px solid #ccc; border-right:1px solid #ccc; border-bottom:1px solid #ccc;"> <div t-raw="line.product_id.website_description"/> </td> </tr> @@ -115,35 +146,38 @@ </tbody> </table> + <!-- TOTALS --> - <table style="margin-top:20px; margin-left:auto; width:40%; font-size:14px;"> - <tr> - <td><strong>Subtotal</strong></td> - <td style="text-align:right;"><span t-field="doc.amount_untaxed"/></td> + <table style="margin-top:24px; margin-left:auto; width:40%; font-size:14px; border:1px solid #ddd; border-radius:6px; box-shadow:0 1px 3px rgba(0,0,0,0.08);"> + <tr style="background:#fafafa;"> + <td style="padding:8px;"><strong>Subtotal</strong></td> + <td style="text-align:right; padding:8px;"><span t-field="doc.amount_untaxed"/></td> </tr> <tr> - <td>Taxes</td> - <td style="text-align:right;"><span t-field="doc.amount_tax"/></td> + <td style="padding:8px;">Taxes</td> + <td style="text-align:right; padding:8px;"><span t-field="doc.amount_tax"/></td> </tr> - <tr> - <td><strong>Total</strong></td> - <td style="text-align:right;"><span t-field="doc.amount_total"/></td> + <tr style="background:#fbe9e7; font-weight:bold; color:#d32f2f;"> + <td style="padding:8px;">Total</td> + <td style="text-align:right; padding:8px;"><span t-field="doc.amount_total"/></td> </tr> </table> <!-- NOTES --> - <div style="margin-top:24px;"> + <div style="margin-top:24px; padding:12px; border-top:1px solid #ddd; font-style:italic; color:#555;"> <p t-field="doc.notes"/> </div> </div> - <!-- STATIC FOOTER --> + + <!-- STATIC FOOTER --> <div class="footer"> <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2859765" - style="width:100%; display: block;"/> + style="width:100%; display:block;"/> </div> </t> </template> + </odoo> |
