From 1afc1556378501525af1dd8a13b72c74406e49f4 Mon Sep 17 00:00:00 2001 From: Abdul Aziz Amrullah Date: Thu, 2 Apr 2026 10:59:32 +0700 Subject: [PATCH] update README.md --- README.md | 68 +++++++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 3d1c4c3..0e00fd0 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,28 @@ -# pos_export_bc +# POS Export BC Format -POS Export BC Format Module -This module adds a new wizard in the POS backend to export sales data into a specific Excel format ("BC Format"). +This is a custom Odoo 19 module that allows users to export Point of Sale (POS) orders and sales data into a structured Excel format named "MIE MAPAN INVOICES". -User Review Required +## Features +- **Custom Excel Generation:** Generates a visually matching Excel file with specific columns and aggregated row formatting. +- **Order-Level Row Grouping:** In the Excel file, aggregate data such as *Total*, *Tax*, *Paid*, *Return*, and *Subtotal* are populated only on the first row of each order to visually indicate grouping. +- **Multiple Sheets:** Generates two sheets dynamically: + - **Invoice**: For orders with a positive total amount. + - **Refund**: For orders with a negative total amount. +- **Custom SKU Integration:** Specifically fetches the custom field `x_studio_popcorn_sku` created via Odoo Studio as the primary product SKU identifier. +- **Date Formatting Consistency:** Exports datetime fields like "Date" and "Paid At" directly as raw strings (e.g. `11-03-2026 15:30:00`) to prevent spreadsheet applications from aggressively auto-formatting dates unexpectedly. -NOTE -The current plan maps the requested Excel columns to standard Odoo POS fields as closely as possible. Columns like "Takeaway Charge", "Packaging Fee", "Service" will be left empty or 0 if there's no clear standard Odoo field for them. If you have custom fields for these on the pos.order model, please let me know so I can map them accurately. "Price Type" is mapped to the POS Order's Pricelist name. "Table/Customer" will prefer the Table name (if dining in) or Customer name. "Dinein" will be inferred based on whether a Table is set ("dinein") or not ("takeaway"). +## Requirements +This module requires the Python `xlsxwriter` package to format and generate memory-based Excel files. +```sh +pip install xlsxwriter +``` -Proposed Changes -POS Export Module (pos_export_bc) -[NEW] pos_export_bc/__init__.py -Initialize the module directories (models, wizard). +## Usage +1. Make sure you have installed the module from the Odoo Apps menu. +2. Navigate to **Point of Sale** -> **Reporting** -> **Export BC Format**. +3. A wizard will pop up asking for the **Start Date** and **End Date**. +4. Select the desired period and click **Export**. +5. Your browser will download the generated `.xlsx` file. -[NEW] pos_export_bc/__manifest__.py -Define module metadata, dependencies (point_of_sale), and data files to load (wizard view, security). - -[NEW] pos_export_bc/wizard/__init__.py -Import the wizard models. - -[NEW] pos_export_bc/wizard/pos_export_bc_wizard.py -A TransientModel (pos.export.bc.wizard) that: - -Prompts for start_date and end_date. -Has an action_export_bc method to query pos.order within the date range. -Uses xlsxwriter (or similar standard library) via io.BytesIO to generate the Excel file. -Generates 2 sheets: "Invoice" (orders where amount_total >= 0) and "Refund" (orders where amount_total < 0). -Writes the specific headers and loops through every order line. Order-level values (Subtotal, Tax, Charge, etc.) are only written on the first row of each order to match the screenshot format. -Returns a UI action to download the generated file. -[NEW] pos_export_bc/wizard/pos_export_bc_wizard_views.xml -Defines the Form view for the wizard containing the start_date, end_date inputs, and the "Export to BC Format" button. Also defines an Action and a Menu Item under Point of Sale > Reporting > Export BC Format. - -[NEW] pos_export_bc/security/ir.model.access.csv -Grants read/write access to the pos.export.bc.wizard model so users can open and run it. - -Verification Plan -Automated Tests -This is a UI export tool, so no complex backend automated tests will be added initially unless requested. We will rely on manual verification to ensure the Excel output exactly matches the user's expected visual layout. - -Manual Verification -1. Install the pos_export_bc module locally or on the Odoo instance. -2. Go to Point of Sale > Reporting > Export BC Format. -3. Select a date range that contains some existing POS orders. -4. Click Export to BC Format. -5. Download the Excel file and open it. -6. Verify the file has "Invoice" and "Refund" sheets. -7. Verify the headers match exactly: No, Date, Outlet, Table/Customer, Invoice, Category, SKU, Product, etc. -8. Verify "MIE MAPAN" and "INVOICES" titles are present at the top. -9. Verify order-level data is correctly row-grouped as per the provided screenshot. \ No newline at end of file +## Technical Details +This module creates a TransientModel `pos.export.bc.wizard`. Upon clicking export, `action_export_bc()` queries `pos.order` based on the dates provided and reconstructs the data into an `io.BytesIO` buffer, which is temporarily saved as an `ir.attachment` and served back to the user via a `/web/content/...` download URL act window.