diff --git a/dental/controller/dental_portal.py b/dental/controller/dental_portal.py
index 59753ee0a0..8190341855 100644
--- a/dental/controller/dental_portal.py
+++ b/dental/controller/dental_portal.py
@@ -6,7 +6,7 @@
class DentalPortal(CustomerPortal):
@http.route('/my/dental', type='http', auth='user', website=True)
def portal_my_dental(self, **kw):
- patients = request.env['dental.patient'].search([('guarantor_id', '=', request.env.user.id)])
+ patients = request.env['dental.patient'].search([('guarantor_id', '=', request.env.user.id), ('gender', '=', 'male'), ('patient_history_ids', '!=', False), ('emergency_contact_id', '!=', False)])
return request.render('dental.portal_my_dental', {
'patients': patients
})
diff --git a/dental/models/dental_patient_history.py b/dental/models/dental_patient_history.py
index a7a58be2ce..554d2b3832 100644
--- a/dental/models/dental_patient_history.py
+++ b/dental/models/dental_patient_history.py
@@ -38,7 +38,7 @@ class DentalPatientHistory(models.Model):
('full_consultation', 'Full Consultation with Bitewings and Scan'),
('basic_consultation', 'Basic Consultation'),
('no_consultation', 'No Consultation')
- ], shabits_substance_abusetring="Consultation Type")
+ ], string="Consultation Type")
call_out = fields.Boolean(string="Call Out")
scale_and_polish = fields.Boolean(string="Scale and Polish")
diff --git a/installment/__init__.py b/installment/__init__.py
new file mode 100644
index 0000000000..134df27435
--- /dev/null
+++ b/installment/__init__.py
@@ -0,0 +1,2 @@
+from . import wizard
+from . import models
diff --git a/installment/__manifest__.py b/installment/__manifest__.py
new file mode 100644
index 0000000000..a0a4c3d3b9
--- /dev/null
+++ b/installment/__manifest__.py
@@ -0,0 +1,19 @@
+{
+ 'name': 'installment',
+ 'version': '1.0',
+ 'description': 'A module for installment',
+ 'category': 'sales',
+ 'author': 'YASP',
+ 'sequence': 1,
+ 'depends': ['base', 'sale_subscription', 'account'],
+ 'license': 'LGPL-3',
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'wizard/wizard_view.xml',
+ 'data/installment_data.xml',
+ 'views/res_config_settings_view.xml',
+ 'views/add_emi_view.xml'
+ ],
+ 'installable': True,
+ 'application': True,
+}
diff --git a/installment/data/installment_data.xml b/installment/data/installment_data.xml
new file mode 100644
index 0000000000..cbff09db3a
--- /dev/null
+++ b/installment/data/installment_data.xml
@@ -0,0 +1,8 @@
+
+
+ Installment
+
+
+ EMI
+
+
diff --git a/installment/models/__init__.py b/installment/models/__init__.py
new file mode 100644
index 0000000000..0deb68c468
--- /dev/null
+++ b/installment/models/__init__.py
@@ -0,0 +1 @@
+from . import res_config_settings
diff --git a/installment/models/res_config_settings.py b/installment/models/res_config_settings.py
new file mode 100644
index 0000000000..7cce9ee746
--- /dev/null
+++ b/installment/models/res_config_settings.py
@@ -0,0 +1,19 @@
+from odoo import models, fields
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = "res.config.settings"
+
+ max_duration = fields.Integer(string="Max Duration", config_parameter="installment.max_duration")
+ annual_rate_percentage = fields.Integer(string="Annual Rate Percentage", config_parameter="installment.annual_rate_percentage")
+ down_payment_percentage = fields.Integer(string="Down Payment Percentage", config_parameter="installment.down_payment_percentage")
+ administrative_expense_percentage = fields.Integer(string="Administrative Expense Percentage", config_parameter="installment.administrative_expense_percentage")
+ delay_penalty_percentage = fields.Integer(string="Delay Penalty Percentage", config_parameter="installment.delay_penalty_percentage")
+ delay_penalty_process = fields.Integer(string="Delay Penalty Process", config_parameter="installment.delay_penalty_process")
+
+ nid = fields.Boolean(string="NID", config_parameter="installment.nid")
+ bank_statement = fields.Boolean(string="Bank Statement", config_parameter="installment.bank_statement")
+ rental_contract = fields.Boolean(string="Rental Contract", config_parameter="installment.rental_contract")
+ salary_components = fields.Boolean(string="Salary Components", config_parameter="installment.salary_components")
+ bank_rate_letter = fields.Boolean(string="Bank Rate Letter", config_parameter="installment.bank_rate_letter")
+ ownership_contract = fields.Boolean(string="Ownership Contract", config_parameter="installment.ownership_contract")
\ No newline at end of file
diff --git a/installment/security/ir.model.access.csv b/installment/security/ir.model.access.csv
new file mode 100644
index 0000000000..42ec880d6f
--- /dev/null
+++ b/installment/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_installment_add_emi_wizard,access_installment_add_emi_wizard,model_installment_add_emi_wizard,base.group_user,1,1,1,1
diff --git a/installment/views/add_emi_view.xml b/installment/views/add_emi_view.xml
new file mode 100644
index 0000000000..32eabf93c4
--- /dev/null
+++ b/installment/views/add_emi_view.xml
@@ -0,0 +1,15 @@
+
+
+ add.emi.view
+ sale.order
+
+
+
+
+
+
+
+
diff --git a/installment/views/res_config_settings_view.xml b/installment/views/res_config_settings_view.xml
new file mode 100644
index 0000000000..b5294c975a
--- /dev/null
+++ b/installment/views/res_config_settings_view.xml
@@ -0,0 +1,63 @@
+
+
+
+ res.config.settings.view.form.inherit.installment
+ res.config.settings
+
+
+
+
+
+
+ Years
+
+
+
+ %Per Year
+
+
+
+ %From Product Price
+
+
+
+ %From Amount After D.Payment
+
+
+
+ %From Monthly Amount
+
+
+
+ Days
+
+
+ help="Define the Delay Penalty Process"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/installment/wizard/__init__.py b/installment/wizard/__init__.py
new file mode 100644
index 0000000000..ea357e10f1
--- /dev/null
+++ b/installment/wizard/__init__.py
@@ -0,0 +1 @@
+from . import add_emi_wizard
diff --git a/installment/wizard/add_emi_wizard.py b/installment/wizard/add_emi_wizard.py
new file mode 100644
index 0000000000..56506bc803
--- /dev/null
+++ b/installment/wizard/add_emi_wizard.py
@@ -0,0 +1,54 @@
+from odoo import models, fields, api
+
+
+class AddEmiWizard(models.TransientModel):
+ _name = 'installment.add.emi.wizard'
+ _description = 'Add Emi Wizard'
+
+ totalso_amount = fields.Float(string="Total Amount", readonly=True)
+ down_payment = fields.Float(string="Down Payment", compute="_compute_values")
+ remaining_amount = fields.Float(string="Remaining Amount", compute="_compute_values")
+ remaining_amount2 = fields.Float(string="Remaining Amount2", compute="_compute_values")
+ interest = fields.Float(string="Interest", compute="_compute_values")
+ administrative_expense = fields.Float(string="Administrative Expense", compute="_compute_values")
+ nof_installment = fields.Integer(string="No. of Monthly Installment", compute="_compute_values")
+ installment_amount = fields.Float(string="Installment Amount", compute="_compute_values")
+
+ def default_get(self, fields_list):
+ defaults = super().default_get(fields_list)
+ defaults['totalso_amount'] = self.env['sale.order'].browse(self.env.context.get('active_id')).amount_total
+ return defaults
+
+ @api.depends("totalso_amount")
+ def _compute_values(self):
+ for rec in self:
+ down_payment_percent = self.env['ir.config_parameter'].get_param('installment.down_payment_percentage')
+ x = float(rec.totalso_amount) * float(down_payment_percent)
+ rec.down_payment = x / 100
+ rec.remaining_amount = rec.totalso_amount - rec.down_payment
+ administrative_expense_percent = self.env['ir.config_parameter'].get_param('installment.administrative_expense_percentage')
+ y = float(rec.remaining_amount) * float(administrative_expense_percent)
+ rec.administrative_expense = y / 100
+ rec.remaining_amount2 = rec.remaining_amount + rec.administrative_expense
+ annual_rate_percent = self.env['ir.config_parameter'].get_param('installment.annual_rate_percentage')
+ z = float(rec.remaining_amount2) * float(annual_rate_percent)
+ rec.interest = z / 100
+ nof_install = float(self.env['ir.config_parameter'].get_param('installment.max_duration'))
+ rec.nof_installment = nof_install * 12
+ final_amount = rec.remaining_amount2 + rec.interest
+ rec.installment_amount = final_amount / rec.nof_installment
+
+ def action_add_emi(self):
+ move_vals = [{
+ 'product_id': self.env.ref('installment.product_1').id,
+ 'order_id': self.env.context.get('active_id'),
+ 'price_unit': self.installment_amount,
+ 'product_uom_qty': 1
+ },
+ {
+ 'product_id': self.env.ref('installment.product_2').id,
+ 'order_id': self.env.context.get('active_id'),
+ 'product_uom_qty': 4,
+ 'price_unit': -self.installment_amount,
+ }]
+ self.env['sale.order.line'].create(move_vals)
diff --git a/installment/wizard/wizard_view.xml b/installment/wizard/wizard_view.xml
new file mode 100644
index 0000000000..b1f68e43e1
--- /dev/null
+++ b/installment/wizard/wizard_view.xml
@@ -0,0 +1,30 @@
+
+
+ installment.add.emi.wizard.form
+ installment.add.emi.wizard
+
+
+
+
+
+
+ ADD EMI
+ installment.add.emi.wizard
+ form
+
+ new
+
+