Skip to content

[ADD] Estate: create a new module for real estate management #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: 18.0
Choose a base branch
from

Conversation

josv-odoo
Copy link

Creation of module estate
Create Access file
Create Model for module

@robodoo
Copy link

robodoo commented May 19, 2025

Pull request status dashboard

@barracudapps
Copy link

@josv-odoo
Can you please review the name of your PR and your commits titles/messaged ?
Everything you need to know is here

Copy link

@barracudapps barracudapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @josv-odoo
Here are small improvements you can apply to your codebase to match development standards at Odoo
👍

@@ -0,0 +1,14 @@
{
'name': "Real estate",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'name': "Real estate",
'name': 'Real estate',

Prefer using double quotes ("") for long strings, multiline or user inputs/displays.

@@ -0,0 +1,2 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1

Always newline character at the end of your files for UNIX compatibility.

<field name="name">Test action</field>
<field name="res_model">test_model</field>
<field name="view_mode">list,form</field>
</record>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</record>
</record>

Same here.

@josv-odoo josv-odoo force-pushed the 18.0-task-tutorial-josv branch from 5158389 to 6596273 Compare May 20, 2025 08:40
@josv-odoo josv-odoo changed the title commit end first day chapter 4 ended [ADD] base: create a new module for real estate management May 20, 2025
@josv-odoo josv-odoo force-pushed the 18.0-task-tutorial-josv branch from 6596273 to e9d5840 Compare May 20, 2025 09:39
Copy link

@barracudapps barracudapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josv-odoo
Please, don't push local config files (pyproject.toml) as they are not part of the project.
Small changes required.
👍

from odoo import fields, models


class TestModel(models.Model):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 7 to 9
_description = 'It allows to manage your properties'
name = fields.Char(required=True, default='Unknown')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_description = 'It allows to manage your properties'
name = fields.Char(required=True, default='Unknown')
_description = 'It allows to manage your properties'
name = fields.Char(required=True, default='Unknown')

There should be an empty space here to distinguish private attributes from fields

@josv-odoo josv-odoo force-pushed the 18.0-task-tutorial-josv branch from e3e2293 to c55f8e7 Compare May 20, 2025 11:20
@josv-odoo josv-odoo force-pushed the 18.0-task-tutorial-josv branch from 0ce39ff to cdc392e Compare May 20, 2025 11:30
@josv-odoo josv-odoo changed the title [ADD] base: create a new module for real estate management [ADD] Estate: create a new module for real estate management May 20, 2025
@barracudapps
Copy link

@josv-odoo ,
Please keep this in mind:

@josv-odoo Can you please review the name of your PR and your commits titles/messaged ?
Everything you need to know is here

The title is nearly correct, one small change required though

Comment on lines 1 to 2
#Untracked files
pyproject.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't push your local configuration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget this one please

<field name="arch" type="xml">
<search string="Search Estates">
<field name="name"/>
<filter string="Available" name="available" domain="[('state', '!=', 'sold' ), ('state', '!=', 'cancelled'), ('state', '!=', 'offer_accepted')]"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try using not in

josv-odoo added 2 commits May 21, 2025 13:11
…ate_property_? offer, tag and type\n create one2many, many2one and many2many fields
… Improve the aesthetics. .

Security: prohibit: duplicate tags and negative prices

Actions:  added visuals for properties state, linked status of offer to state of properties, added action to accept/refuse offer, added action to sold/cancel properties.

Aesthetics : Added color to tags, hidden sold/cancelled/accepted/refused button (properties view), added status as a status bar on top (properties view), added properties (in properties type view)
@josv-odoo josv-odoo force-pushed the 18.0-task-tutorial-josv branch from 6efe63a to bc6fa2c Compare May 22, 2025 14:33
Comment on lines 1 to 2
#Untracked files
pyproject.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget this one please

Comment on lines 31 to 34
if record.create_date:
record.date_deadline = record.create_date + relativedelta(days=record.validity)
else:
record.date_deadline = fields.Date.today() + relativedelta(days=record.validity)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a better way to do using or

def action_property_sold(self):
for record in self:
if record.state == 'cancelled':
raise exceptions.UserError('property already cancelled')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import your exceptions for an easier future use

def action_property_cancelled(self):
for record in self:
if record.state == 'sold':
raise exceptions.UserError('property already sold')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise exceptions.UserError('property already sold')
raise UserError(self.env._('property already sold'))

As Séna would say:

In Odoo, translatable strings in "data"-type content are automatically exported for translation. However, other user-facing strings, Odoo cannot automatically know whether they are translatable. To ensure these strings are exported for translation, you need to explicitly mark them. This is achieved by wrapping the literal string with the self.env._() function. The _() function signals to Odoo's translation system that the string should be included in the translation catalog.

More info here: https://www.odoo.com/documentation/18.0/developer/howtos/translations.html#explicit-exports

You can check this line here:
https://github.com/odoo/odoo/blob/05cff3b7d866f6bc95c4b32f343ae14a4da946f2/addons/account/models/account_move.py#L2075

josv-odoo added 4 commits May 23, 2025 09:45
…ype.

-Added smart button on property type form view.
-Added a variable to estate.property.offer and estate.property.type
-Added a field offer_count to improve readability of the smart button (number of offers availables)
Kanban:
- new kanban record in the xml and add kanban as standard view
Link with invoicing:
	New module called estate_account
	- model called estate_sold_inherited that inherit from account to implement on "action_property_sold" (when a property is marked as sold) to create an invoice with the following lines:
	* property price
	* commission for the sale of property
	* Administrative fees
- move estate.estate_property_type_offer_action
- checkStyle: super(class,self) -> super()
- erase '_' at the end of compute function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants