diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-07-01 13:43:00 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-07-01 13:43:00 +0700 |
| commit | 32e30884a8897bb553be55fae826961af1b970a6 (patch) | |
| tree | c123ffde12bb882de26707a65c68f0a6cc2d11fe | |
| parent | be3af87277be6d884abbcc9f584f52a3871a6869 (diff) | |
fix bug price unit so and create xml report print picking list
| -rwxr-xr-x | fixco_custom/__manifest__.py | 1 | ||||
| -rwxr-xr-x | fixco_custom/models/detail_order.py | 2 | ||||
| -rw-r--r-- | fixco_custom/views/report_picking_list.xml | 119 |
3 files changed, 121 insertions, 1 deletions
diff --git a/fixco_custom/__manifest__.py b/fixco_custom/__manifest__.py index 20d27c0..0d8f259 100755 --- a/fixco_custom/__manifest__.py +++ b/fixco_custom/__manifest__.py @@ -30,6 +30,7 @@ 'views/uangmuka_penjualan.xml', 'views/sale_pricelist.xml', 'views/upload_ginee.xml', + 'views/report_picking_list.xml', ], 'demo': [], 'css': [], diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index f0c0760..f5596d7 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -247,7 +247,7 @@ class DetailOrder(models.Model): line_data = { 'product_id': product.id if product else 5792, 'product_uom_qty': combined_item['quantity'], - 'price_unit': combined_item['actualPrice'] / combined_item['quantity'], # Average price + 'price_unit': combined_item['actualPrice'], } if not product: diff --git a/fixco_custom/views/report_picking_list.xml b/fixco_custom/views/report_picking_list.xml new file mode 100644 index 0000000..1b4ffbe --- /dev/null +++ b/fixco_custom/views/report_picking_list.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <record id="action_print_picking_list" model="ir.actions.report"> + <field name="name">Print Picking List</field> + <field name="model">stock.picking</field> + <field name="report_type">qweb-pdf</field> + <field name="report_name">fixco_custom.report_picking_list_custom</field> + <field name="report_file">fixco_custom.report_picking_list_custom</field> + <field name="print_report_name">'Print Picking List - %s - %s' % (object.partner_id.name or '', object.name)</field> + <field name="binding_model_id" ref="model_stock_picking"/> + <field name="binding_type">report</field> + </record> + </data> + <template id="report_picking_list_custom"> + <t t-call="web.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="web.external_layout"> + <div class="page" style="font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto;"> + <!-- Barcode Header --> + <div style="text-align: right; margin-bottom: -110px;"> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('QR', o.invoice_mp, 100, 100)" + style="width:100px;height:100px;" alt="QR Code"/> + </div> + + <!-- Main Header --> + <div style="text-align: center; margin-bottom: 15px;"> + <h1 style="margin: 0; font-size: 24px; font-weight: bold;" t-field="o.name"/> + <div style="font-size: 18px; font-weight: bold; margin-top: 5px;"> + Web Service + </div> + </div> + + <!-- Order Information --> + <div style="display: flex; justify-content: space-between; margin-bottom: 20px; border-bottom: 1px solid #000; padding-bottom: 10px;"> + <div> + <strong>Order:</strong> + <span t-field="o.origin"/> + </div> + <div> + <strong>Scheduled Date:</strong> + <span t-field="o.scheduled_date" t-options='{"format": "dd MMM yyyy HH:mm:ss"}'/> + </div> + <div> + <strong>Carrier:</strong> + <span t-field="o.carrier"/> + </div> + </div> + + <!-- Product Table --> + <table style="width: 100%; border-collapse: collapse; margin-bottom: 30px;"> + <thead> + <tr style="border-bottom: 2px solid #000;"> + <th style="width: 5%; text-align: left; padding: 8px 5px;">No</th> + <th style="width: 40%; text-align: left; padding: 8px 5px;">Nama Product</th> + <th style="width: 10%; text-align: center; padding: 8px 5px;">Demand</th> + <th style="width: 10%; text-align: center; padding: 8px 5px;">Reserved</th> + <th style="width: 20%; text-align: left; padding: 8px 5px;">Location</th> + <th style="width: 15%; text-align: left; padding: 8px 5px;">Uom</th> + </tr> + </thead> + <tbody> + <t t-set="counter" t-value="0"/> + <t t-foreach="o.move_ids_without_package" t-as="move"> + <t t-set="counter" t-value="counter + 1"/> + <tr style="border-bottom: 1px solid #ddd;"> + <td style="padding: 8px 5px; vertical-align: top;"><t t-esc="counter"/></td> + <td style="padding: 8px 5px; vertical-align: top;"> + <div style="font-weight: bold;"> + [<span t-field="move.product_id.default_code"/>] + </div> + <div style="margin-top: 3px;"> + <span t-field="move.product_id.name"/> + </div> + </td> + <td style="text-align: center; padding: 8px 5px; vertical-align: top;"> + <t t-esc="move.product_uom_qty if move.product_uom_qty else 0"/> + </td> + <td style="text-align: center; padding: 8px 5px; vertical-align: top;"> + <t t-esc="move.reserved_availability if move.reserved_availability > 0 else 0"/> + </td> + <td style="padding: 8px 5px; vertical-align: top;"> + <span t-field="move.location_id.name"/> + </td> + <td style="padding: 8px 5px; vertical-align: top;"> + <span t-field="move.product_uom.name"/> + </td> + </tr> + </t> + </tbody> + </table> + + <!-- Footer Information --> + <div style="display: flex; justify-content: space-between; border-top: 1px solid #000; padding-top: 15px;"> + <div style="font-weight: bold;"> + Total Qty: + <t t-set="total_qty" t-value="0"/> + <t t-foreach="o.move_ids_without_package" t-as="move"> + <t t-set="total_qty" t-value="total_qty + (move.product_uom_qty or 0)"/> + </t> + <t t-esc="total_qty"/> + </div> + <div style="font-weight: bold;"> + Jumlah Barang: + <t t-esc="counter"/> + </div> + </div> + + <!-- Notes Section --> + <div t-if="o.note" style="margin-top: 30px; padding: 10px; border: 1px solid #ddd; background-color: #f9f9f9;"> + <strong>Catatan:</strong> + <p t-field="o.note"/> + </div> + </div> + </t> + </t> + </t> + </template> +</odoo>
\ No newline at end of file |
