-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] models: added estate model security and views
-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
Showing
1 changed file
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|