diff --git a/dental/__init__.py b/dental/__init__.py index 9a7e03ede..5607426d8 100644 --- a/dental/__init__.py +++ b/dental/__init__.py @@ -1 +1,2 @@ -from . import models \ No newline at end of file +from . import models +from . import controller diff --git a/dental/__manifest__.py b/dental/__manifest__.py index 45c47e33a..ccf86907d 100644 --- a/dental/__manifest__.py +++ b/dental/__manifest__.py @@ -1,25 +1,33 @@ { - 'name': 'Dental', - 'version': '1.0', - 'summary': 'Manage dental history and appointments', - 'description': 'Module to manage medical history and appointments', - 'author': 'Akya', - 'sequence': '15', - 'depends': ['base', 'mail', 'account'], - 'data': [ - 'security/ir.model.access.csv', - 'views/dental_patient_view.xml', - 'views/dental_medication_view.xml', - 'views/dental_chronic_diseases_view.xml', - 'views/dental_allergies_view.xml', - 'views/dental_habits_view.xml', - 'views/dental_medical_aid_view.xml', - 'views/dental_history_view.xml', - 'views/dental_menus.xml', - 'report/dental_patient_report.xml', - 'report/dental_patient_report_template.xml' - ], - 'installable': True, - 'application': True, - 'license': 'AGPL-3' + "name": "Dental", + "version": "1.0", + "summary": "Manage dental history and appointments", + "description": "Module to manage medical history and appointments", + "author": "Akya", + "sequence": "15", + "depends": ["base", "mail", "account", "website"], + "data": [ + "security/ir.model.access.csv", + "views/dental_patient_view.xml", + "views/dental_medication_view.xml", + "views/dental_chronic_diseases_view.xml", + "views/dental_allergies_view.xml", + "views/dental_habits_view.xml", + "views/dental_medical_aid_view.xml", + "views/dental_history_view.xml", + "views/dental_menus.xml", + "views/dental_controller_view.xml", + "report/dental_patient_report.xml", + "report/dental_patient_report_template.xml", + ], + "images": [ + "static/description/icon.png", + "static/description/bag.svg", + "static/description/folder.svg", + "static/description/task.svg", + "static/description/Bill.svg", + ], + "installable": True, + "application": True, + "license": "AGPL-3", } diff --git a/dental/controller/__init__.py b/dental/controller/__init__.py new file mode 100644 index 000000000..95db74ea1 --- /dev/null +++ b/dental/controller/__init__.py @@ -0,0 +1 @@ +from . import dental_controller diff --git a/dental/controller/dental_controller.py b/dental/controller/dental_controller.py new file mode 100644 index 000000000..ebf9ba0ab --- /dev/null +++ b/dental/controller/dental_controller.py @@ -0,0 +1,66 @@ +from odoo import http +from odoo.http import request + + +class DentalController(http.Controller): + + @http.route("/dental", auth="public", website=True) + def display_patients(self): + current_user = request.env.user + patients = request.env["dental.patient"].search( + [("guarantor_id", "=", current_user.partner_id.id)] + ) + return request.render("dental.dental_patient_page", {"patients": patients}) + + @http.route("/dental/", auth="public", website=True) + def display_patient_details(self, patient_name): + patient = ( + request.env["dental.patient"] + .sudo() + .search([("name", "=", patient_name)], limit=1) + ) + + if not patient: + return request.not_found() + + return request.render( + "dental.dental_patient_details_page", {"patient": patient} + ) + + @http.route( + "/dental//personal", + type="http", + auth="public", + website=True, + ) + def render_dental_patient_form(self, patient_name): + patient = ( + request.env["dental.patient"] + .sudo() + .search([("name", "=", patient_name)], limit=1) + ) + return request.render( + "dental.dental_patient_form_template", + { + "patient": patient, + }, + ) + + @http.route( + "/dental//medical_history", + type="http", + auth="public", + website=True, + ) + def dental_history_list_view(self, patient_name): + patient = ( + request.env["dental.patient"] + .sudo() + .search([("name", "=", patient_name)], limit=1) + ) + return request.render( + "dental.patient_details_controller_appointment", + { + "patients": patient.history_ids, + }, + ) diff --git a/dental/models/__init__.py b/dental/models/__init__.py index 1c0b95df4..2e35cdc98 100644 --- a/dental/models/__init__.py +++ b/dental/models/__init__.py @@ -4,4 +4,4 @@ from . import dental_allergies from . import dental_habits from . import dental_medical_aid -from . import dental_history \ No newline at end of file +from . import dental_history diff --git a/dental/models/dental_allergies.py b/dental/models/dental_allergies.py index e6e307f1d..d46326975 100644 --- a/dental/models/dental_allergies.py +++ b/dental/models/dental_allergies.py @@ -2,9 +2,9 @@ class DentalAllergies(models.Model): - _name = 'dental.allergies' - _description = 'Dental Allergies list ' - _order = 'name' + _name = "dental.allergies" + _description = "Dental Allergies list " + _order = "name" name = fields.Char(string="Allergies", required=True) - sequence = fields.Integer(string='Sequence', default=10) + sequence = fields.Integer(string="Sequence", default=10) diff --git a/dental/models/dental_chronic_diseases.py b/dental/models/dental_chronic_diseases.py index 75506666a..9ad302fcd 100644 --- a/dental/models/dental_chronic_diseases.py +++ b/dental/models/dental_chronic_diseases.py @@ -2,9 +2,9 @@ class DentalChronicDiseases(models.Model): - _name = 'dental.chronic.diseases' - _description = 'Dental chronic diseases list' - _order = 'name' + _name = "dental.chronic.diseases" + _description = "Dental chronic diseases list" + _order = "name" name = fields.Char(string="Chronic Condition", required=True) - sequence = fields.Integer(string='Sequence', default=10) + sequence = fields.Integer(string="Sequence", default=10) diff --git a/dental/models/dental_habits.py b/dental/models/dental_habits.py index f0faa1339..d86657913 100644 --- a/dental/models/dental_habits.py +++ b/dental/models/dental_habits.py @@ -2,9 +2,9 @@ class DentalHabits(models.Model): - _name = 'dental.habits' - _description = 'Dental habits and substance abuse list' - _order = 'name' + _name = "dental.habits" + _description = "Dental habits and substance abuse list" + _order = "name" name = fields.Char(string="Habits/Substance Abuse", required=True) - sequence = fields.Integer(string='Sequence', default=10) + sequence = fields.Integer(string="Sequence", default=10) diff --git a/dental/models/dental_history.py b/dental/models/dental_history.py index d07ee8254..a6d08e684 100644 --- a/dental/models/dental_history.py +++ b/dental/models/dental_history.py @@ -3,18 +3,18 @@ class DentalHistory(models.Model): - _name = 'dental.history' - _description = 'Dental history of patient' + _name = "dental.history" + _description = "Dental history of patient" - history_id = fields.Many2one('dental.patient') - date = fields.Date(string="Date", default= date.today()) + history_id = fields.Many2one("dental.patient") + date = fields.Date(string="Date", default=date.today()) name = fields.Char(string="Name", required=True) description = fields.Char(string="Description") tags = fields.Char(string="Tags") patient = fields.Char() attend = fields.Boolean(string="Did not attend", required=True) responsible = fields.Char() - company = fields.Many2one('res.company', string="Company") + company = fields.Many2one("res.company", string="Company") history = fields.Text(string="History") xray_file1 = fields.Binary(string="X-ray file 1") xray_file2 = fields.Binary(string="X-ray file 2") @@ -26,52 +26,58 @@ class DentalHistory(models.Model): consulatation = fields.Selection( copy=False, selection=[ - ("full_consultation_and_scan", "Full Consultation with bite-wings and scan"), + ( + "full_consultation_and_scan", + "Full Consultation with bite-wings and scan", + ), ("basic_consultation", "Basic Consultation"), ("no_consultation", "No Consultation"), - ],string="Consultation Type") + ], + string="Consultation Type", + ) call_out = fields.Boolean(string="Call out") scale_and_polish = fields.Boolean(string="Scale and Push") flouride = fields.Boolean(string="Flouride") filling_description = fields.Text(string="Filling Description") - aligner_attachment = fields.Boolean(string="Alligner delivery and attachment placed") + aligner_attachment = fields.Boolean( + string="Alligner delivery and attachment placed" + ) whitening = fields.Boolean(string="Whitening") fissure_sealant_quantity = fields.Float(string="Fissure Sealant-Quantity") remove_attachment = fields.Boolean(string="Attachment Removed") alligner_follow_up_scan = fields.Boolean(string="Alligner Follow-up Scan") other = fields.Text(string="Other") - upper_18_staining = fields.Boolean(string='18 Staining') - upper_17_staining = fields.Boolean(string='17 Staining') - upper_16_staining = fields.Boolean(string='16 Staining') - upper_15_staining = fields.Boolean(string='15 Staining') - upper_14_staining = fields.Boolean(string='14 Staining') - upper_13_staining = fields.Boolean(string='13 Staining') - upper_12_staining = fields.Boolean(string='12 Staining') - upper_11_staining = fields.Boolean(string='11 Staining') - upper_28_staining = fields.Boolean(string='28 Staining') - upper_27_staining = fields.Boolean(string='27 Staining') - upper_26_staining = fields.Boolean(string='26 Staining') - upper_25_staining = fields.Boolean(string='25 Staining') - upper_24_staining = fields.Boolean(string='24 Staining') - upper_23_staining = fields.Boolean(string='23 Staining') - upper_22_staining = fields.Boolean(string='22 Staining') - upper_21_staining = fields.Boolean(string='21 Staining') - lower_31_staining = fields.Boolean(string='31 Staining') - lower_32_staining = fields.Boolean(string='32 Staining') - lower_33_staining = fields.Boolean(string='33 Staining') - lower_34_staining = fields.Boolean(string='34 Staining') - lower_35_staining = fields.Boolean(string='35 Staining') - lower_36_staining = fields.Boolean(string='36 Staining') - lower_37_staining = fields.Boolean(string='37 Staining') - lower_38_staining = fields.Boolean(string='38 Staining') - lower_41_staining = fields.Boolean(string='41 Staining') - lower_42_staining = fields.Boolean(string='42 Staining') - lower_43_staining = fields.Boolean(string='43 Staining') - lower_44_staining = fields.Boolean(string='44 Staining') - lower_45_staining = fields.Boolean(string='45 Staining') - lower_46_staining = fields.Boolean(string='46 Staining') - lower_47_staining = fields.Boolean(string='47 Staining') - lower_48_staining = fields.Boolean(string='48 Staining') + upper_18_staining = fields.Boolean(string="18 Staining") + upper_17_staining = fields.Boolean(string="17 Staining") + upper_16_staining = fields.Boolean(string="16 Staining") + upper_15_staining = fields.Boolean(string="15 Staining") + upper_14_staining = fields.Boolean(string="14 Staining") + upper_13_staining = fields.Boolean(string="13 Staining") + upper_12_staining = fields.Boolean(string="12 Staining") + upper_11_staining = fields.Boolean(string="11 Staining") + upper_28_staining = fields.Boolean(string="28 Staining") + upper_27_staining = fields.Boolean(string="27 Staining") + upper_26_staining = fields.Boolean(string="26 Staining") + upper_25_staining = fields.Boolean(string="25 Staining") + upper_24_staining = fields.Boolean(string="24 Staining") + upper_23_staining = fields.Boolean(string="23 Staining") + upper_22_staining = fields.Boolean(string="22 Staining") + upper_21_staining = fields.Boolean(string="21 Staining") + lower_31_staining = fields.Boolean(string="31 Staining") + lower_32_staining = fields.Boolean(string="32 Staining") + lower_33_staining = fields.Boolean(string="33 Staining") + lower_34_staining = fields.Boolean(string="34 Staining") + lower_35_staining = fields.Boolean(string="35 Staining") + lower_36_staining = fields.Boolean(string="36 Staining") + lower_37_staining = fields.Boolean(string="37 Staining") + lower_38_staining = fields.Boolean(string="38 Staining") + lower_41_staining = fields.Boolean(string="41 Staining") + lower_42_staining = fields.Boolean(string="42 Staining") + lower_43_staining = fields.Boolean(string="43 Staining") + lower_44_staining = fields.Boolean(string="44 Staining") + lower_45_staining = fields.Boolean(string="45 Staining") + lower_46_staining = fields.Boolean(string="46 Staining") + lower_47_staining = fields.Boolean(string="47 Staining") + lower_48_staining = fields.Boolean(string="48 Staining") - notes = fields.Text() diff --git a/dental/models/dental_medical_aid.py b/dental/models/dental_medical_aid.py index 3dbfca989..d1a745dee 100644 --- a/dental/models/dental_medical_aid.py +++ b/dental/models/dental_medical_aid.py @@ -2,13 +2,13 @@ class DentalMedication(models.Model): - _name = 'dental.medical.aid' - _description = 'Medications' - _order = 'name' + _name = "dental.medical.aid" + _description = "Medications" + _order = "name" - name = fields.Char(string='Medical Aid Name', required=True) - contact_name = fields.Char(string='Contact') - phone = fields.Char(string='Phone') - email = fields.Char(string='Email') - company = fields.Many2one('res.company',string='Company') + name = fields.Char(string="Medical Aid Name", required=True) + contact_name = fields.Char(string="Contact") + phone = fields.Char(string="Phone") + email = fields.Char(string="Email") + company = fields.Many2one("res.company", string="Company") notes = fields.Text() diff --git a/dental/models/dental_medication.py b/dental/models/dental_medication.py index 4fed49b75..1abd82f8f 100644 --- a/dental/models/dental_medication.py +++ b/dental/models/dental_medication.py @@ -2,9 +2,8 @@ class DentalMedication(models.Model): - _name = 'dental.medication' - _description = 'Medications' - _order = 'name' + _name = "dental.medication" + _description = "Medications" + _order = "name" name = fields.Char(string="Medication", required=True) - diff --git a/dental/models/dental_patient.py b/dental/models/dental_patient.py index ad921f382..6cb6cd30a 100644 --- a/dental/models/dental_patient.py +++ b/dental/models/dental_patient.py @@ -3,75 +3,81 @@ class DentalPatient(models.Model): - _name = 'dental.patient' - _description = 'Dental Patient Info' - _inherit = ['mail.thread', 'mail.activity.mixin'] + _name = "dental.patient" + _description = "Dental Patient Info" + _inherit = ["mail.thread", "mail.activity.mixin"] - name = fields.Char(string='Name', required=True) - state = fields.Selection([ - ('new', 'New'), - ('to_do_today', 'To do today'), - ('done', 'Done'), - ('to_invoice', 'To invoice'), - ],default="new", tracking = True) - guarantor_id = fields.Many2one('res.partner', string='Guarantor') + name = fields.Char(string="Name", required=True) + state = fields.Selection( + [ + ("new", "New"), + ("to_do_today", "To do today"), + ("done", "Done"), + ("to_invoice", "To invoice"), + ], + default="new", + tracking=True, + ) + guarantor_id = fields.Many2one("res.partner", string="Guarantor") guarantor_phone = fields.Char( - string='Guarantor Phone', - related='guarantor_id.phone', - readonly=True + string="Guarantor Phone", related="guarantor_id.phone", readonly=True ) guarantor_email = fields.Char( - string='Guarantor Email', - related='guarantor_id.email', - readonly=True + string="Guarantor Email", related="guarantor_id.email", readonly=True + ) + guarantor_company = fields.Char( + string="Company", related="guarantor_id.parent_id.name" ) - guarantor_company = fields.Char(string="Company", related='guarantor_id.parent_id.name') - guarantor_tags = fields.Many2many(string="Tags", related='guarantor_id.category_id') - image = fields.Binary(string='Image') - medication_ids = fields.Many2many('dental.medication') - chronic_conditions_ids = fields.Many2many('dental.chronic.diseases') - allergy_ids = fields.Many2many('dental.allergies') - habit_ids = fields.Many2many('dental.habits',string="Habits/Substance Abuse") + guarantor_tags = fields.Many2many(string="Tags", related="guarantor_id.category_id") + image = fields.Binary(string="Image") + medication_ids = fields.Many2many("dental.medication") + chronic_conditions_ids = fields.Many2many("dental.chronic.diseases") + allergy_ids = fields.Many2many("dental.allergies") + habit_ids = fields.Many2many("dental.habits", string="Habits/Substance Abuse") hospitalised = fields.Boolean(string="Hospitalised this year?") female = fields.Boolean(string="FEMALE") pregnant = fields.Boolean(string="Are you pregnant?") nursing = fields.Boolean(string="Are you nursing?") - treatment = fields.Selection([ - ('hormone_replacement_treatment','Hormone Replacement Treatment'), - ('birth_control','Birth Control'), - ('neither','Neither'), - ]) + treatment = fields.Selection( + [ + ("hormone_replacement_treatment", "Hormone Replacement Treatment"), + ("birth_control", "Birth Control"), + ("neither", "Neither"), + ] + ) notes = fields.Char() special_care = fields.Char(string="Under Special Care") psychiatric_history = fields.Char(string="Psychiatric History") - medical_aid_id = fields.Many2one('dental.medical.aid',string="Medical Aid") + medical_aid_id = fields.Many2one("dental.medical.aid", string="Medical Aid") medical_aid_plan = fields.Char(string="Medical Aid Plan") medical_aid_number = fields.Char(string="Medical Aid Number") member_code = fields.Char(string="Main Member Code") dependant_code = fields.Char(string="Dependant Code") - emergency_contact_id = fields.Many2one('res.partner',string="Emergency Contact") - emergency_contact_phone = fields.Char(string="Mobile", related='emergency_contact_id.phone') - history_ids = fields.One2many('dental.history','history_id',string="History") + emergency_contact_id = fields.Many2one("res.partner", string="Emergency Contact") + emergency_contact_phone = fields.Char( + string="Mobile", related="emergency_contact_id.phone" + ) + history_ids = fields.One2many("dental.history", "history_id", string="History") occupation = fields.Char(string="Occupation or Grade") identity_number = fields.Char(string="Identity Number") date_of_birth = fields.Date(string="Date of Birth") - gender = fields.Selection([ - ('male','Male'), - ('female','Female'), - ('neither','Neither') - ]) - marital_status = fields.Selection([ - ('single','Single'), - ('married','Married'), - ('divorced','Divorced'), - ('widowed','Widowed') - ]) + gender = fields.Selection( + [("male", "Male"), ("female", "Female"), ("neither", "Neither")] + ) + marital_status = fields.Selection( + [ + ("single", "Single"), + ("married", "Married"), + ("divorced", "Divorced"), + ("widowed", "Widowed"), + ] + ) tags = fields.Char(string="Tags") - company_id = fields.Many2one('res.company',string="Company") - - @api.onchange('state') + company_id = fields.Many2one("res.company", string="Company") + + @api.onchange("state") def action_sold(self): - if self.state == 'to_invoice': + if self.state == "to_invoice": print("Invoice created") for record in self: res = { @@ -79,16 +85,14 @@ def action_sold(self): "partner_id": record.guarantor_id.id, "invoice_line_ids": [ Command.create( - { - "name": record.name, - "quantity": 1, - "invoice_date": date.today(), - "price_unit": 100, - } - ), + { + "name": record.name, + "quantity": 1, + "invoice_date": date.today(), + "price_unit": 100, + } + ), ], } - - self.env["account.move"].sudo().create(res) - + self.env["account.move"].sudo().create(res) diff --git a/dental/static/description/Bill.svg b/dental/static/description/Bill.svg new file mode 100644 index 000000000..51d1968db --- /dev/null +++ b/dental/static/description/Bill.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/dental/static/description/bag.svg b/dental/static/description/bag.svg new file mode 100644 index 000000000..148d08a22 --- /dev/null +++ b/dental/static/description/bag.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/dental/static/description/folder.svg b/dental/static/description/folder.svg new file mode 100644 index 000000000..e25122ed5 --- /dev/null +++ b/dental/static/description/folder.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/dental/static/description/icon.svg b/dental/static/description/icon.svg new file mode 100644 index 000000000..12e8ec084 --- /dev/null +++ b/dental/static/description/icon.svg @@ -0,0 +1 @@ + diff --git a/dental/static/description/tasks.svg b/dental/static/description/tasks.svg new file mode 100644 index 000000000..d43aeaacd --- /dev/null +++ b/dental/static/description/tasks.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/dental/views/dental_controller_view.xml b/dental/views/dental_controller_view.xml new file mode 100644 index 000000000..20a716e13 --- /dev/null +++ b/dental/views/dental_controller_view.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + diff --git a/estate/__init__.py b/estate/__init__.py deleted file mode 100644 index 48d990439..000000000 --- a/estate/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import models -from . import controllers -from . import wizard diff --git a/estate/__manifest__.py b/estate/__manifest__.py deleted file mode 100644 index 13858c3e9..000000000 --- a/estate/__manifest__.py +++ /dev/null @@ -1,31 +0,0 @@ -{ - 'name': 'Real Estate', - 'version': '1.0', - 'summary': 'Manage real estate properties', - 'description': 'Module to manage real estate properties', - 'author': 'Akya', - 'category': 'Real Estate/Brokerage', - 'sequence': '15', - 'depends': ['base', 'mail', 'website'], - 'data': [ - 'security/estate_security.xml', - 'security/ir.model.access.csv', - 'data/estate.property.type.csv', - 'wizard/estate_property_offer_wizard.xml', - 'views/estate_property_views.xml', - 'views/estate_property_controller_template.xml', - 'views/estate_property_offer_view.xml', - 'views/estate_property_tag_view.xml', - 'views/estate_property_type_view.xml', - 'views/res_users_view.xml', - 'views/estate_menus.xml', - 'report/estate_property_reports.xml', - 'report/estate_property_templates.xml', - ], - 'demo': [ - 'demo/estate_property_demo.xml' - ], - 'installable': True, - 'application': True, - 'license': 'AGPL-3' -} diff --git a/estate/controllers/__init__.py b/estate/controllers/__init__.py deleted file mode 100644 index 627318315..000000000 --- a/estate/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import estate_property_controller diff --git a/estate/controllers/estate_property_controller.py b/estate/controllers/estate_property_controller.py deleted file mode 100644 index ab1fdffec..000000000 --- a/estate/controllers/estate_property_controller.py +++ /dev/null @@ -1,22 +0,0 @@ -from odoo import http - - -class WebsiteProperty(http.Controller): - - @http.route("/properties", auth="public", website=True) - def display_properties(self, page=1, **kwargs): - page = int(page) - items_per_page = 6 - offset = (page - 1) * items_per_page - total_properties = http.request.env["estate.property"].search_count([('state', '!=', 'sold'), ('state', '!=', 'canceled')]) - total_page = (total_properties + items_per_page - 1) // items_per_page - properties = http.request.env["estate.property"].search([('state', '!=', 'sold'), ('state', '!=', 'canceled')], limit=items_per_page, offset=offset) - return http.request.render( - "estate.property_page", {"properties": properties, 'page': page, 'total_page': total_page} - ) - - @http.route('/property/', type='http', auth='public', website=True) - def property_details(self, each_property, **kwargs): - return http.request.render('estate.property_detail_page', { - 'property': each_property, - }) diff --git a/estate/data/estate.property.type.csv b/estate/data/estate.property.type.csv deleted file mode 100644 index 2b87635b2..000000000 --- a/estate/data/estate.property.type.csv +++ /dev/null @@ -1,5 +0,0 @@ -id,name -id1,Residential -id2,Commercial -id3,Industrial -id4,Land diff --git a/estate/demo/estate_property_demo.xml b/estate/demo/estate_property_demo.xml deleted file mode 100644 index 968d740cf..000000000 --- a/estate/demo/estate_property_demo.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Big villa - new - A nice and big villa - 12345 - 2020-02-02 - 100 - 6 - 100 - True - True - 100000 - 4 - south - - - - - BTrailer home - canceled - home in a trailer park - 54321 - 1970-01-01 - 100 - 1 - 10 - False - 4 - - - - - Luxury villa - new - A very nice villa - 12345 - 2020-02-02 - 100 - 6 - 100 - True - True - 100000 - south - 4 - - - - - - - - 100 - 14 - - - - - - - 150 - 14 - - - - - - - 151 - 14 - - - - \ No newline at end of file diff --git a/estate/models/__init__.py b/estate/models/__init__.py deleted file mode 100644 index 9a2189b63..000000000 --- a/estate/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from . import estate_property -from . import estate_property_type -from . import estate_property_tag -from . import estate_property_offer -from . import res_users diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py deleted file mode 100644 index f81641574..000000000 --- a/estate/models/estate_property.py +++ /dev/null @@ -1,109 +0,0 @@ -from odoo import models, fields, api -from odoo.exceptions import UserError, ValidationError -from odoo.tools.float_utils import float_is_zero, float_compare - - -class EstateProperty(models.Model): - _name = 'estate.property' - _description = 'Real Estate Property' - _order = 'id desc' - _inherit = ['mail.thread', 'mail.activity.mixin'] - - title = fields.Char(required=True) - description = fields.Text() - postcode = fields.Char() - availability_date = fields.Date(copy=False) - expected_price = fields.Float(required=True, default=0.0) - selling_price = fields.Float(string="Selling Price", readonly=True) - bedrooms = fields.Integer(default=2) - living_area = fields.Integer() - facades = fields.Integer() - garage = fields.Boolean() - garden = fields.Boolean() - garden_area = fields.Integer() - best_price = fields.Float(compute="_compute_best_price") - total_area = fields.Float(compute="_compute_total") - garden_orientation = fields.Selection([ - ('north', 'North'), - ('south', 'South'), - ('east', 'East'), - ('west', 'West'), - ]) - state = fields.Selection([ - ('new', 'New'), - ('offer_received', 'Offer_received'), - ('offer_accepted', 'Offer_accepted'), - ('sold', 'Sold'), - ('canceled', 'Canceled'), - ('refused', 'Refused') - ], string='Status', default='new', tracking=True) - active = fields.Boolean(string='Active', default=True) - property_type_id = fields.Many2one('estate.property.type', string="Property Type") - buyer_id = fields.Many2one('res.partner', string="Buyer") - seller_id = fields.Many2one('res.users', string="Salesperson", ondelete='set null') - tag_ids = fields.Many2many('estate.property.tag') - offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers") - property_image = fields.Binary(string="Property Image") - company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company) - - _sql_constraints = [ - ('check_expected_price', 'CHECK(expected_price >= 0)', 'The expected price must be strictly positive.'), - ('check_selling_price', 'CHECK(selling_price >= 0)', 'The selling price must be positive.') - ] - - @api.depends('living_area', 'garden_area') - def _compute_total(self): - for record in self: - record.total_area = record.living_area + record.garden_area - - @api.depends('offer_ids.price') - def _compute_best_price(self): - for record in self: - if record.offer_ids: - record.best_price = max(record.offer_ids.mapped('price')) - else: - record.best_price = 0.0 - - @api.onchange('garden') - def _onchange_garden(self): - if self.garden: - self.garden_area = 10.0 - self.garden_orientation = 'north' - else: - self.garden_area = 0.0 - self.garden_orientation = False - - def action_cancel(self): - if self.state != "sold": - self.state = "canceled" - elif self.state == "sold": - raise UserError("This property can't be canceled as it is sold already") - return True - - def action_sold(self): - if self.state != "canceled": - if self.state == 'offer_accepted': - self.state = "sold" - else: - raise UserError("This property can't be sold as there are no offers") - elif self.state == "canceled": - raise UserError("This property can't be sold as it is canceled already") - return True - - @api.constrains('selling_price', 'expected_price') - def _check_selling_price(self): - for record in self: - if not float_is_zero(record.selling_price, precision_rounding=0.01): - if float_compare(record.selling_price, record.expected_price * 0.9, precision_rounding=0.01) == -1: - raise ValidationError("The selling price cannot be lower than 90% of the expected price.") - - def action_offer_received(self): - self.state = 'offer_received' - - @api.ondelete(at_uninstall=False) - def _delete_property(self): - for record in self: - if record.state not in ['new', 'canceled']: - raise UserError( - "You cannot delete a property unless it is in the 'New' or 'Canceled' state." - ) diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py deleted file mode 100644 index 7667531b6..000000000 --- a/estate/models/estate_property_offer.py +++ /dev/null @@ -1,63 +0,0 @@ -from odoo import models, fields, api -from datetime import timedelta -from odoo.exceptions import UserError - - -class EstatePropertyOffer(models.Model): - _name = 'estate.property.offer' - _description = 'Property Offer' - _order = 'price desc' - - price = fields.Float(string="Price") - status = fields.Selection([('accepted', 'Accepted'), ('refused', 'Refused')], string="Status", copy=False) - partner_id = fields.Many2one('res.partner', string="Partner", required=True) - validity = fields.Integer(string="Validity (days)", default=7) - date_deadline = fields.Date(string="Deadline", compute="_compute_date_deadline", inverse="_inverse_date_deadline") - property_id = fields.Many2one('estate.property', 'Property', required=True, ondelete="cascade") - property_type_id = fields.Many2one(related="property_id.property_type_id") - - _sql_constraints = [ - ('check_offer_price', 'CHECK(price > 0)', 'The offer price must be strictly positive.') - ] - - @api.depends('create_date', 'validity') - def _compute_date_deadline(self): - for record in self: - if record.create_date: - record.date_deadline = record.create_date + timedelta(days=record.validity) - else: - record.date_deadline = fields.Date.today() + timedelta(days=record.validity) - - def _inverse_date_deadline(self): - for record in self: - if record.date_deadline and record.create_date: - create_date_date = record.create_date.date() - record.validity = (record.date_deadline - create_date_date).days - else: - record.validity = 0 - - def action_accept(self): - if not self.property_id.buyer_id: - self.status = 'accepted' - self.property_id.selling_price = self.price - self.property_id.buyer_id = self.partner_id - self.property_id.state = "offer_accepted" - else: - raise UserError("Offer has been already Accepted") - return True - - def action_refuse(self): - if self.property_id.buyer_id == self.partner_id: - self.property_id.buyer_id = '' - self.property_id.selling_price = 0 - self.status = 'refused' - return True - - @api.model - def create(self, vals): - record = super().create(vals) - if record.property_id.state == 'new': - record.property_id.state = 'offer_received' - if record.price < max(record.property_id.offer_ids.mapped('price')): - raise UserError("Price should be greater than the existing offer") - return record diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py deleted file mode 100644 index 7bbc81154..000000000 --- a/estate/models/estate_property_tag.py +++ /dev/null @@ -1,14 +0,0 @@ -from odoo import models, fields - - -class EstatePropertyTag(models.Model): - _name = 'estate.property.tag' - _description = 'Property Tag' - _order = 'name' - - name = fields.Char(string="Name", required=True) - color = fields.Integer() - - _sql_constraints = [ - ('unique_name', 'UNIQUE(name)', 'This property tag already exists.'), - ] diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py deleted file mode 100644 index 6672dd448..000000000 --- a/estate/models/estate_property_type.py +++ /dev/null @@ -1,25 +0,0 @@ -from odoo import models, fields, api - - -class EstateProperty(models.Model): - _name = 'estate.property.type' - _description = 'Estate Property Type' - _order = 'sequence, name' - - name = fields.Char(string="Name", required=True) - sequence = fields.Integer(string='Sequence', default=10) - property_ids = fields.One2many('estate.property', 'property_type_id', string="Properties") - offer_ids = fields.One2many('estate.property.offer', 'property_type_id', string="Offers") - offer_count = fields.Integer( - string="Number of Offers", - compute='_compute_offer_count' - ) - - _sql_constraints = [ - ('unique_name', 'UNIQUE(name)', 'This property type already exists.'), - ] - - @api.depends('offer_ids') - def _compute_offer_count(self): - for record in self: - record.offer_count = len(record.offer_ids) diff --git a/estate/models/res_users.py b/estate/models/res_users.py deleted file mode 100644 index dc96f330e..000000000 --- a/estate/models/res_users.py +++ /dev/null @@ -1,12 +0,0 @@ -from odoo import models, fields - - -class ResUsers(models.Model): - _inherit = 'res.users' - - property_ids = fields.One2many( - 'estate.property', - 'seller_id', - string='Properties', - domain="['|', ('state', '=', 'new'), ('state', '=', 'offer received')]" - ) diff --git a/estate/report/estate_property_reports.xml b/estate/report/estate_property_reports.xml deleted file mode 100644 index bca11a351..000000000 --- a/estate/report/estate_property_reports.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Real Estate Property - estate.property - qweb-pdf - estate.report_property_offers - estate.report_property_offers - - report - - - - User Real Estate Property - res.users - qweb-pdf - estate.report_property_offers_users - estate.report_property_offers_users - - report - - - \ No newline at end of file diff --git a/estate/report/estate_property_templates.xml b/estate/report/estate_property_templates.xml deleted file mode 100644 index 05c6036ad..000000000 --- a/estate/report/estate_property_templates.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/estate/security/estate_security.xml b/estate/security/estate_security.xml deleted file mode 100644 index 8820437dd..000000000 --- a/estate/security/estate_security.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - Agent - - - - - - Manager - - - - - - - Estate Property User Access Rule - - - ['|', ('seller_id', '=', user.id), ('seller_id', '=', False)] - - - - Estate Property User Access Rule - - - - - - Restricted Record: multi-company - - - - [('company_id', 'in', company_ids)] - - - diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv deleted file mode 100644 index 34142f18b..000000000 --- a/estate/security/ir.model.access.csv +++ /dev/null @@ -1,11 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_estate_property_public,access_estate_property,model_estate_property,base.group_public,1,0,0,0 -access_estate_property_manager,access_estate_property,model_estate_property,estate.estate_group_manager,1,1,1,1 -access_estate_property_type_manager,access_estate_property_type,model_estate_property_type,estate.estate_group_manager,1,1,1,1 -access_estate_property_tag_manager,access_estate_property_tag,model_estate_property_tag,estate.estate_group_manager,1,1,1,1 -access_estate_property_offer_manager,access_estate_property_offer,model_estate_property_offer,estate.estate_group_manager,1,1,1,1 -access_estate_property_user,access_estate_property,model_estate_property,estate.estate_group_user,1,1,1,0 -access_estate_property_type_user,access_estate_property_type,model_estate_property_type,estate.estate_group_user,1,0,0,0 -access_estate_property_tag_user,access_estate_property_tag,model_estate_property_tag,estate.estate_group_user,1,0,0,0 -access_estate_property_offer_user,access_estate_property_offer,model_estate_property_offer,estate.estate_group_user,1,1,1,1 -access_estate_property_offer_wizard_user,access_estate_property_offer_wizard_user,model_estate_property_offer_wizard,base.group_user,1,1,1,0 \ No newline at end of file diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml deleted file mode 100644 index b9262664d..000000000 --- a/estate/views/estate_menus.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/estate/views/estate_property_controller_template.xml b/estate/views/estate_property_controller_template.xml deleted file mode 100644 index 5ace21d1f..000000000 --- a/estate/views/estate_property_controller_template.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/estate/views/estate_property_offer_view.xml b/estate/views/estate_property_offer_view.xml deleted file mode 100644 index c95e5ab5c..000000000 --- a/estate/views/estate_property_offer_view.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - Property Offers - estate.property.offer - tree,form - [('property_type_id', '=', active_id)] - - - - estate.property.offer.form - estate.property.offer - -
- - - - - - - - -
-
-
- - - estate.property.offer.tree - estate.property.offer - - - - - - - - - - - -
-

- -
- - - - - - - - - - - - -
- - -
-
- - - - -
diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml deleted file mode 100644 index 9cf8601b6..000000000 --- a/estate/views/estate_property_views.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - Estate Properties - estate.property - {'search_default_available': True} - tree,form,kanban - -

- Create a new property -

- List a new property and details using the new button. -

-
-
- - - estate.property.kanban - estate.property - - - - - -
-
- - - -
-
- Expected Price: - -
-
- Best Offer: - -
-
- Selling Price: - -
-
- -
-
-
-
-
-
-
- - - - - - estate.property.tree - estate.property - - -
-
- - - - - - - - - - - - - - - - -
-
-
- - - - estate.property.form - estate.property - -
-
- -
- -

- - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
-
-
-
- - - estate.property.search - estate.property - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/estate/views/res_users_view.xml b/estate/views/res_users_view.xml deleted file mode 100644 index 6cec69357..000000000 --- a/estate/views/res_users_view.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Users - res.users - tree,form - - - - res.users.form.inherit.property_ids - res.users - - - - - - - - - - - - - - - - - diff --git a/estate/wizard/__init__.py b/estate/wizard/__init__.py deleted file mode 100644 index e9926bcd3..000000000 --- a/estate/wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import estate_property_offer_wizard diff --git a/estate/wizard/estate_property_offer_wizard.py b/estate/wizard/estate_property_offer_wizard.py deleted file mode 100644 index 7549374a4..000000000 --- a/estate/wizard/estate_property_offer_wizard.py +++ /dev/null @@ -1,23 +0,0 @@ -from odoo import models, fields - - -class EstatePropertyOfferWizard(models.TransientModel): - _name = 'estate.property.offer.wizard' - _description = 'Estate Property offer wizard' - - price = fields.Float(string='Offer Price', required=True) - validity = fields.Integer(default=7) - partner_id = fields.Many2one('res.partner', string='Partner', required=True) - - def make_offer(self): - active_ids = self.env.context.get('active_ids') - properties = self.env['estate.property'].browse(active_ids) - for prop in properties: - prop.state = "offer_received" - self.env['estate.property.offer'].create({ - 'property_id': prop.id, - 'price': self.price, - 'validity': self.validity, - 'partner_id': self.partner_id.id, - }) - return {'type': 'ir.actions.act_window_close'} diff --git a/estate/wizard/estate_property_offer_wizard.xml b/estate/wizard/estate_property_offer_wizard.xml deleted file mode 100644 index 660b01ea7..000000000 --- a/estate/wizard/estate_property_offer_wizard.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Add Property Offer - estate.property.offer.wizard - form - new - {'active_ids': active_ids} - - - - estate.property.offer.wizard.form - estate.property.offer.wizard - -
- - - - - -
-
-
-
-
-
diff --git a/estate_account/__init__.py b/estate_account/__init__.py deleted file mode 100644 index 0650744f6..000000000 --- a/estate_account/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/estate_account/__manifest__.py b/estate_account/__manifest__.py deleted file mode 100644 index 0fd6284c6..000000000 --- a/estate_account/__manifest__.py +++ /dev/null @@ -1,17 +0,0 @@ -{ - 'name': 'Estate Account', - 'version': '1.0', - 'category': 'Real Estate', - 'summary': 'Accounting Integration for Real Estate', - 'description': """ - This module integrates the Real Estate module with the Accounting module. - """, - 'author': 'Akya', - 'depends': ['estate', 'account'], - 'data': [ - 'report/estate_property_report_invoice.xml' - ], - 'installable': True, - 'application': True, - 'license': 'AGPL-3' -} diff --git a/estate_account/models/__init__.py b/estate_account/models/__init__.py deleted file mode 100644 index 5e1963c9d..000000000 --- a/estate_account/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import estate_property diff --git a/estate_account/models/estate_property.py b/estate_account/models/estate_property.py deleted file mode 100644 index 4bf38bfcf..000000000 --- a/estate_account/models/estate_property.py +++ /dev/null @@ -1,31 +0,0 @@ -from odoo import Command, models - - -class EstateProperty(models.Model): - _inherit = "estate.property" - - def action_sold(self): - self.env["account.move"].create( - { - "move_type": "out_invoice", - "partner_id": self.buyer_id.id, - "invoice_line_ids": [ - Command.create( - { - "name": self.title, - "quantity": 1, - "price_unit": 0.06 * self.selling_price, - } - ), - Command.create( - { - "name": "administrative_fees", - "quantity": 1, - "price_unit": 100, - } - ), - - ], - } - ) - return super().action_sold() diff --git a/estate_account/report/estate_property_report_invoice.xml b/estate_account/report/estate_property_report_invoice.xml deleted file mode 100644 index 434e335ec..000000000 --- a/estate_account/report/estate_property_report_invoice.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - \ No newline at end of file diff --git a/estate_event/__init__.py b/estate_event/__init__.py deleted file mode 100644 index 9b4296142..000000000 --- a/estate_event/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import models -from . import wizard diff --git a/estate_event/__manifest__.py b/estate_event/__manifest__.py deleted file mode 100644 index 12a8becc2..000000000 --- a/estate_event/__manifest__.py +++ /dev/null @@ -1,20 +0,0 @@ -{ - 'name': "estate_event", - 'summary': "Short (1 phrase/line) summary of the module's purpose", - 'description': """ -Long description of module's purpose - """, - 'author': "My Company", - 'website': "https://www.yourcompany.com", - 'category': 'Uncategorized', - 'version': '0.1', - 'depends': ['base', 'estate', 'calendar'], - 'data': [ - 'security/ir.model.access.csv', - 'views/views.xml', - 'wizard/estate_property_event_view.xml' - ], - 'demo': [ - 'demo/demo.xml', - ], -} diff --git a/estate_event/models/__init__.py b/estate_event/models/__init__.py deleted file mode 100644 index 5b65b9068..000000000 --- a/estate_event/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import estate_event diff --git a/estate_event/models/estate_event.py b/estate_event/models/estate_event.py deleted file mode 100644 index 3633f66e2..000000000 --- a/estate_event/models/estate_event.py +++ /dev/null @@ -1,22 +0,0 @@ -from odoo import models, fields - - -class EstateEvent(models.Model): - _name = 'estate.event' - _description = 'estate property event' - - date = fields.Datetime(string="Date", required=True) - attendee_ids = fields.Many2many('res.partner', string="Attendees") - organizer_id = fields.Many2one('res.users', string="Organizer", default=lambda self: self.env.user.id) - event_name = fields.Char(string="Event Name", required=True) - - def create_event(self): - self.env['calendar.event'].create({ - 'name': self.event_name, - 'start': self.date, - 'stop': self.date, - 'allday': False, - 'user_id': self.organizer_id.id, - 'partner_ids': [(6, 0, self.attendee_ids.ids)], - }) - return {'type': 'ir.actions.act_window_close'} diff --git a/estate_event/security/ir.model.access.csv b/estate_event/security/ir.model.access.csv deleted file mode 100644 index 4d840f7e7..000000000 --- a/estate_event/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_estate_property_event_wizard,access_estate_property_event_wizard,model_estate_property_event_wizard,,1,1,1,1 diff --git a/estate_event/views/views.xml b/estate_event/views/views.xml deleted file mode 100644 index 309c2d1bf..000000000 --- a/estate_event/views/views.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - estate.event.form - estate.event - -
- - - - - - -
-
-
-
-
- - - Create Event - estate.event - form - - new - - -
diff --git a/estate_event/wizard/__init__.py b/estate_event/wizard/__init__.py deleted file mode 100644 index 8a499ee66..000000000 --- a/estate_event/wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import estate_property_event_wizard \ No newline at end of file diff --git a/estate_event/wizard/estate_property_event_view.xml b/estate_event/wizard/estate_property_event_view.xml deleted file mode 100644 index 860a851f9..000000000 --- a/estate_event/wizard/estate_property_event_view.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - estate.property.event.wizard.form - estate.property.event.wizard - -
- - - - - - -
-
-
-
-
- - - Create Event - estate.property.event.wizard - form - - new - - - - estate.property.form.inherit.create.event - estate.property - - - -