Conversation
delcourtfl
left a comment
There was a problem hiding this comment.
Hello there ! Just added a few general comments.
abe8e35 to
94bb329
Compare
delcourtfl
left a comment
There was a problem hiding this comment.
Hello ! Everything is quite good already, just added a few minor remarks.
2ddcfb0 to
b250530
Compare
delcourtfl
left a comment
There was a problem hiding this comment.
Hello there ! Good work already, just one nitpick.
34211d5 to
d1a42b4
Compare
d1a42b4 to
08a9021
Compare
08a9021 to
debdef0
Compare
| @api.model_create_multi | ||
| def create(self, vals): | ||
| for offer in vals: | ||
| linked_property = self.env["estate.property"].browse(offer["property_id"]) |
There was a problem hiding this comment.
Avoid making search and browse calls on each iteration of the loop (this is quite important as it could cause performance issues). Batching the search and filtering inside the loop for the relevant results could be a better approach for that.
| </xpath> | ||
| </field> | ||
| </record> | ||
| </odoo> No newline at end of file |
| invoice_vals_list.append(invoice_vals) | ||
|
|
||
| # Creating invoice | ||
| self.env["account.move"].sudo().with_context(default_move_type="out_invoice").create(invoice_vals_list) |
There was a problem hiding this comment.
Good job on batching the values in a single create call ! (better for the performances)
But always try to avoid sudo if possible, it bypasses the user rights and I don't think it's needed in this case.
| if property.state != "new" and property.state != "cancelled": | ||
| msg = "Only new or cancelled properties can be deleted" | ||
| raise UserError(msg) | ||
| return super().unlink() |
There was a problem hiding this comment.
You don't need the super().unlink() with the ondelete decorator

Pull request for the tutorials