From 1f669e253c80c800256eaef378bf54f11955737f Mon Sep 17 00:00:00 2001 From: alia4a Date: Wed, 9 Sep 2026 14:18:22 +0300 Subject: [PATCH 1/3] currently building meeting room reservation --- .../1787483454116-estate-total-area-field.md | 18 + ODOO_15_FINAL_WORD_AND_RUNBOT_GUIDE.md | 699 ++++++++++++++++++ estate/__init__.py | 1 + estate/__manifest__.py | 14 + estate/models/__init__.py | 5 + estate/models/estate_property.py | 103 +++ estate/models/estate_property_offer.py | 83 +++ estate/models/estate_property_tag.py | 14 + estate/models/estate_property_type.py | 22 + estate/models/res_users.py | 7 + estate/security/ir.model.access.csv | 4 + estate/views/estate_menus.xml | 11 + estate/views/estate_property_offer_views.xml | 46 ++ estate/views/estate_property_tag_views.xml | 32 + estate/views/estate_property_type_views.xml | 55 ++ estate/views/estate_property_views.xml | 161 ++++ estate/views/res_users_view.xml | 23 + estate_account/__init__.py | 1 + estate_account/__manifest__.py | 4 + estate_account/models/__init__.py | 1 + estate_account/models/estate_property.py | 30 + meeting_schedule/__init__.py | 1 + meeting_schedule/__manifest__.py | 8 + meeting_schedule/models/__init__.py | 0 meeting_schedule/models/meeting_building.py | 34 + .../models/meeting_reservation.py | 34 + meeting_schedule/models/meeting_room.py | 16 + meeting_schedule/models/res_users.py | 6 + meeting_schedule/security/ir.model.access.csv | 0 meeting_schedule/static/description/icon.png | Bin 0 -> 361389 bytes .../views/meeting_building_views.xml | 0 meeting_schedule/views/meeting_menus.xml | 3 + meeting_schedule/views/meeting_room_views.xml | 0 meeting_schedule/views/reservation_views.xml | 49 ++ pyrightconfig.json | 4 + 35 files changed, 1489 insertions(+) create mode 100644 .kilo/plans/1787483454116-estate-total-area-field.md create mode 100644 ODOO_15_FINAL_WORD_AND_RUNBOT_GUIDE.md create mode 100644 estate/__init__.py create mode 100644 estate/__manifest__.py create mode 100644 estate/models/__init__.py create mode 100644 estate/models/estate_property.py create mode 100644 estate/models/estate_property_offer.py create mode 100644 estate/models/estate_property_tag.py create mode 100644 estate/models/estate_property_type.py create mode 100644 estate/models/res_users.py create mode 100644 estate/security/ir.model.access.csv create mode 100644 estate/views/estate_menus.xml create mode 100644 estate/views/estate_property_offer_views.xml create mode 100644 estate/views/estate_property_tag_views.xml create mode 100644 estate/views/estate_property_type_views.xml create mode 100644 estate/views/estate_property_views.xml create mode 100644 estate/views/res_users_view.xml create mode 100644 estate_account/__init__.py create mode 100644 estate_account/__manifest__.py create mode 100644 estate_account/models/__init__.py create mode 100644 estate_account/models/estate_property.py create mode 100644 meeting_schedule/__init__.py create mode 100644 meeting_schedule/__manifest__.py create mode 100644 meeting_schedule/models/__init__.py create mode 100644 meeting_schedule/models/meeting_building.py create mode 100644 meeting_schedule/models/meeting_reservation.py create mode 100644 meeting_schedule/models/meeting_room.py create mode 100644 meeting_schedule/models/res_users.py create mode 100644 meeting_schedule/security/ir.model.access.csv create mode 100644 meeting_schedule/static/description/icon.png create mode 100644 meeting_schedule/views/meeting_building_views.xml create mode 100644 meeting_schedule/views/meeting_menus.xml create mode 100644 meeting_schedule/views/meeting_room_views.xml create mode 100644 meeting_schedule/views/reservation_views.xml create mode 100644 pyrightconfig.json diff --git a/.kilo/plans/1787483454116-estate-total-area-field.md b/.kilo/plans/1787483454116-estate-total-area-field.md new file mode 100644 index 00000000000..60775428d60 --- /dev/null +++ b/.kilo/plans/1787483454116-estate-total-area-field.md @@ -0,0 +1,18 @@ +# Plan: Add `total_area` Computed Field to `estate.property` + +## Context +The `estate.property` model currently has `living_area` (Integer) and `garden_area` (Integer) fields but no computed total. The form view displays these fields separately. A `total_area` computed field is needed that sums both. + +## Changes + +### 1. Model field (`estate/models/estate_property.py`) +- Import `api` from `odoo` (currently only `fields` and `models` are imported). +- Add `total_area = fields.Integer(string="Total Area (sqm)", compute="_compute_total_area", store=True)`. +- Add method `_compute_total_area(self)` decorated with `@api.depends('living_area', 'garden_area')` that sets `total_area = living_area + garden_area`. + +### 2. Form view (`estate/views/estate_property_views.xml`) +- Add `` after `garden_area` in the "Description" page group (matching the pattern shown in the Odoo tutorial goal image). + +## Validation +- Verify Python syntax of updated model file. +- Optionally restart Odoo service and upgrade `estate` module to confirm no errors. diff --git a/ODOO_15_FINAL_WORD_AND_RUNBOT_GUIDE.md b/ODOO_15_FINAL_WORD_AND_RUNBOT_GUIDE.md new file mode 100644 index 00000000000..c1f30910b5d --- /dev/null +++ b/ODOO_15_FINAL_WORD_AND_RUNBOT_GUIDE.md @@ -0,0 +1,699 @@ +# Odoo 15 Developer Guide: The Final Word & Runbot Mastery + +> **Reference Sources**: +> - Odoo 15 Official Tutorial: [Chapter 16: The final word](https://www.odoo.com/documentation/15.0/developer/tutorials/getting_started/16_final_word.html) +> - Odoo 15 Official Guidelines: [Contributing & Coding Guidelines](https://www.odoo.com/documentation/15.0/contributing/development/coding_guidelines.html) +> - Odoo Continuous Integration: [Odoo Runbot](https://runbot.odoo.com/) + +--- + +## Table of Contents +1. [Overview & Tutorial Conclusion](#1-overview--tutorial-conclusion) +2. [Part 1: Odoo 15 Official Coding Guidelines](#2-part-1-odoo-15-official-coding-guidelines) + - [2.1 Module Directory Layout & Permissions](#21-module-directory-layout--permissions) + - [2.2 File Naming Conventions](#22-file-naming-conventions) + - [2.3 XML Architecture & Best Practices](#23-xml-architecture--best-practices) + - [2.4 XML ID Naming Conventions](#24-xml-id-naming-conventions) + - [2.5 View Inheritance Guidelines](#25-view-inheritance-guidelines) + - [2.6 Python & PEP8 Standards (Odoo 15 Exemptions)](#26-python--pep8-standards-odoo-15-exemptions) + - [2.7 Strict Model Attribute Ordering](#27-strict-model-attribute-ordering) + - [2.8 Method Naming & Ensure One](#28-method-naming--ensure-one) + - [2.9 ORM Idioms & Golden Rules](#29-orm-idioms--golden-rules) + - [2.10 Translation `_()` Rules](#210-translation-_-rules) +3. [Part 2: Real-World Refactoring Audit (`estate` Module)](#3-part-2-real-world-refactoring-audit-estate-module) + - [3.1 Issues Identified in Tutorial Code](#31-issues-identified-in-tutorial-code) + - [3.2 Before & After Refactored Code](#32-before--after-refactored-code) +4. [Part 3: Mastering Odoo Runbot for Odoo 15](#4-part-3-mastering-odoo-runbot-for-odoo-15) + - [4.1 What is Runbot?](#41-what-is-runbot) + - [4.2 Navigating the Odoo 15 Matrix](#42-navigating-the-odoo-15-matrix) + - [4.3 Connecting to Live Builds](#43-connecting-to-live-builds) + - [4.4 Debugging & Testing Workflows](#44-debugging--testing-workflows) + - [4.5 Running Local CI Tests (Runbot Simulation)](#45-running-local-ci-tests-runbot-simulation) +5. [Summary Checklist](#5-summary-checklist) + +--- + +## 1. Overview & Tutorial Conclusion + +In the official Odoo 15 Developer Tutorial (*Getting Started*), Chapters 1 through 15 walk developers through building a complete real-estate management module (`estate`) and extending standard invoicing (`estate_account`). + +**Chapter 16: "The final word"** acts as the graduation step. It transitions a developer from building tutorial exercises to writing production-ready, clean, maintainable, and standard-compliant Odoo applications. It focuses on two core pillars: +1. **Refactoring to Odoo Coding Guidelines**: Elevating code cleanliness, maintainability, translation friendliness, and structure to match core Odoo code. +2. **Testing on Odoo Runbot**: Utilizing Odoo's continuous integration platform to test standard modules, verify bug fixes, inspect standard implementations, and validate regressions. + +```mermaid +flowchart LR + A["Tutorial Modules (estate, estate_account)"] --> B["Chapter 16: The Final Word"] + B --> C["1. Refactor Code\n(Odoo 15 Coding Guidelines)"] + B --> D["2. Validate & Test\n(Odoo Runbot CI)"] + C --> E["Production-Ready Odoo App"] + D --> E +``` + +--- + +## 2. Part 1: Odoo 15 Official Coding Guidelines + +### 2.1 Module Directory Layout & Permissions + +A standard Odoo 15 module must adhere to a strict directory hierarchy: + +```text +custom_addons/my_module/ +├── __init__.py +├── __manifest__.py +├── controllers/ # HTTP & Web controllers routes +│ └── __init__.py +├── data/ # Demonstration & initial seed XML data +├── models/ # Python ORM model definitions +│ └── __init__.py +├── report/ # Printable QWeb reports and SQL-based analytics models +│ └── __init__.py +├── security/ # ir.model.access.csv, groups, and record rules +├── static/ # Assets (JS, SCSS/CSS, images, icons, XML web templates) +│ ├── description/ # icon.png and index.html for the App Store +│ ├── img/ +│ └── src/ +├── tests/ # Automated Python and JS tour tests +│ └── __init__.py +├── views/ # Backend UI views (form, tree, kanban, search, menus) +└── wizard/ # Transient models (models.TransientModel) and their views + └── __init__.py +``` + +> [!IMPORTANT] +> **Filesystem Permissions**: Directories must be set to `0755` (`drwxr-xr-x`) and files to `0644` (`-rw-r--r--`). + +--- + +### 2.2 File Naming Conventions + +- **Models**: Name the file after the main model (singular, snake_case). + - Example: For model `estate.property`, the file is `models/estate_property.py`. + - For inherited models, keep them in their own file named after the inherited model: `models/res_users.py` or `models/res_partner.py`. +- **Views**: Mirror the model filename with the suffix `_views.xml`. + - Example: `views/estate_property_views.xml`. + - Main top-level menus not bound to a single model: `views/_menus.xml`. +- **Security**: + - Access rights: `security/ir.model.access.csv`. + - User groups: `security/_groups.xml`. + - Record rules: `security/_security.xml`. +- **Data**: + - Demonstration data: `data/_demo.xml`. + - Initial configuration / non-updatable data: `data/_data.xml`. +- **Wizards / Transient Models**: + - Python: `wizard/.py`. + - View: `wizard/_views.xml`. + +--- + +### 2.3 XML Architecture & Best Practices + +#### Tag Ordering in `` +Always declare the `id` attribute **before** the `model` attribute: + +```xml + + + estate.property.view.form + estate.property + +
...
+
+
+ + + +``` + +#### Field Attributes +Declare `name` first. Put the value or `eval` next, followed by display attributes (`widget`, `options`, `decoration-*`, `attrs`): + +```xml + +``` + +#### Proper Usage of `` vs `` +In Odoo 15, the outer `` tag is the standard root. You should **only** use `` if you need `noupdate="1"`. If all records in the file are `noupdate="1"`, put it directly on `` and omit `` completely: + +```xml + + + + ... + + + + + + + ... + + + + + + + + ... + + + +``` + +#### Syntactic Sugar Tags +Use shorthand tags instead of verbose `` when available: +- Use `` instead of ``. +- Use `