# POS Reverse Down Payment This custom Odoo 17 module implements a special workflow for handling down payments in the Point of Sale (POS) where the cashier creates a sales quotation from the POS UI but leaves the standard products in the cart for printing on the receipt. ## Purpose The module resolves a few standard Odoo limitations for specific workflows: 1. **Zero-Priced Quotation Products:** Customers can receive a physical POS receipt displaying all ordered standard items (at 0 price) and a "Down Payment" line at normal price. 2. **Quotation Generation:** A backend Quotation (`sale.order`) is automatically created via XML-RPC. Standard products are pushed onto this Quotation with their original prices and taxes. 3. **No Stock Deductions:** Since the standard products remain in the POS cart at $0 price, Odoo normally tries to create zero-value stock moves. This module intercepts these moves (using `is_quotation_line` flag) to ensure stock doesn't get erroneously deducted before the Quotation is confirmed by backend staff. 4. **Kitchen Order Prevention:** Quotation items are prevented from printing in the kitchen display by overriding the `sendChanges` logic (for `pos_preparation_display` and `pos_restaurant`). 5. **Settlement Stability:** Properly resolves Odoo's internal UI when the cashier eventually loads the Quotation and settles the remaining balance. ## Dependencies - Odoo 17.0 - `point_of_sale` - `pos_sale` - `pos_restaurant` - `pos_preparation_display` ## How it works (Technical Flow) ### 1. POS UI Payment Intercept When processing a payment (`models.js` `pay()` override), the module checks if: - Standard products exist. - A down payment product exists with a positive quantity and price. If true, it asks the cashier if they want to create a quotation. ### 2. Backend RPC Creation If approved, it sends the original list of standard products via `create_quotation_from_pos_lines` in `pos_order.py`. The newly created `sale_order_origin_id` is linked to the down payment line to ensure tracking and eventual invoice settlements match. ### 3. POS Clean Up The cart's standard items are zero-priced and flagged (`is_quotation_line = true`) so the custom JS won't prompt again during final payment validation. ### 4. Printing & Preparation - **Kitchen Tickets**: Checks for positive down payments in `sendChanges`. If found, no items go to the kitchen. - **Stock Moves**: Odoo's `_create_order_picking` natively ignores lines with `is_quotation_line`. ## Installation Clone or copy this repository into your Odoo custom addons path, update the app list, and install the `pos_reverse_downpayment` module. No further configurations are required besides the standard Odoo POS Down Payment product settings.