Skip to content

Commit

Permalink
[ADD] models: added estate model security and views
Browse files Browse the repository at this point in the history
-Introduce security so that we can manage who can access that models.
-In security ;add two file one is .CSV & another one is .XML
-Introduce views ;define properties and menu's
  • Loading branch information
apri-odoo committed Feb 6, 2025
1 parent a68e51b commit afe2d0d
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
from odoo import fields, models
from datetime import timedelta # Import timedelta

class EstateProperty(models.Model):
_name = "estate.property"
_description = "Real Estate Property"

name = fields.Char(required=True)
# active field define here
active = fields.Boolean(string="Active",default=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(string="Availability Date", copy=False)

# Setup the default availability date to 3 months from current date
date_availability = fields.Date(string="Availability Date", copy=False, default=lambda self: fields.Date.today() + timedelta(days=90))

expected_price = fields.Float(required=True)
selling_price = fields.Float(string="selling price",readonly=true,copy=false)
bedrooms = fields.Integer(default="2")
living_area = fields.Integer()

# Making SP readonly and preventing it from being copied
selling_price = fields.Float(string="Selling Price", readonly=True, copy=False)

# Making Default number of bedrooms set to 2
bedrooms = fields.Integer(string="Number of Bedrooms", default=2)

living_area = fields.Integer(string="Living Area(sqm)")
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()

# Boolean fields for garage and garden
is_garage = fields.Boolean()
is_garden = fields.Boolean()
garden_area = fields.Integer(string="Garden(sqm)")

# Selecting garden orientation from predefined options
garden_orientation = fields.Selection([
('north', 'North'),
('north', 'North'), #(sorted database,UI display value)
('south', 'South'),
('east', 'East'),
('west', 'West')
])
state = fields.Selection([
('new','NEW'),
('offer received','Offer Received'),
('offer accepted','Offer Accepted'),
('sold','Sold'),
('cancelled','Cancelled')
],string='Status',default="new",copy=False)

0 comments on commit afe2d0d

Please sign in to comment.