Skip to content

Conversation

@MatteoLeroy
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Oct 20, 2025

Pull request status dashboard

@Mathilde411 Mathilde411 changed the title Add chapter 2 MALER Onboarding Oct 20, 2025
@Mathilde411 Mathilde411 requested a review from alan-odoo October 20, 2025 11:46
Copy link

@alan-odoo alan-odoo left a comment

Choose a reason for hiding this comment

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

Thanks for your work. Except for the missing blank lines, the pep8 is respected and that's good 😃.

@@ -0,0 +1 @@
from . import estate_property No newline at end of file

Choose a reason for hiding this comment

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

A blank line is missing at the end of your file. You have to put it at the end of all of your files 😃.

garden_orientation = fields.Selection(
string='Orientation',
selection=[('north','North'), ('east','East'), ('south','South'), ('west','West')],
) No newline at end of file

Choose a reason for hiding this comment

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

The blank line is also missing.

@@ -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 No newline at end of file

Choose a reason for hiding this comment

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

The blank line is also missing here too 😃.

@@ -0,0 +1 @@
from . import models No newline at end of file

Choose a reason for hiding this comment

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

Here too

'data': [
'security/ir.model.access.csv',
],
} No newline at end of file

Choose a reason for hiding this comment

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

Here too 😃

@@ -0,0 +1,22 @@
from odoo import models, fields

Choose a reason for hiding this comment

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

A blank line is missing here. You should have two blank lines above a class. It is a python convention coming from the pip8.

@MatteoLeroy MatteoLeroy force-pushed the 19.0-onboarding-maler branch from 147498a to 5108d34 Compare October 21, 2025 07:07
Copy link

@alan-odoo alan-odoo left a comment

Choose a reason for hiding this comment

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

Hi @MatteoLeroy 👋

I did a new review of your code. Here are comments about code optimization and python conventions.

Thanks for you work 😃.

Comment on lines +1 to +5
from . import estate_property
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer
from . import inherited_user

Choose a reason for hiding this comment

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

Should be sorted alphabetically 😃.

Comment on lines +1 to +5
from odoo import api, models, fields
from odoo.exceptions import UserError
import datetime
from dateutil.relativedelta import relativedelta
from odoo.tools.float_utils import float_compare

Choose a reason for hiding this comment

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

Same here.

You must also place built-in imports before external imports and external imports before internal imports. A built-in import is when you import code that comes with Python by default (such as datetime). An external import occurs when you import code from outside your project (such as dateutil). And an internal import occurs when you import a code that is present in your project, but in another file.

Suggested change
from odoo import api, models, fields
from odoo.exceptions import UserError
import datetime
from dateutil.relativedelta import relativedelta
from odoo.tools.float_utils import float_compare
import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_compare

Comment on lines +63 to +68
for record in self:
if record.state == 'sold':
raise UserError('A sold property cannot be cancelled')
else:
record.state = 'cancelled'
return True

Choose a reason for hiding this comment

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

Here, your action is used on a form. That means that you are updating only one record. So you do not need to iterate self and you can add a self.ensure_one() to make sure that your self contains only one record, if it is not the case it triggered an error, and so it protects the db. You can apply that to all method called by a button in a form.

Suggested change
for record in self:
if record.state == 'sold':
raise UserError('A sold property cannot be cancelled')
else:
record.state = 'cancelled'
return True
self.ensure_one()
if self.state == 'sold':
raise UserError('A sold property cannot be cancelled')
record.state = 'cancelled'
return True

@api.ondelete(at_uninstall=False)
def unlink_property(self):
for record in self:
if record.state != 'new' and record.state != 'canceled':

Choose a reason for hiding this comment

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

Do not hesitate to use the in operator when you accept several values for a variable.

Suggested change
if record.state != 'new' and record.state != 'canceled':
if record.state in ['new', 'canceled']:

@@ -0,0 +1,67 @@
from odoo import api, models, fields

Choose a reason for hiding this comment

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

Should be sorted alphabetically.

Suggested change
from odoo import api, models, fields
from odoo import api, fields, models

</list>
</field>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

Same here

</list>
</field>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

Same here.

</kanban>
</field>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

Same here.

</notebook>
</field>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

Same here.

from odoo import fields, models


class InheritedUser(models.Model):

Choose a reason for hiding this comment

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

The class and file should be named ResUser and res_user.py, respectively.

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