Skip to content

[ADD] rental_deposit: adding deposit to rental products.#1274

Draft
adpaw-odoo wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-rental-deposit-adpaw
Draft

[ADD] rental_deposit: adding deposit to rental products.#1274
adpaw-odoo wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-rental-deposit-adpaw

Conversation

@adpaw-odoo
Copy link
Copy Markdown

Introduced a new custom module that adds deposit configuration on rental products and automatically manages deposit lines on sale orders and the webshop. This allows businesses to enforce a refundable deposit whenever a rental product is added, both from the backend and the frontend.

WHY this change is being made:
Currently, when a customer rents a product there is no built-in way to collect or track a deposit amount tied to that rental. Salespersons had to manually add deposit lines every time, which is error-prone and inconsistent. This module automates that process and ensures deposit lines are always present, correctly priced, and protected from accidental edits or deletions.

Technical decisions taken:

  1. Added require_deposit (Boolean) and 'deposit_amount' on 'product.template' to allow per-product deposit configuration under the Rental Prices tab.
  2. Extended 'res.company' with 'deposit_product_id' and exposed it via 'res.config.settings' using 'related=' to set a global deposit product that gets added as the order line product.
  3. Overrode create on sale.order.line with @api.model_create_multi to auto-add a deposit line whenever a qualifying rental product is added.
  4. Implemented write and @api.ondelete overrides to keep deposit line quantity in sync and remove it when the rental line is deleted.
  5. Used context keys skip_deposit_write_check and skip_deposit_delete_check to allow internal updates while blocking direct user edits on deposit lines.
  6. Inherited the webshop product template to display the deposit amount and added a JS widget (RentalDepositWidget) to update the displayed amount dynamically when the quantity selector is changed by the customer.

@robodoo
Copy link
Copy Markdown

robodoo commented May 18, 2026

Pull request status dashboard

@adpaw-odoo adpaw-odoo force-pushed the 19.0-rental-deposit-adpaw branch from b879c60 to ee14089 Compare May 19, 2026 05:19
- Added  and  fields on  to
allow per-product deposit configuration
- Added  on , exposed via config settings
- Auto-add/update/delete deposit line on sale order via CRUD overrides
- Blocked direct editing or deletion of deposit lines using context guards
- Added deposit display on webshop product page with dynamic qty update
@adpaw-odoo adpaw-odoo force-pushed the 19.0-rental-deposit-adpaw branch from ee14089 to 9861912 Compare May 19, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants