@ -0,0 +1,52 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Insurance Management |
|||
==================== |
|||
This module will used for Insurance Management & Operations. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
GNU Affero General Public License v3.0 (AGPL v3) |
|||
(http://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: Niyas Raphy , Sreejith P |
|||
(V13) Nimisha Murali |
|||
(V14) Muhammed Nafih |
|||
(V15) Abhishek E T |
|||
(V17) Jumana Haseen, |
|||
(V18) Gayathri V, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
@ -0,0 +1,58 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Insurance Management', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Accounting', |
|||
'summary': """Insurance Management & Operations of the customers and manage |
|||
the insurance claims and the salary of agents with or without the |
|||
commission.""", |
|||
'description': """Insurance Management and claims based on policies allows |
|||
the user to create insurance policies """, |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['account'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'data/payment_type_data.xml', |
|||
'data/ir_sequence_data.xml', |
|||
'views/claim_details_views.xml', |
|||
'views/employee_details_views.xml', |
|||
'views/insurance_details_views.xml', |
|||
'views/policy_details_views.xml', |
|||
'views/insurance_management_menus.xml', |
|||
'views/policy_type_views.xml', |
|||
'views/payment_type_views.xml', |
|||
], |
|||
'assets': { |
|||
'web.assets_backend': [ |
|||
'account/static/src/components/**/*', |
|||
], |
|||
}, |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'application': True, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Adding sequence for insurance--> |
|||
<data noupdate="1"> |
|||
<record id="ir_sequence_insurance_details" model="ir.sequence"> |
|||
<field name="name">Insurance Details</field> |
|||
<field name="code">insurance.details</field> |
|||
<field name="prefix">INS/</field> |
|||
<field name="padding">3</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
<!-- Adding sequence for claim details--> |
|||
<record id="ir_sequence_claim_details" model="ir.sequence"> |
|||
<field name="name">Claim Details</field> |
|||
<field name="code">claim.details</field> |
|||
<field name="prefix">CLM/</field> |
|||
<field name="padding">3</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<record id ='payment_type_fixed' model="payment.type"> |
|||
<field name="name">Fixed</field> |
|||
</record> |
|||
<record id = 'payment_type_installment' model="payment.type"> |
|||
<field name="name">Installment</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <insurance_management_cybro> |
|||
|
|||
#### 02.08.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Insurance Management |
@ -0,0 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import account_move |
|||
from . import claim_details |
|||
from . import employee_details |
|||
from . import insurance_details |
|||
from . import payment_type |
|||
from . import policy_details |
|||
from . import policy_type |
@ -0,0 +1,33 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountMove(models.Model): |
|||
"""This class inherits 'account.move' and added fields insurance_id |
|||
and claim_id""" |
|||
_inherit = 'account.move' |
|||
|
|||
insurance_id = fields.Many2one('insurance.details', |
|||
string='Insurance', |
|||
help="Give the insurance details in invoice") |
|||
claim_id = fields.Many2one('claim.details', string='Insurance Claim', |
|||
help="Give the claim details") |
@ -0,0 +1,84 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class ClaimDetails(models.Model): |
|||
"""This class creates a model 'claim.details' and added fields """ |
|||
_name = 'claim.details' |
|||
_description = "Claim Details" |
|||
|
|||
name = fields.Char(string='Name', copy=False, |
|||
readonly=True, index=True, default=lambda self: _('New'), |
|||
help="Sequence for claim details") |
|||
insurance_id = fields.Many2one('insurance.details', required=True, |
|||
domain=[('state', '=', 'confirmed')], |
|||
string="Insurance", |
|||
help="Confirmed orders can be selected") |
|||
partner_id = fields.Many2one(related='insurance_id.partner_id', |
|||
string='Customer', |
|||
help="Partner related to insurance") |
|||
policy_id = fields.Many2one(related='insurance_id.policy_id', |
|||
string='Policy', |
|||
help="Policy related to insurance") |
|||
employee_id = fields.Many2one(related='insurance_id.employee_id', |
|||
string='Agent', |
|||
help="Employee related to insurance") |
|||
currency_id = fields.Many2one('res.currency', string='Currency', |
|||
required=True, default=lambda |
|||
self: self.env.user.company_id.currency_id.id, |
|||
help="Default currency of the claim") |
|||
amount = fields.Monetary(related='insurance_id.amount', string='Amount', |
|||
help="Amount related to insurance") |
|||
date_claimed = fields.Date(string='Date Applied', |
|||
default=fields.Date.today(), |
|||
help="Date of apply of claim details") |
|||
invoice_id = fields.Many2one('account.move', string='Invoiced', |
|||
readonly=True, copy=False, |
|||
help="Invoice related to the claim") |
|||
note_field = fields.Html(string='Comment', help="Extra notes for the claim") |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Function to create sequence""" |
|||
if vals_list[0].get('name', 'New') == 'New': |
|||
vals_list[0]['name'] = self.env['ir.sequence'].next_by_code( |
|||
'claim.details') or 'New' |
|||
return super(ClaimDetails, self).create(vals_list) |
|||
|
|||
def action_create_bill(self): |
|||
"""Function to create bill with corresponding details""" |
|||
if not self.invoice_id: |
|||
invoice_val = self.env['account.move'].sudo().create({ |
|||
'move_type': 'in_invoice', |
|||
'invoice_date': fields.Date.today(), |
|||
'partner_id': self.partner_id.id, |
|||
'invoice_user_id': self.env.user.id, |
|||
'claim_id': self.id, |
|||
'invoice_origin': self.name, |
|||
'invoice_line_ids': [(fields.Command.create({ |
|||
'name': 'Invoice For Insurance Claim', |
|||
'quantity': 1, |
|||
'price_unit': self.amount |
|||
}))], |
|||
}) |
|||
self.invoice_id = invoice_val |
@ -0,0 +1,109 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
import re |
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import UserError, ValidationError |
|||
|
|||
|
|||
class EmployeeDetails(models.Model): |
|||
"""This class creates a model 'employee.details' and added fields """ |
|||
_name = 'employee.details' |
|||
_description = "Employee Details" |
|||
|
|||
name = fields.Char(string='Name', required=True, help="Name of the employee") |
|||
user_id = fields.Many2one('res.users', |
|||
string='Related User of the employee', |
|||
copy=False, help="Related user of the employee") |
|||
gender = fields.Selection([('male', 'Male'), ('female', 'Female'), |
|||
('others', 'Others')], string="Gender", |
|||
help="Select the sex of the employee") |
|||
phone = fields.Char(string='Phone Number', required=True, |
|||
help="Phone number of employee") |
|||
salary_type = fields.Selection( |
|||
[('fixed', 'Fixed'), ('commission', 'Commission'), ('both', 'Both')], |
|||
default='fixed', required=True, help="Select the salary type") |
|||
currency_id = fields.Many2one('res.currency', string='Currency', |
|||
required=True, default=lambda |
|||
self: self.env.user.company_id.currency_id.id, |
|||
help="Select the currency") |
|||
base_salary = fields.Monetary(string='Base Salary', |
|||
help="Give the base salary of employee") |
|||
last_salary_date = fields.Date(string='Last Payment On', copy=False, |
|||
help="Last salary paid date") |
|||
insurance_ids = fields.One2many('insurance.details', |
|||
'employee_id', readonly=True, |
|||
string='Last Details', |
|||
help="Insurance details created by employee") |
|||
note_field = fields.Html(string='Comment', help="Give notes,if any") |
|||
invoice_id = fields.Many2one('account.move', |
|||
string='Last payment', readonly=True, |
|||
copy=False, help="Invoice of last payment") |
|||
|
|||
def action_salary_payment(self): |
|||
"""This function raises a user error if state is draft and |
|||
user error when base salary is less |
|||
and creates invoice with corresponding details given""" |
|||
if self.invoice_id: |
|||
if self.invoice_id.state == 'draft': |
|||
raise UserError(_("You must validate the last payment made in " |
|||
"order to create a new payment")) |
|||
amount = 0.0 |
|||
if self.salary_type == 'fixed': |
|||
amount = self.base_salary |
|||
if self.base_salary == 0.0: |
|||
raise UserError(_("Amount should be greater than zero")) |
|||
elif self.salary_type == 'commission': |
|||
for ins in self.insurance_ids: |
|||
if self.last_salary_date: |
|||
if ins.start_date > self.last_salary_date: |
|||
amount += ins.commission_rate * ins.amount |
|||
else: |
|||
for ins in self.insurance_ids: |
|||
if self.last_salary_date: |
|||
if ins.start_date >= self.last_salary_date: |
|||
amount += ins.commission_rate * ins.amount + self.base_salary |
|||
|
|||
invoice_date = self.env['account.move'].sudo().create({ |
|||
'move_type': 'in_invoice', |
|||
'invoice_date': fields.Date.today(), |
|||
'partner_id': self.user_id.partner_id.id, |
|||
'invoice_user_id': self.env.user.id, |
|||
'invoice_origin': self.name, |
|||
'invoice_line_ids': [(fields.Command.create({ |
|||
'name': 'Invoice For Salary Payment', |
|||
'quantity': 1, |
|||
'price_unit': amount |
|||
}))], |
|||
}) |
|||
self.sudo().write({ |
|||
'invoice_id': invoice_date.id, |
|||
'last_salary_date': fields.Date.today(), |
|||
}) |
|||
|
|||
@api.constrains('phone') |
|||
def check_phone(self): |
|||
""" Make sure phone contains only 10 digits """ |
|||
for rec in self: |
|||
if not re.match('^[0-9]{10}$', rec.phone): |
|||
raise ValidationError( |
|||
_('Phone number should contain exactly 10 digits and only ' |
|||
'numbers are allowed')) |
@ -0,0 +1,171 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, Command, fields, models, _ |
|||
from odoo.exceptions import UserError, ValidationError |
|||
|
|||
|
|||
class InsuranceDetails(models.Model): |
|||
"""This class creates a model 'insurance.details' and added fields """ |
|||
_name = 'insurance.details' |
|||
_description = "Insurance Details" |
|||
|
|||
name = fields.Char(string='Name', required=True, copy=False, readonly=True, |
|||
index=True, default=lambda self: _('New'), |
|||
help="Sequence of insurance created") |
|||
partner_id = fields.Many2one('res.partner', string='Customer', |
|||
required=True, |
|||
help="Partner related to insurance") |
|||
start_date = fields.Date(string='Date Started', required=True, |
|||
default=fields.Date.today(), |
|||
help="Start date of insurance") |
|||
close_date = fields.Date(string='Date Closed', readonly=True, |
|||
help="End date of insurance") |
|||
invoice_ids = fields.One2many('account.move', 'insurance_id', |
|||
string='Invoices', readonly=True, |
|||
help="Invoices related to insurance ") |
|||
employee_id = fields.Many2one('employee.details', string='Agent', |
|||
required=True, |
|||
help="Agent related to the insurance") |
|||
commission_rate = fields.Float(string='Commission Percentage', |
|||
help="Give the commission rate of" |
|||
" insurance to the agent", ) |
|||
policy_id = fields.Many2one('policy.details', string='Policy', |
|||
required=True, help="Select the policy details " |
|||
"and the policy preferred") |
|||
payment_type = fields.Selection([('fixed', 'Fixed'), |
|||
('installment', 'Installment')], |
|||
help="Select the policy type", |
|||
string="Payment Type") |
|||
policy_duration = fields.Integer(string='Duration in months', required=True, |
|||
help="Specify the policy duration to" |
|||
" which this policy exists") |
|||
|
|||
currency_id = fields.Many2one('res.currency', string='Currency', required=True, default=lambda self: self._default_currency_id()) |
|||
amount = fields.Monetary(related='policy_id.amount', string='Amount', |
|||
help="The amount for the policy based " |
|||
"on policy selected") |
|||
amount_installment = fields.Monetary(string="Installment Amount", |
|||
compute="_compute_amount_installment", |
|||
required=True, |
|||
help="Give the installment" |
|||
" amount for the policy") |
|||
amount_remaining = fields.Monetary(string='Amount remaining', |
|||
compute='_compute_amount_remaining') |
|||
state = fields.Selection([('draft', 'Draft'), |
|||
('confirmed', 'Confirmed'), ('closed', 'Closed')], |
|||
required=True, default='draft', |
|||
help="State of insurance") |
|||
hide_inv_button = fields.Boolean(copy=False, string='Hide Invoice Button', |
|||
help="This is used to hide the invoice button") |
|||
note_field = fields.Html(string='Comment', help="It takes the notes") |
|||
policy_number = fields.Integer(string="Policy Number", required=True, |
|||
help="Policy number is a unique number that" |
|||
"an insurance company uses to identify" |
|||
"you as a policyholder") |
|||
|
|||
@api.depends('amount', 'policy_duration') |
|||
def _compute_amount_installment(self): |
|||
for record in self: |
|||
if record.policy_duration != 0: |
|||
record.amount_installment = ( |
|||
record.amount / record.policy_duration) |
|||
else: |
|||
record.amount_installment = 0.0 |
|||
|
|||
@api.depends('amount', 'amount_installment', 'invoice_ids.amount_total') |
|||
def _compute_amount_remaining(self): |
|||
for record in self: |
|||
total_invoice_amount = sum( |
|||
record.invoice_ids.mapped('amount_total')) |
|||
total_amount = record.amount |
|||
record.amount_remaining = total_amount - total_invoice_amount |
|||
|
|||
@api.constrains('commission_rate') |
|||
def _check_commission_rate(self): |
|||
"""This function defines a constraint that ensures the ' |
|||
commission_rate' attribute of objects meets certain criteria. |
|||
If any object violates the constraint by having a 'commission_rate' |
|||
that falls outside the range of 1 to 100, a validation error |
|||
is raised, """ |
|||
if self.filtered( |
|||
lambda reward: ( |
|||
reward.commission_rate < 0 or reward.commission_rate > |
|||
100)): |
|||
raise ValidationError( |
|||
_('Commission Percentage should be between 1-100')) |
|||
|
|||
@api.constrains('policy_number') |
|||
def _check_policy_number(self): |
|||
"""This function checks if policy number is not added,validation error |
|||
occurs""" |
|||
if not self.policy_number: |
|||
raise ValidationError( |
|||
_('Please add the policy number')) |
|||
|
|||
def _default_currency_id(self): |
|||
return self.env.user.company_id.currency_id |
|||
|
|||
def action_confirm_insurance(self): |
|||
"""This function creates a validation error if amount not |
|||
greater than zero""" |
|||
if self.amount > 0: |
|||
self.state = 'confirmed' |
|||
self.hide_inv_button = True |
|||
else: |
|||
raise UserError(_("Amount should be greater than zero")) |
|||
|
|||
def action_create_invoice(self): |
|||
"""Function to create invoice with corresponding details""" |
|||
if self.payment_type == 'fixed': |
|||
self.hide_inv_button = False |
|||
created_invoice = self.env['account.move'].sudo().create({ |
|||
'move_type': 'out_invoice', |
|||
'invoice_date': fields.Date.today(), |
|||
'partner_id': self.partner_id.id, |
|||
'invoice_user_id': self.env.user.id, |
|||
'invoice_origin': self.name, |
|||
'invoice_line_ids': [(fields.Command.create({ |
|||
'name': 'Invoice For Insurance', |
|||
'quantity': 1, |
|||
'price_unit': self.amount if self.payment_type == 'fixed' else |
|||
self.amount_installment |
|||
}))], |
|||
}) |
|||
self.write({'invoice_ids': [Command.link(created_invoice.id)]}) |
|||
|
|||
def action_close_insurance(self): |
|||
"""Function on button to close the paid invoices or else raise |
|||
user error""" |
|||
for records in self.invoice_ids: |
|||
if records.state == 'paid': |
|||
raise UserError(_("All invoices must be paid")) |
|||
self.state = 'closed' |
|||
self.close_date = fields.Date.today() |
|||
self.hide_inv_button = False |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Function to create sequence""" |
|||
if vals_list[0].get('name', 'New') == 'New': |
|||
vals_list[0]['name'] = self.env['ir.sequence'].next_by_code( |
|||
'insurance.details') or 'New' |
|||
return super(InsuranceDetails, self).create(vals_list) |
@ -0,0 +1,29 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class PaymentType(models.Model): |
|||
_name = 'payment.type' |
|||
_description = 'Payment Type' |
|||
|
|||
name = fields.Char(string="Payment Type", help="Select the policy type", required=True) |
@ -0,0 +1,42 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class PolicyDetails(models.Model): |
|||
"""This class creates a model 'policy.details' and added fields """ |
|||
_name = 'policy.details' |
|||
_description = "Policy Details" |
|||
|
|||
name = fields.Char(string='Name', required=True,help="Give the policy name") |
|||
policy_type_id = fields.Many2one( |
|||
'policy.type', string='Policy Type', required=True, |
|||
help="Select the policy type") |
|||
payment_type_ids = fields.Many2many('payment.type', |
|||
help="Select the policy types") |
|||
currency_id = fields.Many2one( |
|||
'res.currency', string='Currency', required=True, |
|||
default=lambda self: self.env.company.currency_id.id, |
|||
help="Select the currency") |
|||
amount = fields.Monetary(string='Amount', required=True, |
|||
help="Give the amount for the policy") |
|||
note_field = fields.Html(string='Comment', help="Specify the comments") |
@ -0,0 +1,30 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Gayathri V @cybrosys(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class PolicyType(models.Model): |
|||
"""This class creates a model 'policy.type' and added fields """ |
|||
_name = 'policy.type' |
|||
_description = "Policy Type" |
|||
|
|||
name = fields.Char(string='Name', help="Give the policy type", required=True) |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 462 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 82 KiB |