diff --git a/awesome_estate/__init__.py b/awesome_estate/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/awesome_estate/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/awesome_estate/__manifest__.py b/awesome_estate/__manifest__.py new file mode 100644 index 00000000000..a0d14d9f22b --- /dev/null +++ b/awesome_estate/__manifest__.py @@ -0,0 +1,12 @@ +{ + 'name': 'Awesome Estate', + 'version': '0.1', + 'category': 'Tutorials', + 'summary': 'Real Estate Advertisement tutorial module (empty shell)', + 'author': 'Patja', + 'license': 'LGPL-3', + 'depends': ['base'], + 'data': [], + 'application': True, + 'installable': True, +} diff --git a/awesome_estate/docs/chapter_2.md b/awesome_estate/docs/chapter_2.md new file mode 100644 index 00000000000..9f455848570 --- /dev/null +++ b/awesome_estate/docs/chapter_2.md @@ -0,0 +1,20 @@ + +Chapter 2: + +["base"] + +- my module needs Odoo core to be installed first + +Where base is in this repo: + +community/odoo/addons/base/ + +What base provides (high level): +- it loads fundamental UI framework pieces, and security bootstrap +- it sets up core records like languages, users, partners, currencies, companies, countries +- it also provides base security/group/access basics(Chapter 4) + +Why my module depends on it: +- without base, Odoo is missing required core models/config/security, so my module can’t install safely + +application:true suggests that is an installable app and false means its a module. diff --git a/awesome_estate/docs/chapter_3.md b/awesome_estate/docs/chapter_3.md new file mode 100644 index 00000000000..e74fbda332a --- /dev/null +++ b/awesome_estate/docs/chapter_3.md @@ -0,0 +1,41 @@ +# How are fields converted to DB? + +- `fields.Char` → varchar (if size set) or text +- `fields.Text` → text +- `fields.Integer` → int4 (PostgreSQL integer) +- `fields.Float` → numeric (with precision) or float8 (if no digits) +- `fields.Boolean` → bool +- `fields.Date` → date +- `fields.Datetime` → timestamp (without timezone — UTC) +- `fields.Selection` → varchar (stores the internal key string) +- `fields.Many2one` → int4 (foreign key) +- `fields.Binary` → bytea (if not attachment) or stored in `ir.attachment` +- `fields.Html` → text +- `fields.Monetary` → numeric (linked to a currency) + +--- + +## Blueprint / methods / required + +- `class` = blueprint +- `methods` = functions +- `required=True` translates to `NOT NULL` in SQL + +--- + +## Module namespace vs business concept + +- `awesome_estate` is the `__module__` namespace (a conventional prefix) +- `property` is the business concept inside that module + +So the technical model name becomes: `awesome_estate.property` + +--- + +## Selection: key vs label + +- __key__ / internal value (stored in DB) + - `"north"`, `"south"`, `"east"`, `"west"` + +- __label__ / display value (shown in UI) + - `"North"`, `"South"`, `"East"`, `"West"` diff --git a/awesome_estate/docs/initial.md b/awesome_estate/docs/initial.md new file mode 100644 index 00000000000..41052aad40d --- /dev/null +++ b/awesome_estate/docs/initial.md @@ -0,0 +1,44 @@ +# Notes + + +## Start odoo command: + +`./odoo-bin -d --addons-path=` + +### Breakdown: + +`./odoo-bin` : starts the Odoo server +`-d ` : which PostgreSQL database to use (for me: patja) +`--addons-path=` : comma-separated addon folders that Odoo will scan + +### it does: +- loads already-installed modules +- starts the UI and backend services + + +## Upgrade a module (Chapter - 3) + +### Command: + +`./odoo-bin -d -u --addons-path=` + +### Meaning: +`- -u ` : reload it and apply its model/data changes + +### it does: + +- after changing Python models (ORM), upgrade so database schema updates happen` +- after adding security/ACL, upgrade so access rules apply` + +### for me: + +`./odoo-bin --addons-path=addons,../enterprise/,../tutorials/ -d patja -u awesome_estate` + + +## Install a module (first time) + +### Command: +`./odoo-bin -d -i --addons-path=` + +### Meaning: +`- -i `: install the module for the first time in that database diff --git a/awesome_estate/models/__init__.py b/awesome_estate/models/__init__.py new file mode 100644 index 00000000000..2419350f1e9 --- /dev/null +++ b/awesome_estate/models/__init__.py @@ -0,0 +1 @@ +from . import awesome_estate_property diff --git a/awesome_estate/models/awesome_estate_property.py b/awesome_estate/models/awesome_estate_property.py new file mode 100644 index 00000000000..4f6822396b2 --- /dev/null +++ b/awesome_estate/models/awesome_estate_property.py @@ -0,0 +1,31 @@ +from odoo import fields, models + + +class AwesomeEstateProperty(models.Model): + _name = "awesome_estate.property" + _description = "Real Estate Property" + + name = fields.Char(required=True) + description = fields.Text() + postcode = fields.Char() + + date_availability = fields.Date() + expected_price = fields.Float(required=True) + selling_price = fields.Float() + + bedrooms = fields.Integer() + living_area = fields.Integer() + facades = fields.Integer() + + garage = fields.Boolean() + garden = fields.Boolean() + garden_area = fields.Integer() + + garden_orientation = fields.Selection( + [ + ("north", "North"), + ("south", "South"), + ("east", "East"), + ("west", "West"), + ] + )