50 lines
2.9 KiB
Markdown
50 lines
2.9 KiB
Markdown
# pos_export_bc
|
|
|
|
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").
|
|
|
|
User Review Required
|
|
|
|
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").
|
|
|
|
Proposed Changes
|
|
POS Export Module (pos_export_bc)
|
|
[NEW] pos_export_bc/__init__.py
|
|
Initialize the module directories (models, wizard).
|
|
|
|
[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. |