diff --git a/installement/__init__.py b/installement/__init__.py
new file mode 100644
index 0000000000..9b4296142f
--- /dev/null
+++ b/installement/__init__.py
@@ -0,0 +1,2 @@
+from . import models
+from . import wizard
diff --git a/installement/__manifest__.py b/installement/__manifest__.py
new file mode 100644
index 0000000000..34e7edb134
--- /dev/null
+++ b/installement/__manifest__.py
@@ -0,0 +1,14 @@
+{
+ 'name': 'Installement App',
+ 'version': '17.0',
+ 'depends': ['base', 'sale'],
+ 'license': 'LGPL-3',
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'wizard/add_emi_button_wizard_views.xml',
+ 'views/add_emi_button_views.xml',
+ 'views/res_config_settings_views.xml'
+ ],
+ 'installable': True,
+ 'application': True,
+}
diff --git a/installement/models/__init__.py b/installement/models/__init__.py
new file mode 100644
index 0000000000..0deb68c468
--- /dev/null
+++ b/installement/models/__init__.py
@@ -0,0 +1 @@
+from . import res_config_settings
diff --git a/installement/models/res_config_settings.py b/installement/models/res_config_settings.py
new file mode 100644
index 0000000000..ba2b445eab
--- /dev/null
+++ b/installement/models/res_config_settings.py
@@ -0,0 +1,26 @@
+from odoo import api, models, fields
+
+
+class ResConfigSettings(models.TransientModel):
+
+ _inherit = "res.config.settings"
+
+ max_duration = fields.Float(
+ string="Max Duration", config_parameter='installement.max_duration')
+ annual_rate_percentage = fields.Float(
+ string='Annual Rate Percentage', config_parameter='installement.annual_rate_percentage')
+ down_payment_percentage = fields.Float(
+ string="Down Payment Percentage", config_parameter='installement.down_payment_percentage')
+ administrative_expenses_percentage = fields.Float(
+ string='Administrative Expenses Percentage', config_parameter='installement.administrative_expenses_percentage')
+ delay_penalty_percentage = fields.Float(
+ string="Delay Penalty Percentage", config_parameter='installement.delay_penalty_percentage')
+ delay_penalty_process = fields.Float(
+ string='Delay Penalty Process', config_parameter='installement.delay_penalty_process')
+
+ nid = fields.Boolean("Nid")
+ salary_component = fields.Boolean('Salary Component')
+ bank_statement = fields.Boolean('Bank Statement')
+ bank_rate_letter = fields.Boolean('Bank Rate Letter')
+ rental_contract = fields.Boolean('Rental Contract')
+ ownership_contract = fields.Boolean('Ownership Contract')
diff --git a/installement/security/ir.model.access.csv b/installement/security/ir.model.access.csv
new file mode 100644
index 0000000000..c7d5cd568c
--- /dev/null
+++ b/installement/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
+access_add_emi_button_wizard,access_add_emi_button_wizard,model_add_emi_button_wizard,base.group_user,1,1,1,1
diff --git a/installement/views/add_emi_button_views.xml b/installement/views/add_emi_button_views.xml
new file mode 100644
index 0000000000..936a52ab47
--- /dev/null
+++ b/installement/views/add_emi_button_views.xml
@@ -0,0 +1,16 @@
+
+
+
+ sale.order.form
+ sale.order
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/installement/views/res_config_settings_views.xml b/installement/views/res_config_settings_views.xml
new file mode 100644
index 0000000000..4d27dfb6d5
--- /dev/null
+++ b/installement/views/res_config_settings_views.xml
@@ -0,0 +1,62 @@
+
+
+ res.config.settings.view.form.inherit.base.setup
+ res.config.settings
+
+
+
+
+
+
+
+ Years
+
+
+
+ % Per Year
+
+
+
+ % From Product Price
+
+
+
+ % From Amount After D.Payment
+
+
+
+ % From Monthly Amount
+
+
+
+ Days
+
+ Delay penalty percentage will be applied after exceed the delay
+ process period.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/installement/wizard/__init__.py b/installement/wizard/__init__.py
new file mode 100644
index 0000000000..12fbb2d14e
--- /dev/null
+++ b/installement/wizard/__init__.py
@@ -0,0 +1 @@
+from . import add_emi_button_wizard
diff --git a/installement/wizard/add_emi_button_wizard.py b/installement/wizard/add_emi_button_wizard.py
new file mode 100644
index 0000000000..b9e1031609
--- /dev/null
+++ b/installement/wizard/add_emi_button_wizard.py
@@ -0,0 +1,56 @@
+from odoo import models, fields, api
+
+
+class AddEmiButtonWizard(models.TransientModel):
+
+ _name = "add.emi.button.wizard"
+ _description = "Add Emi Button Wizard"
+
+ total_sale_amount = fields.Float(
+ string="Total sale Amount", readonly=True)
+ down_payment = fields.Float(compute="_compute_values")
+ remaining_amount = fields.Float(compute="_compute_values")
+ interest = fields.Float(compute='_compute_values')
+ number_of_monthly_installement = fields.Integer(compute='_compute_values')
+ installement_amount = fields.Float(readonly=True)
+ admin_expense = fields.Float(compute='_compute_values')
+ remaining_amount_2 = fields.Float(compute='_compute_values')
+
+ def default_get(self, fields_list):
+ defaults = super().default_get(fields_list)
+ defaults['total_sale_amount'] = self.env['sale.order'].browse(
+ self.env.context.get('active_id')).amount_total
+ return defaults
+
+ @api.depends("total_sale_amount")
+ def _compute_values(self):
+ for rec in self:
+ down_payment_percent = self.env['ir.config_parameter'].get_param(
+ 'installement.down_payment_percentage')
+ x = float(rec.total_sale_amount) * float(down_payment_percent)
+ rec.down_payment = x/100
+
+ # remaining amount
+ rec.remaining_amount = rec.total_sale_amount - rec.down_payment
+
+ # admin expense
+ administrative_expenses_percentage = self.env['ir.config_parameter'].get_param(
+ 'installement.administrative_expenses_percentage')
+ y = float(rec.remaining_amount) * \
+ float(administrative_expenses_percentage)
+ rec.admin_expense = y/100
+
+ # toal remaining amount
+ rec.remaining_amount_2 = rec.remaining_amount + rec.admin_expense
+
+ annual_rate_percentage = self.env['ir.config_parameter'].get_param(
+ 'installement.annual_rate_percentage')
+ z = float(rec.remaining_amount_2) * float(annual_rate_percentage)
+ rec.interest = z/100
+
+ max_dur = float(self.env['ir.config_parameter'].get_param(
+ 'installement.max_duration'))
+ rec.number_of_monthly_installement = float(max_dur)*12
+
+ rec.installement_amount = (
+ rec.remaining_amount_2 + rec.interest)/rec.number_of_monthly_installement
diff --git a/installement/wizard/add_emi_button_wizard_views.xml b/installement/wizard/add_emi_button_wizard_views.xml
new file mode 100644
index 0000000000..dedad51703
--- /dev/null
+++ b/installement/wizard/add_emi_button_wizard_views.xml
@@ -0,0 +1,34 @@
+
+
+
+ add.emi.button.wizard.form
+ add.emi.button.wizard
+
+
+
+
+
+
+ Add Emi Button
+ add.emi.button.wizard
+ form
+
+ new
+
+
\ No newline at end of file