Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] rental_deposit: added deposit in rental #422

Draft
wants to merge 6 commits into
base: 18.0
Choose a base branch
from

Conversation

ppch-odoo
Copy link

@ppch-odoo ppch-odoo commented Feb 26, 2025

  • Added deposit product in config settings by inheriting res_config_settings model
  • Added require deposit and deposit amount in product template by inhering
    product_template model
  • Added inherited view for template as well as config settings and inherited view for product template
  • Deposit will be added in sale order line when any product is selected in which
    deposit is configured
  • Also added write override, if product or quantity is changed then it reflects
    to deposit also
  • Added unlink override if product which has deposit and removed it from sale
    order line then remove deposit also
  • In website module on rental product, required deposit will be displayed
  • Ensured that only one deposit added when duplicating sale order
  • Controller added to track qty from website
  • Ensured that on duplicating more than one sale order ensure that it works perfectly
  • Extended controller class to get qty in website
  • Extended Widget to display deposit which change based on required quantity

task - 4605761

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
added deposit product in config settings by inheriting res_config_settings model
added require deposit and deposit amount in product template by inhering
product_template model
added inherited view for template as well as config settings
also inherited view for product template

task - 4605761
@robodoo
Copy link

robodoo commented Feb 26, 2025

Pull request status dashboard

- Deposit will be added in sale order line when any product is selected in which
  deposit is configured
- Also added write override, if  product or quantity is changed then it reflects
  to deposit also
- Added unlink override if product which has deposit and removed it from sale
  order line then remove deposit also
- In website module on rental product, required deposit will be displayed

task - 4605761
- Ensured that only one deposit added when duplicating sale order
- Controller added to track qty from website.
- improved sale order line creation logic

task - 4605761
- Ensured that on duplicating more than one sale order ensure that it works perfectly
- Onchange method is defined in product_template

task - 4605761
@api.onchange('require_deposit')
def _onchange_require_deposit(self):
self.write({
'deposit_amount': 0 if self.require_deposit else 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed
I was checking that if someone after setting a deposit untick then retick on that time it should be zero.
But it i forgot to remove it
so i will remove it

vals_list = super().copy_data(default=default)
for order, vals in zip(self, vals_list):
vals['order_line'] = [
Command.create(line)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where have you define line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

below line 19, in for loop

Command.create(line)
for line in order._get_copiable_order_lines_without_deposit().copy_data()

- Removed onchange_require_deposit as not needed
- Instead of direct creating deposit line used list to create it
- Extended controller class to get qty in website
- Extended Widget to display deposit which change based on required quantity
- sudo() removed as without bypassing access rights we can get deposit product
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.

None yet

3 participants