-
Notifications
You must be signed in to change notification settings - Fork 2.8k
19.0 app traning raibr #1074
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
base: 19.0
Are you sure you want to change the base?
19.0 app traning raibr #1074
Conversation
|
Hello, can you please ensure that your runbot is green 😄 |
dc88f8d to
138ea5d
Compare
138ea5d to
c02245d
Compare
b656e0e to
fcbae9f
Compare
Can you check again ;) |
The models.Constraint syntax does not exist in Odoo's ORM. SQL constraints must be defined using the _sql_constraints class attribute.
The models.Constraint syntax does not exist in Odoo's ORM. SQL constraints must be defined using the _sql_constraints class attribute.
| access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 | ||
| access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 | ||
| access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 | ||
| access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add a final new lines.
| status = fields.Selection( | ||
| selection=[("accepted", "Accepted"), ("refused", "Refused")], copy=False | ||
| ) | ||
| partner_id = fields.Many2one("res.partner", string="Partner", required=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good practice to name your parameters. So here you should add comodel_name='res.partner'.
|
|
||
|
|
||
| class EstatePropertyOffer(models.Model): | ||
| _name = "estate.property.offer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should only use double quotes for non technical fields and single quotes for technical fields.
|
|
||
| price = fields.Float(required=True) | ||
| _check_price = models.Constraint( | ||
| "Check(price > 0)", "The offer price must be strictly positive." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splitting this on multiple lines doesn't provide more readability. You can keep this on a single line.
| record.date_deadline = fields.Date.today() + timedelta(days=record.validity) | ||
|
|
||
| def _inverse_date_deadline(self): | ||
| for record in self: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of record try to name the variable accordingly to the name of the model so something like property_offer or offer would be better.
Same thing at other places
| def action_cancel(self): | ||
| for record in self: | ||
| if record.state == "sold": | ||
| raise UserError("Sold property cannot be cancelled.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
| if ( | ||
| float_compare( | ||
| record.selling_price, | ||
| record.expected_price * 0.9, | ||
| precision_digits=2, | ||
| ) | ||
| < 0 | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this on one line, it shouldn't be too long.
| if ( | |
| float_compare( | |
| record.selling_price, | |
| record.expected_price * 0.9, | |
| precision_digits=2, | |
| ) | |
| < 0 | |
| ): | |
| if float_compare(record.selling_price, record.expected_price * 0.9, precision_digits=2) < 0: |
| 'views/estate_property_offer_views.xml', | ||
| 'views/estate_menus.xml', | ||
| ], | ||
| 'installable': True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
installable is not useful as application is set to true.
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
| { | ||
| 'name': 'Real Estate Advertisement', | ||
| 'version': '1.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to provide the version because it is 1.0 by default.
| @@ -0,0 +1 @@ | |||
| My first change on odoo No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it still useful to keep that ? 🤔

No description provided.