# Purchase Export BC Format **Purchase Export BC Format** is a custom Odoo 19 module that provides functionality to export a Purchase Order's details into an Excel (`.xlsx`) format. ## Features - **One-Click Export**: Adds an "Export PO to BC Format" button directly inside the header of the Purchase Order form view (visible in the `purchase` or `done` states). - **Automated Categorization**: Groups the purchase order lines by their Product Category. For each category, a dedicated worksheet is created in the generated Excel file. - **Custom Data Mapping**: Fetches specific product data, such as a custom field `x_studio_bc_item_id` for custom Item Numbers. - **Unit of Measure Handling**: Intelligently determines the "Satuan" (Unit), favoring the Product Packaging if defined, and otherwise falling back to the standard Unit of Measure (`product_uom_id`). ## Excel File Structure For each generated worksheet (named after the product category), the layout is strictly mapped according to the requested BC format: | Column Header | Data Source / Description | |---|---| | **Type** | Static value `Item`. | | **Item No.** | The value from the product's custom field `x_studio_bc_item_id`. | | **Description** | The Product's name. | | **Qty** | The ordered quantity. | | **Satuan** | The Packaging used (if any). If none, it uses the product's Unit of Measure name. | ## Installation 1. Place the `purchase_export_bc` module directory into your Odoo 19 `custom` addons path. 2. Restart the Odoo server. 3. Turn on **Developer Mode** in Odoo. 4. Go to **Apps** -> **Update Apps List**. 5. Search for `Purchase Export BC Format` and click **Activate**. 6. **Requirement**: Ensure that the Python library `xlsxwriter` is installed in your Odoo environment: ```bash pip install xlsxwriter ``` ## Usage 1. Navigate to the **Purchase** app in Odoo. 2. Open any existing Purchase Order that is confirmed. 3. Click the **Export PO to BC Format** button located in the header. 4. The system will automatically generate and prompt you to download the Excel file named `PO_Export_BC_[Order_Name].xlsx`. ## Author - Aziz