-
Notifications
You must be signed in to change notification settings - Fork 753
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
My First Odoo Application #70
base: master
Are you sure you want to change the base?
Conversation
Please enter the commit message for your changes. Lines starting Changes to be committed:
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.
Good job !
I see there is the last part missing about the inheritance which is my sense the real advantage of Odoo.
So you do the last part, don't hesitate to ping me, I'll be happy to look at it :)
for property in self: | ||
if property.state == "cancelled": | ||
raise UserError(_("Cancelled properties cannot be sold!")) | ||
property.state = "sold" | ||
|
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.
This was the solution of the slides. I suggest that you check the filtered function from Odoo to see how you could change this code with it :D
def _unlink_if_new_or_canceled(self): | ||
for property in self: | ||
if property.state not in ("new", "canceled"): | ||
raise UserError(_("Only new or canceled property can be deleted!")) |
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.
The same here, you can check the filtered function :)
def create(self, vals_list): | ||
for vals in vals_list: | ||
property = self.env["estate.property"] |
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.
Not finished function ?
@@ -0,0 +1,41 @@ | |||
from odoo import api, fields, models | |||
|
|||
class Offer(models.Model): |
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.
Usually we uses the same name as the name of the model so here EstatePropertyOffer but it is more of a preference
|
||
@api.depends("validity", "create_date") | ||
def _compute_deadline(self): | ||
for estate 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.
It would more appropriate to call your record with the model name
for estate in self: | |
for offer in self: |
No description provided.