Skip to content

Commit

Permalink
[IMP] estate: Tutorial chapter 15 - fitting stuff to guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
nape-odoo committed Nov 21, 2024
1 parent b54ca4e commit a54cf51
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
'views/ep_offer_views.xml',
'views/ep_type_views.xml',

'views/res_users_views.xml',

'views/estate_menu_views.xml',
],
'application': True
Expand Down
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer
from . import res_users
7 changes: 0 additions & 7 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,3 @@ def prevent_delete_record(self):
if record.state not in ('new', 'cancelled'):
raise UserError(self.env._("Cannot delete a property with active offers (not New/Cancelled)."))
return True


class ResUsers(models.Model):
_inherit = 'res.users'

# Relational
estate_property_ids = fields.One2many('estate.property', 'salesperson_id', string="Estate properties", domain='[("state", "in", ["new", "recieved"])]')
11 changes: 11 additions & 0 deletions estate/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# licence

from odoo import fields
from odoo import models


class ResUsers(models.Model):
_inherit = 'res.users'

# Relational
estate_property_ids = fields.One2many('estate.property', 'salesperson_id', string="Estate properties", domain='[("state", "in", ["new", "recieved"])]')
15 changes: 15 additions & 0 deletions estate/views/res_users_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="veiw_users_form" model="ir.ui.view">
<field name="name">inherited.res.users.form.estate.property</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Estate properties">
<field name="estate_property_ids" options="{'no_create': True}"/>
</page>
</xpath>
</field>
</record>
</odoo>

0 comments on commit a54cf51

Please sign in to comment.