Skip to content
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

Lezgo #360

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

Lezgo #360

wants to merge 19 commits into from

Conversation

AarnorDeDardaliel
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Feb 17, 2025

Pull request status dashboard

Copy link

@hupo-odoo hupo-odoo left a comment

Choose a reason for hiding this comment

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

Good job for the work! You've already done a lot for the first day. Keep going 😄

Comment on lines 1 to 4
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

#from . import controllers

Choose a reason for hiding this comment

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

no need for all this 😃
the coding: utf-8 isn't necessary since a few versions

#from . import controllers
from . import models

from odoo import api, SUPERUSER_ID

Choose a reason for hiding this comment

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

I don't think this is the right place for this line of code

from . import estate_recurring_plan
from . import estate_property
from . import estate_property_type
from . import estate_property_tags

Choose a reason for hiding this comment

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

some of your file are missing an empty line at the bottom. You can check on the PR the files with a warning at the bottom to see which ones.

Comment on lines 31 to 35
state = fields.Selection(
string='State',
selection = [('new', "new"), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
default='new'
)

Choose a reason for hiding this comment

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

Suggested change
state = fields.Selection(
string='State',
selection = [('new', "new"), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
default='new'
)
state = fields.Selection(
string='State',
selection = [
('new', "new"),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('cancelled', 'Cancelled')
],
default='new',
)

just styling preference. More globally, don't hesitate to give space to your code.

Also don't forget the coma on the last line, because if someone one day must add another attibute to the field, he'll have to add the coma, which will force him to modify your line of code, therefore changing the git history of this line.

<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="Property Types">
<h1 class="mb32"><field name="name"/></h1>

Choose a reason for hiding this comment

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

what does the class mb32 do in runbot ? Not sure it exists


<separator/>

<filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/>

Choose a reason for hiding this comment

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

Suggested change
<filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<filter string="Available" name="available" domain="[('state', 'in', ('new', 'offer_received'))]"/>

a bit more concise

Comment on lines 4 to 5
from odoo import fields, models
from dateutil.relativedelta import relativedelta

Choose a reason for hiding this comment

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

Copy link

@rugo-odoo rugo-odoo left a comment

Choose a reason for hiding this comment

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

Noob.

(hahaha 😄)

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
{

Choose a reason for hiding this comment

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

No licence ?

from . import estate_property
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer

Choose a reason for hiding this comment

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

Missing empty line at end of file.


# Metadata
name = fields.Char('Title', required=True, translate=True, default="Best House In Town")
active = fields.Boolean('Active', default=True)

Choose a reason for hiding this comment

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

By default, the label will be the name of the field capitalize. In this case, it will be Active so there is no need to define it.

garden_area = fields.Integer('Garden Area (sqm)')
garden_orientation = fields.Selection(
string='Garden Orientation',
selection = [('north', "North"), ('south', 'South'), ('east', 'East'), ('west', 'West')]

Choose a reason for hiding this comment

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

Suggested change
selection = [('north', "North"), ('south', 'South'), ('east', 'East'), ('west', 'West')]
selection = [
('north', "North"),
('south', 'South'),
('east', 'East'),
('west', 'West'),
]

This is better. We can add values without breaking the git history.

@api.depends("property_offer_ids")
def _compute_best_price(self):
for record in self:
record.best_price = max(record.property_offer_ids.mapped('price')) if record.property_offer_ids else 0.0

Choose a reason for hiding this comment

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

Suggested change
record.best_price = max(record.property_offer_ids.mapped('price')) if record.property_offer_ids else 0.0
record.best_price = max(record.property_offer_ids.mapped('price') + [0])

Comment on lines 75 to 80
if self.state == 'sold':
raise UserError("You cannot cancel a sold property")
elif self.state == 'cancelled':
raise UserError("Property already cancelled")
else:
self.state = 'cancelled'

Choose a reason for hiding this comment

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

Suggested change
if self.state == 'sold':
raise UserError("You cannot cancel a sold property")
elif self.state == 'cancelled':
raise UserError("Property already cancelled")
else:
self.state = 'cancelled'
if self.state == 'sold':
raise UserError("You cannot cancel a sold property")
if self.state == 'cancelled':
raise UserError("Property already cancelled")
self.state = 'cancelled'

Comment on lines 42 to 44
if self.status == 'accepted':
raise UserError('Offer already accepted')
else: self.property_id.action_accept_offer(self)

Choose a reason for hiding this comment

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

Suggested change
if self.status == 'accepted':
raise UserError('Offer already accepted')
else: self.property_id.action_accept_offer(self)
if self.status == 'accepted':
raise UserError('Offer already accepted')
self.property_id.action_accept_offer(self)

<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<form string="Property tags">
<h1 class="mb32"><field name="name"/></h1>

Choose a reason for hiding this comment

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

What's mb32 ?

Comment on lines 9 to 12




Choose a reason for hiding this comment

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

Extra spaceeeee.

Comment on lines 47 to 48
<div class="row">
<div class="col">

Choose a reason for hiding this comment

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

Pretty sure we don't need this.

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.

4 participants