update README.md

This commit is contained in:
Abdul Aziz Amrullah 2026-04-02 10:59:32 +07:00
parent 3ccb3eba63
commit 1afc155637

View File

@ -1,50 +1,28 @@
# pos_export_bc # POS Export BC Format
POS Export BC Format Module 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".
This module adds a new wizard in the POS backend to export sales data into a specific Excel format ("BC Format").
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 ## Requirements
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"). This module requires the Python `xlsxwriter` package to format and generate memory-based Excel files.
```sh
pip install xlsxwriter
```
Proposed Changes ## Usage
POS Export Module (pos_export_bc) 1. Make sure you have installed the module from the Odoo Apps menu.
[NEW] pos_export_bc/__init__.py 2. Navigate to **Point of Sale** -> **Reporting** -> **Export BC Format**.
Initialize the module directories (models, wizard). 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 ## Technical Details
Define module metadata, dependencies (point_of_sale), and data files to load (wizard view, security). 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.
[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.