-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] estate: Added inheritance to extend the functionality of curren…
…t model Add business logic and view inheritance for real estate module - Prevent deletion of properties not in 'New' or 'Canceled' state using `ondelete`. - Set property state to 'Offer Received' on offer creation and prevent creating offers with lower amounts than existing ones. - Add `property_ids` field to `res.users` model to list salesperson’s available properties. - Extend `base.view_users_form` to display `property_ids` in a new notebook page.
- Loading branch information
Showing
6 changed files
with
69 additions
and
10 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
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
from . import property_type | ||
from . import property_tag | ||
from . import property_offer | ||
from . import inherited_model |
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from odoo import models, fields, api | ||
|
||
|
||
class InheritedModel(models.Model): | ||
_inherit = "res.users" | ||
|
||
property_ids = fields.One2many( | ||
"estate_property", | ||
"salesman_id", | ||
string="Offers", | ||
domain="['|',('state', '=', 'offer received'),('state', '=', 'offer accepted')]", | ||
) |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data> | ||
|
||
<record id="res_users_view_form" model="ir.ui.view"> | ||
<field name="name">res.users.form.inherit.properties</field> | ||
<field name="model">res.users</field> | ||
<field name="inherit_id" ref="base.view_users_form"/> | ||
<field name="arch" type="xml"> | ||
<!-- Add a new page to the notebook --> | ||
<xpath expr="//notebook" position="inside"> | ||
<page string="Properties"> | ||
<field name="property_ids"> | ||
<tree string="Real Estate Properties"> | ||
<field name="name" /> | ||
<field name="postcode"/> | ||
<field name="property_type_id" /> | ||
<field name="state"/> | ||
<field name="tag_ids" widget="many2many_tags" /> | ||
<field name="bedrooms" /> | ||
<field name="living_area" /> | ||
<field name="selling_price" /> | ||
<field name="expected_price" /> | ||
</tree> | ||
</field> | ||
</page> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</odoo> |