diff --git a/product_rental_security_deposit/__init__.py b/product_rental_security_deposit/__init__.py new file mode 100755 index 0000000..cde864b --- /dev/null +++ b/product_rental_security_deposit/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/product_rental_security_deposit/__manifest__.py b/product_rental_security_deposit/__manifest__.py new file mode 100755 index 0000000..4bb5430 --- /dev/null +++ b/product_rental_security_deposit/__manifest__.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +{ + "name": "Product Rental Security Deposit", + "category": "Product", + "version": "14.0.1.0", + "summary": "Manage security deposits in your rental contracts", + "author": "Elabore", + "website": "https://elabore.coop/", + "installable": True, + "application": False, + "auto_install": False, + "description": """ +=============================== +Product Rental Security Deposit +=============================== +This module allows to manage security deposits in rental contracts. + +Installation +============ +Just install product_rental_security_deposit, all dependencies will be installed by default. + +Known issues / Roadmap +====================== + +Bug Tracker +=========== +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ +* Elabore: `Icon `_. + +Contributors +------------ +* Stéphan Sainléger + +Funders +------- +The development of this module has been financially supported by: +* Elabore (https://elabore.coop) + +Maintainer +---------- +This module is maintained by ELABORE. + +""", + "depends": [ + "product_rental_bookings", + ], + "data": [ + "views/product_contract.xml", + ], + "qweb": [], +} diff --git a/product_rental_security_deposit/i18n/fr.po b/product_rental_security_deposit/i18n/fr.po new file mode 100644 index 0000000..47b847d --- /dev/null +++ b/product_rental_security_deposit/i18n/fr.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_rental_inspection +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-09-29 14:44+0000\n" +"PO-Revision-Date: 2021-09-29 14:44+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + + +#. module: product_rental_security_deposit +#: model:ir.model.fields,field_description:product_rental_security_deposit.field_rental_product_contract__security_deposit +msgid "Security Deposit" +msgstr "Caution" \ No newline at end of file diff --git a/product_rental_security_deposit/models/__init__.py b/product_rental_security_deposit/models/__init__.py new file mode 100644 index 0000000..9f10caf --- /dev/null +++ b/product_rental_security_deposit/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import product_contract diff --git a/product_rental_security_deposit/models/product_contract.py b/product_rental_security_deposit/models/product_contract.py new file mode 100644 index 0000000..aff23d4 --- /dev/null +++ b/product_rental_security_deposit/models/product_contract.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +from logging import setLogRecordFactory +from odoo import fields, api, models, _ + + +class RentalProductContract(models.Model): + _inherit = "rental.product.contract" + + security_deposit = fields.Monetary(string=_("Security Deposit")) + + @api.onchange("security_deposit") + def add_security_deposit(self): + if self.security_deposit and self.product_contract_lines_ids: + line_id = self.product_contract_lines_ids.filtered( + lambda x: x.description == "Deposit" + ) + if line_id: + line_id.price = self.security_deposit + else: + self.write( + { + "product_contract_lines_ids": [ + ( + 0, + 0, + { + "description": "Deposit", + "enter_days": 1.0, + "price": self.security_deposit, + }, + ) + ] + } + ) + + @api.depends("product_contract_lines_ids", "security_deposit") + def _compute_amount(self): + super(RentalProductContract, self)._compute_amount() diff --git a/product_rental_security_deposit/views/product_contract.xml b/product_rental_security_deposit/views/product_contract.xml new file mode 100644 index 0000000..d9dc3d7 --- /dev/null +++ b/product_rental_security_deposit/views/product_contract.xml @@ -0,0 +1,16 @@ + + + + + + Rental Contracts Deposit + rental.product.contract + + + + + + + + + \ No newline at end of file