Conversation
Please enter the commit message for your changes. Lines starting Changes to be committed:
jnc-odoo
left a comment
There was a problem hiding this comment.
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.
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.
The same here, you can check the filtered function :)
| def create(self, vals_list): | ||
| for vals in vals_list: | ||
| property = self.env["estate.property"] No newline at end of file |
| @@ -0,0 +1,41 @@ | |||
| from odoo import api, fields, models | |||
|
|
|||
| class Offer(models.Model): | |||
There was a problem hiding this comment.
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.
It would more appropriate to call your record with the model name
| for estate in self: | |
| for offer in self: |
No description provided.